NAUbackup / VmBackup

XenServer simple backup script
228 stars 61 forks source link

Add possibility to read password from stdin #69

Open megabert opened 6 years ago

megabert commented 6 years ago

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.