-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Potential Security Issue] Leaking ssh host keys #14
Comments
Hi, good point. I'll have a look at it. Thanks a lot for reporting this! |
Hi @AnixPasBesoin, I've been looking at this. I'm not sure how to handle this really. The user must and will mount their host keys wherever they want. I did a test and the private keys are generated already only readable by their owner (UID 1000 in the case shown below). When copied to the # ls -al /tmp/host-keys
[...]
drwxr-xr-x 2 1000 1000 4096 Aug 26 2022 .
-rw------- 1 1000 1000 2602 Apr 18 2022 ssh_host_rsa_key
-rw-r--r-- 1 1000 1000 571 Apr 18 2022 ssh_host_rsa_key.pub
# ls -al /etc/ssh/
[...]
drwxr-xr-x 1 root root 4096 Oct 5 12:32 .
-rw------- 1 root root 2602 Oct 5 12:32 ssh_host_rsa_key
-rw-r--r-- 1 root root 571 Oct 5 12:32 ssh_host_rsa_key.pub
# cat /etc/passwd | grep git
git:x:1005:1005:Git User:/home/git:/usr/bin/git-shell
We could suggest to mount the keys somewhere more obfuscated but the user is free to mount them anywhere really.
Not an option since that would remove the original files from the host too. I'm really out of ideas here so if you have any suggestions please let me know. |
Issue
By default, ssh host keys provided by the user will be mounted on
/tmp/host-keys
, as shown in the provided docker-compose template:And latter on, these files are copied to
/etc/ssh/
using:The issue with the above is that
/tmp
can be read by any user, which means that the private host key can be read by non-priveleged users...Fix
/etc/ssh
The text was updated successfully, but these errors were encountered: