While the arguments are not logged (only interactive commands are logged, and that's in a file that is stored with correct permissions in your home directory) there is still a real danger with passing passwords. Both the command line arguments and the environment variables are visible to all users of the machine who use ps
with the correct options. The exact options to do this vary between OSes, so check your local documentation (on OSX, it's ps -wwaxE
that spills the beans).
The safe way to pass the password in is either via a pipe and the -pass stdin
option to openssl (-k
is insecure and obsolete) or via a file with carefully-set permissions and the -pass file:pathname
option (replacing pathname
with the name of the file, of course). You could also use -pass fd:number
but I don't know how easy that is to fit with os.system
. All the above are secure (possibly with care) because you can't peek inside pipes and you can properly secure the filesystem.
Of course, once you've taken these steps to secure your invocation of openssl, whether or not it is logged won't matter; it will be secure anyway.