Re: Read host keys from environment variables
Philipp Marek via openssh-unix-dev <[email protected]>
| Newsgroups | gmane.network.openssh.devel |
|---|---|
| Message-ID | <[email protected]> |
>> These things are solved on the container provider side -- >> Kubernetes, Openshift, etc. > > Given the lack of references or explanations as to why that is > actually the case you will have to forgive me as I remain unconvinced. Here's a reference. As for the "why", it's just one possible way. https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/#define-a-container-environment-variable-with-data-from-a-single-secret >> Well, the environment variable would be inherited by child processes >> by default anyway. > > An environment variable that is inherited by the child process is also > generally visible to any other user. Hmmm, you don't mean "Unix user" here, do you? Because for me they aren't: -r-------- 1 messagebus messagebus 0 15. Jul 08:35 /proc/1963/environ > If you're proposing encrypting > the environment variables: in order to do that you also have to have > the decryption keys also available to those child processses in such a > way that is *also* not recoverable by other users. > > How do you pass a (private! secret!) host key to the other sshds in a > way that is not recoverable by an arbitrary user on the same system? > Stuffing the host key from the environment into a root-owned host key > file inside the container at startup time seems far less dangerous and > probably works already with a simple shell one-liner. In a minimally-privileged Kubernetes/Openshift container there is no setuid privilege, and therefore only one active unix user. So separation via filesystem rights doesn't apply (as sshd must be able to get the host key!), and also there's no other user that can see the environment. At the moment there's no reading /proc/*/environ from the outside via sftp as fetching data via "-P get" is prohibited; I'm just looking at alternative ways to secure the host-keys.