add keyring support#374
Open
tmaher wants to merge 4 commits into
Open
Conversation
|
Can anyone resolve conflicts and merge this pull request? |
|
As well as this thread "GPG passphrase stored as plaintext?" in http://sourceforge.net/p/s3tools/discussion/618865/thread/95280c28/ remains unanswered. |
|
This is a GREAT to have. Hope someone can resolve and merge as was stated in 2015. |
This was a little shocking to me as well. The fact that it showed my passphrase in plain-text. That should never happen. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
It's always bugged me that
s3cmdwants to save the secret_key and gpg passphrase to a plaintext file in the user's homedir. People like sharing their dotfiles, even when they don't fully realize they may contain credentials. Further, some organizations/employers put home directories on network volumes (e.g. NFS), which exacerbates the problem.Mac OS X, Windows, and Linux-when-using-GNOME/KDE all provide their own mechanism for secret storage. For all three, when the user logs in, their password is hashed. The hash is kept in memory (but not written to disk) for the duration of the login session. It's then used as a symmetric encryption key. When a user wants to store a secret with the OS, it's encrypted by the password-derived key and the ciphertext is persisted to disk via OS-specific files. Fortunately for us, Python's keyring library abstracts away the OS-specific mechanisms. We get a nice simple key/value store API.
This PR attempts to use keyring if it's present. If so, secrets are replaced with the string
_KEYRING_in the config file. To migrate an in-place file, you can runs3cmd --configure. Secrets passed in via env var (e.g. AWS_SECRET_KEY) or as CLI options will, of course, continue to override the config file. There are four new config options to control keyring behavior, documented in the code comments.