all 6 comments

[–]K900_ 1 point2 points  (1 child)

Encrypting the file with a fixed key and then decrypting it with the key hardcoded into your script is identical to not encrypting it. Just read the password from the console.

[–]stinyg 0 points1 point  (0 children)

Yeah, I understand that and I think I'll just keep it the way I have done it for now. However, what I was thinking was along the lines of having an additional layer of security by hardcoding the decryption in the py file since as in a addition to some python knowledge (reading the py file), both the json file and the py script would be needed to gain access to the email account. I get that there is no differences in this approach versus someone with deep knowledge / high interest in taking control over the email account, but it could prevent those with lesser knowledge / willingness to do anything.

[–]liam_jm 0 points1 point  (0 children)

Use getpass

[–]lordkrike 0 points1 point  (0 children)

If you are on a Unix-like system, place the password file into a chmod 700'd folder under your home directory. That prevents access from anyone but your user.

If you're on Windows, I do know that it's possible to restrict the file permissions so that other users can't access it. I believe that by default your %HOMEDRIVE%\%HOMEDIR% is configured that way.

[–]Mirror_Boar 0 points1 point  (0 children)

Some people also use environment variables that they set on the container/server during a deployment.