← Back to team overview

debcrafters-packages team mailing list archive

[Bug 2111226] Re: sshd socket activation does not support AF_VSOCK

 

** Description changed:

  [Impact]
  On Ubuntu VMs running under Microsoft Hyper-V, users commonly rely on 'hv_sock' (Hyper-V socket) to enable seamless SSH access using the 'hvc.exe' tool on the Windows host. This works correctly on Ubuntu Jammy and earlier ( and Oracular and later with different mechanism ), but fails silently in Noble, because the logic in Ubuntu's systemd-socket-activation.patch silently rejects sockets that are not AF_INET or AF_INET6.
  
  Hence, when an AF_VSOCK socket is passed (which is supported by systemd
  socket's ListenStream=), the client connection silently hangs.
  
  [Test Case]
  
  The autopkgtests for openssh contain socket-activation tests to help
  avoid regressions in the existing logic. In addition to those tests, the
  below manual testing will be performed to verify the AF_VSOCK fix:
  
- 1. Launch a VM with vsock support. This could be e.g. a VM on Hyper-V
- using hv_vsock, or a LXD VM created with:
+ 1. Launch a VM on Hyper-V, and ensure the hv_sock module is loaded:
  
- $ lxc launch --vm ubuntu:$series
+ $ lsmod | grep hv_sock
  
- 2. Ensure the relevant vsock modules are loaded:
+ 2. Adding the socket conf for SSH to listen on vsock:
  
- $ lsmod | grep vsock
- 
- 3. Adding the socket conf for SSH to listen on vsock:
- 
+ $ mkdir -p /etc/systemd/system/ssh.socket.d/
  $ cat > /etc/systemd/system/ssh.socket.d/vsock.conf << EOF
  [Socket]
  ListenStream=vsock::22
  EOF
  $ systemctl daemon-reload
  $ systemctl restart ssh.socket
  
- 4. Attempt the connection:
- 
- (a) Attempt to connect from the Hyper-V host:
+ 3. Attempt to connect from the Hyper-V host:
  
     hvc ssh user@ubuntu-vm
  
  Expected Result: Connection succeeds and SSH login is presented.
  Actual Result: The connection hangs.
  
  [Where problems could occur]
  
  The effective goals of the patch are to (a) accept when AF_VSOCK sockets
  are passed by systemd, and (b) to close() (rather than silently ignore)
  unsupported socket types.
  
  There is additional logic to properly log about where the server is
  listening. This creates additional room for error.
  
  All of the changes are contained within the setup_systemd_socket()
  function. Therefore, problems would be seen when sshd is socket-
  activated, e.g. on the first connection attempt to a given server.

** Description changed:

  [Impact]
- On Ubuntu VMs running under Microsoft Hyper-V, users commonly rely on 'hv_sock' (Hyper-V socket) to enable seamless SSH access using the 'hvc.exe' tool on the Windows host. This works correctly on Ubuntu Jammy and earlier ( and Oracular and later with different mechanism ), but fails silently in Noble, because the logic in Ubuntu's systemd-socket-activation.patch silently rejects sockets that are not AF_INET or AF_INET6.
+ On Ubuntu VMs running under Microsoft Hyper-V, users commonly rely on 'hv_sock' (Hyper-V socket) to enable seamless SSH access using the 'hvc.exe' tool on the Windows host. This works correctly on Ubuntu Jammy and earlier, but fails silently in Noble, because the logic in Ubuntu's systemd-socket-activation.patch silently rejects sockets that are not AF_INET or AF_INET6.
  
  Hence, when an AF_VSOCK socket is passed (which is supported by systemd
  socket's ListenStream=), the client connection silently hangs.
  
  [Test Case]
  
  The autopkgtests for openssh contain socket-activation tests to help
  avoid regressions in the existing logic. In addition to those tests, the
  below manual testing will be performed to verify the AF_VSOCK fix:
  
  1. Launch a VM on Hyper-V, and ensure the hv_sock module is loaded:
  
  $ lsmod | grep hv_sock
  
  2. Adding the socket conf for SSH to listen on vsock:
  
  $ mkdir -p /etc/systemd/system/ssh.socket.d/
  $ cat > /etc/systemd/system/ssh.socket.d/vsock.conf << EOF
  [Socket]
  ListenStream=vsock::22
  EOF
  $ systemctl daemon-reload
  $ systemctl restart ssh.socket
  
  3. Attempt to connect from the Hyper-V host:
  
     hvc ssh user@ubuntu-vm
  
  Expected Result: Connection succeeds and SSH login is presented.
  Actual Result: The connection hangs.
  
  [Where problems could occur]
  
  The effective goals of the patch are to (a) accept when AF_VSOCK sockets
  are passed by systemd, and (b) to close() (rather than silently ignore)
  unsupported socket types.
  
  There is additional logic to properly log about where the server is
  listening. This creates additional room for error.
  
  All of the changes are contained within the setup_systemd_socket()
  function. Therefore, problems would be seen when sshd is socket-
  activated, e.g. on the first connection attempt to a given server.

-- 
You received this bug notification because you are a member of
Debcrafters packages, which is subscribed to openssh in Ubuntu.
https://bugs.launchpad.net/bugs/2111226

Title:
  sshd socket activation does not support AF_VSOCK

Status in openssh package in Ubuntu:
  Fix Released
Status in openssh source package in Jammy:
  Fix Released
Status in openssh source package in Noble:
  Triaged
Status in openssh source package in Oracular:
  Won't Fix
Status in openssh source package in Plucky:
  Triaged
Status in openssh source package in Questing:
  Fix Released

Bug description:
  [Impact]
  On Ubuntu VMs running under Microsoft Hyper-V, users commonly rely on 'hv_sock' (Hyper-V socket) to enable seamless SSH access using the 'hvc.exe' tool on the Windows host. This works correctly on Ubuntu Jammy and earlier, but fails silently in Noble, because the logic in Ubuntu's systemd-socket-activation.patch silently rejects sockets that are not AF_INET or AF_INET6.

  Hence, when an AF_VSOCK socket is passed (which is supported by
  systemd socket's ListenStream=), the client connection silently hangs.

  [Test Case]

  The autopkgtests for openssh contain socket-activation tests to help
  avoid regressions in the existing logic. In addition to those tests,
  the below manual testing will be performed to verify the AF_VSOCK fix:

  1. Launch a VM on Hyper-V, and ensure the hv_sock module is loaded:

  $ lsmod | grep hv_sock

  2. Adding the socket conf for SSH to listen on vsock:

  $ mkdir -p /etc/systemd/system/ssh.socket.d/
  $ cat > /etc/systemd/system/ssh.socket.d/vsock.conf << EOF
  [Socket]
  ListenStream=vsock::22
  EOF
  $ systemctl daemon-reload
  $ systemctl restart ssh.socket

  3. Attempt to connect from the Hyper-V host:

     hvc ssh user@ubuntu-vm

  Expected Result: Connection succeeds and SSH login is presented.
  Actual Result: The connection hangs.

  [Where problems could occur]

  The effective goals of the patch are to (a) accept when AF_VSOCK
  sockets are passed by systemd, and (b) to close() (rather than
  silently ignore) unsupported socket types.

  There is additional logic to properly log about where the server is
  listening. This creates additional room for error.

  All of the changes are contained within the setup_systemd_socket()
  function. Therefore, problems would be seen when sshd is socket-
  activated, e.g. on the first connection attempt to a given server.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/openssh/+bug/2111226/+subscriptions



References