Skip to content

Keep harden_ssh working when sshd is socket-activated - #860

Draft
antobinary wants to merge 1 commit into
bigbluebutton:v4.0.x-releasefrom
antobinary:40-harden-ssh-privsep
Draft

antobinary wants to merge 1 commit into
bigbluebutton:v4.0.x-releasefrom
antobinary:40-harden-ssh-privsep

Conversation

@antobinary

Copy link
Copy Markdown
Member

On Ubuntu 24.04 openssh-server is socket-activated. The dist-upgrade that runs earlier in the installer upgrades openssh-server, and that package's postinst only restarts ssh.socket. Restarting the socket stops ssh.service, and systemd removes the unit's RuntimeDirectory, /run/sshd, with it. The session running bbb-install survives (KillMode=process), so when harden_ssh later runs sshd -t there is no daemon and no /run/sshd, and sshd aborts with "Missing privilege separation directory: /run/sshd". harden_ssh then removes the hardening file and exits the installer with status 1, before the LTI/Greenlight, ImageMagick policy and final bbb-conf --check steps.

Create /run/sshd before validating. systemd recreates and removes the directory on service start and stop anyway, so this is harmless when the daemon is already running.

The restart fallback had the same blind spot: sshd.service is only an alias of ssh.service, and the alias is not installed while ssh.socket is what is enabled, so systemctl restart sshd fails there with "Unit sshd.service not found". The unit has been ssh.service on every Ubuntu release the installer supports. systemctl try-restart ssh.service restarts a running daemon and is a no-op for an idle socket-activated one, whose next connection starts it with the new config.

Reproduced and verified on a fresh 24.04 droplet installing 4.0.

On Ubuntu 24.04 openssh-server is socket-activated. The dist-upgrade
that runs earlier in the installer upgrades openssh-server, and that
package's postinst only restarts ssh.socket. Restarting the socket
stops ssh.service, and systemd removes the unit's RuntimeDirectory,
/run/sshd, with it. The session running bbb-install survives
(KillMode=process), so when harden_ssh later runs `sshd -t` there is
no daemon and no /run/sshd, and sshd aborts with "Missing privilege
separation directory: /run/sshd". harden_ssh then removes the
hardening file and exits the installer with status 1, before the
LTI/Greenlight, ImageMagick policy and final bbb-conf --check steps.

Create /run/sshd before validating. systemd recreates and removes
the directory on service start and stop anyway, so this is harmless
when the daemon is already running.

The restart fallback had the same blind spot: sshd.service is only
an alias of ssh.service, and the alias is not installed while
ssh.socket is what is enabled, so `systemctl restart sshd` fails
there with "Unit sshd.service not found". The unit has been
ssh.service on every Ubuntu release the installer supports.
`systemctl try-restart ssh.service` restarts a running daemon and is
a no-op for an idle socket-activated one, whose next connection
starts it with the new config.

Reproduced and verified on a fresh 24.04 droplet installing 4.0.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant