Add possibility to read password from stdin #69
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.
I'd like to have the possibility to have the password read from stdin to reduce the danger for the password to be easily captured when having root access to a XenServer.
At the moment the password is visible in the process list when directly supplied at the command line or nearly cleartext in the specified file base64-encoded.
That added change adds a third possibility: Specify "-" as the password in which case the password is read from stdin like this:
VmBackup.py - ".*" <<<'secret_password'
or
echo "$password" | ssh xenserver VmBackup.py - "vm-name-to-backup"
In this way the password is not shown in the process list and it does not have to be present on all XenServers. It can be kept on a secure remote machine, which initiates the start of the script.
NOTE:
I'm not really familiar with python very well, so look at my code with care.