Comment 24 for bug 2039577

Revision history for this message
Alex Murray (alexmurray) wrote :

I've finished preparing backports for the other Ubuntu releases (M,L,J,F) and used the following test procedure to validate each - packages are building in the private ~ubuntu-security PPA - since this is an Ubuntu internal issue I plan to just publish these along with an associated USN tomorrow unless anyone feels differently - let me know.

# get current status
systemctl is-enabled ssh.{service,socket} && systemctl is-active ssh.{service,socket} && echo "g-c-c should show active" || echo "g-c-c should show inactive"
# disable in GUI if enabled then check CLI has right output
gnome-control-center sharing
! systemctl is-enabled ssh.service && ! systemctl is-enabled ssh.socket && echo pass || echo fail
# check can't ssh locally
ssh localhost echo fail || echo pass

# now enable and activate just ssh.service
sudo systemctl disable ssh.{service,socket}
sudo systemctl enable ssh.service
sudo systemctl start ssh.service

ssh localhost echo pass || echo fail

# check is active in GUI
G_MESSAGES_DEBUG=all gnome-control-center sharing | grep 'Setting switch state for ssh.service: 1' && echo pass || echo fail

# then disable in GUI and check status on CLI
gnome-control-center sharing
! systemctl is-enabled ssh.service && ! systemctl is-enabled ssh.socket && echo pass || echo fail
# check can't ssh locally
ssh localhost echo fail || echo pass

# now enable ssh.socket
sudo systemctl disable ssh.{service,socket}
sudo systemctl enable ssh.socket
sudo systemctl start ssh.socket

ssh localhost echo pass || echo fail

# check is active in GUI
G_MESSAGES_DEBUG=all gnome-control-center sharing | grep 'Setting switch state for ssh.socket: 1' && echo pass || echo fail
# then disable in GUI and check status on CLI
gnome-control-center sharing
! systemctl is-enabled ssh.service && ! systemctl is-enabled ssh.socket && echo pass || echo fail
# check can't ssh locally
ssh localhost echo fail || echo pass

# finally enable in the gui and check the correct service/socket is active
gnome-control-center sharing

# reboot so we can check the correct service/socket is active
sudo reboot

series=$(lsb_release -cs)
enabled=socket
disabled=service
case $series in
  xenial|bionic|focal|jammy)
    enabled=service
    disabled=socket
    ;;
esac

systemctl is-enabled ssh.$enabled && systemctl is-active ssh.$enabled && ! systemctl is-enabled ssh.$disabled && ! systemctl is-active ssh.$disabled && echo "pass" || echo "fail"

# finally check can ssh locally
ssh localhost echo pass || echo fail