But, the first example made me flinch:
$ vault write secret/foo value=bar
Don't ever pass passwords on the command line. On linux, other users can see your command line (ps aux), and it usually ends up in a shell's history file.But, the first example made me flinch:
$ vault write secret/foo value=bar
Don't ever pass passwords on the command line. On linux, other users can see your command line (ps aux), and it usually ends up in a shell's history file.Good security software gently herds the non-expert to make good choices. Too many options, especially specialty risky options, don't help that goal.
There's probably a way to do what you have launching an editor with stdin, but I'd probably suggest documenting an example, to avoid the risk of leaving the secret around.
Also +1 to removing the insecure history option. Documenting the stdin to use 'cat' or something that's not in the history would probably take care of that one.
jolan 4950 0.0 0.0 46164 8820 pts/12 S+ 16:06 0:00 mysql -uroot -px xxxxxxxx
Probably still a race condition and can be viewed before it is erased but at least it would be something.
On FreeBSD I like doing:
/boot/loader.conf: mac_seeotheruids_load="YES"
/etc/sysctl.conf: security.mac.seeotheruids.enabled="1"
Which restricts users to seeing only their own processes. You can make exceptions for a specific group or users with the same primary group.
I still don't put anything sensitive in a command line, of course.
I want to tell the system <look, I have a user foo, and the webapp over there needs access to the mysql over here with that user. Make it so.>
I don't need to know the password my application uses to access the database. I don't WANT that password. No human should ever see this password. And heck, if the system wants to, just swithc passwords every 60 minutes. I don't want to care.
When I want to run something on a server and I don't want it to end in the .history file, I always run vi and execute the commands inside it ( <esc>:!command ).
It always shows in the process list; but for short-lived commands the opportunity window is small for an attacker.
It's a tricky question, one that we've spent a lot of time thinking about at my company (Conjur -- shameless plug, one of our use cases is secrets management). Obviously doing this on a server that others can access/pwn is a bad idea, but that's a very rare use case. Most secrets are being added via the command line from an admin's single user laptop.
In the end, we've settled on what seems to be the same solution as Vault: support other sources (stdin, files, etc.), but allow the command line.
That said, I think you're right that we should look into adding a warning for the CLI tools and placing more emphasis on this fact in our documentation.
It persists in your shell history... your notebook is stolen, then...
You can encrypt the filesystem but it is better to not have your secret information disseminated in your filesystem and computer memory.
Edit: am I wrong? If so, please explain, I really am curious.