Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

ssh host keys self update

Featured Replies

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.

  • Author

Does anyone have any insight into this?

Is your server accessible from outside your LAN? If so, how?

  • Author

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 by 4554551n

  • Author

Sad self bump?

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

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.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.