4554551n Posted September 16, 2021 Share Posted September 16, 2021 Hi, I tried to log into my unraid (6.9.2) via ssh today and discovered that the host keys had changed, which freaked me out a bit. I took a look and it looks like they were recreated 4 days ago, which coincides with a reboot. However, rebooting again, they keys didn't change. I've also had the server for coming on 4 years and this is the first time this has happened. I am a little concerned there may have been a breach or something, but the fact that it coincides with a reboot is helping me chill a little. Could someone please let me know why they keys would have updated and how I can stop it happening in the future. Quote Link to comment
4554551n Posted September 23, 2021 Author Share Posted September 23, 2021 Does anyone have any insight into this? Quote Link to comment
ChatNoir Posted September 23, 2021 Share Posted September 23, 2021 Maybe @ljm42 have some insight on this ? Quote Link to comment
trurl Posted September 23, 2021 Share Posted September 23, 2021 Is your server accessible from outside your LAN? If so, how? Quote Link to comment
4554551n Posted September 27, 2021 Author Share Posted September 27, 2021 (edited) Not easily. I've got the swag container reverse proxy pointing to a nextcloud container, and ssh through a jumphost which hasn't been on for a couple of months. The timing coincides with a reboot, so maybe it did something funky and recreated the keys? Though rebooting since doesn't cause a problem. I did find this:? ``` root@[unraid]:~# cat /etc/rc.d/rc.sshd #!/bin/sh # Start/stop/restart the secure shell server: sshd_start() { # make sure ssh dir exists on flash mkdir -p /boot/config/ssh # restore saved keys, config file, etc. (but not subdirs) cp /boot/config/ssh/* /etc/ssh &>/dev/null chmod 600 /etc/ssh/* &>/dev/null # Create host keys if needed and copy any newly generated key(s) back to flash ssh-keygen -A cp -n /etc/ssh/ssh_host*_key* /boot/config/ssh/ /usr/sbin/sshd } ``` So... things didn't copy from boot properly maybe? Edited September 27, 2021 by 4554551n Quote Link to comment
4554551n Posted October 3, 2021 Author Share Posted October 3, 2021 Sad self bump? Quote Link to comment
Squid Posted October 3, 2021 Share Posted October 3, 2021 You might want to look at this https://wiki.unraid.net/Manual/Release_Notes/Unraid_OS_6.9.0#SSH_Improvements Quote Link to comment
ken-ji Posted October 3, 2021 Share Posted October 3, 2021 On 9/27/2021 at 9:50 PM, 4554551n said: Not easily. I've got the swag container reverse proxy pointing to a nextcloud container, and ssh through a jumphost which hasn't been on for a couple of months. The timing coincides with a reboot, so maybe it did something funky and recreated the keys? Though rebooting since doesn't cause a problem. I did find this:? ``` root@[unraid]:~# cat /etc/rc.d/rc.sshd #!/bin/sh # Start/stop/restart the secure shell server: sshd_start() { # make sure ssh dir exists on flash mkdir -p /boot/config/ssh # restore saved keys, config file, etc. (but not subdirs) cp /boot/config/ssh/* /etc/ssh &>/dev/null chmod 600 /etc/ssh/* &>/dev/null # Create host keys if needed and copy any newly generated key(s) back to flash ssh-keygen -A cp -n /etc/ssh/ssh_host*_key* /boot/config/ssh/ /usr/sbin/sshd } ``` So... things didn't copy from boot properly maybe? Could also be some file corruption on your USB stick, where the SSH host keys became 0-byte files or were deleted not copying from /boot during boot is usually an indicator of possible issues with the USB though Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.