Skip to content

Add optional file encryption for user credentials configuration#3391

Merged
svartkanin merged 4 commits intoarchlinux:masterfrom
svartkanin:fix-1111-file-encryption
Apr 26, 2025
Merged

Add optional file encryption for user credentials configuration#3391
svartkanin merged 4 commits intoarchlinux:masterfrom
svartkanin:fix-1111-file-encryption

Conversation

@svartkanin
Copy link
Collaborator

This is a follow-up PR for #3276 to fix #1111.

It'll add a option to store the data in the user_configuration.json file in encrypted form. While saving the configuration files there's a new optional step to encrypt the content and if chosen provide an encryption key. The newly introduced cryptography module will handle the encryption by generating a salt and using Argon2id to encrypt the JSON data with the provided password.

The stored encryption data will look like

$argon2id$<salt>$<encrypted_data>

When providing an encrypted user_credentials.json file, there are 3 ways to provided the encryption key:

  • Via a new argument parameter --creds-decryption-key
  • By setting an environment variable ARCHINSTALL_CREDS_DECRYPTION_KEY
  • If none of the above is specified a prompt on startup will be presented to manually enter the encryption key

@svartkanin svartkanin marked this pull request as ready for review April 13, 2025 05:00
Copy link
Contributor

@codefiles codefiles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reason for using the Password class and not just a str throughout? When it is being used in these changes, it is initialized with plaintext and then is only ever used as plaintext. This looks like unnecessary complexity.

@svartkanin
Copy link
Collaborator Author

@Torxed any concerns with this or can we merge it?

@Torxed
Copy link
Member

Torxed commented Apr 26, 2025

Looks good to me!

@svartkanin svartkanin merged commit fae210d into archlinux:master Apr 26, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

insecure password storage

3 participants