logoalt Hacker News

I prefer to pass secrets between programs through standard input

42 pointsby ingvetoday at 1:02 PM21 commentsview on HN

Comments

kevin_thibedeautoday at 1:42 PM

> Unfortunately you're using a browser (or client library) that my anti-crawler precautions consider suspicious because it's sending inconsistent values for Sec-CH-UA-* HTTP request headers...

The world doesn't exclusively use Chrome. Nice to see even the nerds are contributing to the closed web.

show 6 replies
stale-labstoday at 2:06 PM

[flagged]

show 1 reply
azornathogrontoday at 2:44 PM

For one of my projects my server needs a private key, and it reads this from a file descriptor on startup and then closes the fd. The fd is set up by the systemd unit, which is also configured to restrict filesystem access for the server. So the server reads a key from a file that is never visible in its mount namespace.

show 1 reply
juancntoday at 2:00 PM

I used to do that, I had a sort of IDE that launched a local server, bound to localhost.

The launching process would send a random password through stdin to the child after launch, and the child would use that to authenticate the further RPC calls.

It's surprisingly hard to intercept a process' stdin stream.

Dwedittoday at 1:45 PM

I haven't actually tested this, but aren't the input and output handles exposed on /proc/? What's stopping another process from seeing everything?

show 3 replies
pvtmerttoday at 2:04 PM

Interesting approach. I like Docker/Kubernetes way of secret mounts where you can limit user/group permissions too.

Meanwhile, I was an avid user of the echo secret | ssh consume approach, specifically for the kerberos authentication.

In my workflow, I saved the kerberos password to the macOS keychain, where kinit --use-keychain authenticated me seamlessly. However this wasn't the case for remote machines.

Therefore, I have implemented a quick script that is essentially

    security find-generic-password -a "kerberos" -s "kerberos-password" -w | ssh user@host kinit user@REALM
Which served me really good for the last 4~years.
blibbletoday at 2:23 PM

linux has a key api that works pretty well

man keyctl