I am use python fabric with all configuration in one .fab file.
How can I put sensitive data as password to separate file and then import/load to fab main file?
I am use python fabric with all configuration in one .fab file. How can
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Define a simple function within your fabfile.py to read your passwords out of a separate file. Something along the lines of:
This will return
Nonein the event that the username cannot be found and the entire user’s record as a list in the event the user is found.Obviously my example is getting its data from
/etc/passwdbut you can easily adapt this basic functionality to your own file:credentials.datAnd then the above code modified to use this file like this, with the slight variation to return only the password (since we know the database name):
While not as simple as an import, it provides you flexibility to be able to use plaintext files to store your credentials in.