Skip to contentSkip to conversation

Styhead: openssh-9.8p1 sshd.socket does not work with tpm-provider enabled

DISCUSSION Omri Sarig 2 participants 2 messages May 5, 2025

lore
Share & tools
lore

Omri Sarig

author
#0 lore raw

Hello,

I have a project where I have a Yocto system built over an RPi CM4. My project was originally based over the Scarthgap release, and now I'm in the process of upgrading it to the Styhead release of meta-poky.

After upgrading the relevant layers to the Styhead branch, I have problems with accessing the device over SSH with the default settings available through the recipe in meta-poky.

I've a solution, but I don't understand the problem, so I'd really appreciate some tips as to how to debug the problem further, if anyone experienced anything similar.

The Setup:

The setup I'm using is based over a raspberry-pi compute module 4, where I have TPM attached to it.

I have a tpm-provider enabled for openssl:

Quoted 16 lines
apps/openssl.cnf +0 -0
@@ -56,6 +56,7 @@ providers = provider_sect
 # List of providers to load

[provider_sect]
default = default_sect
+tpm2provider = tpm2provider_sect
# The fips section name should match the section name inside the

# included fipsmodule.cnf.
# fips = fips_sect
apps/openssl.cnf +0 -0
@@ -69,8 +70,11 @@ default = default_sect
 # OpenSSL may not work correctly which could lead to significant system
 # problems including inability to remotely access the system.

[default_sect]

apps/openssl.cnf

Quoted 6 lines
apps/openssl.cnf +4 -1
-# activate = 1
+activate = 1
 
+[tpm2provider_sect]
+activate = 1
+module = /usr/lib/ossl-modules/tpm2.so

And I'm using openssh version 9.8p1 (openssl version 3.3.1, but I don't think it is relevant), which is the enabled version from meta-poky.

The Problem:

When using the above setup, when I try to ssh into the device, the ssh process is blocked for 2 minutes, before it dies (without connection).

Workarounds:

I've found out that any of the following changes make the problem disappear:

* Downgrading openssh to version 9.7p1 (as available in commit 0c03d6aeb7 in meta-poky).
* Disabling the tpm-provider in openssl.cnf.
* Killing the sshd.socket service, and manually running /usr/sbin/sshd on the device.

The Current Solution:

I've seen there are 2 different ways to run sshd through systemd: either as a socket service, or run sshd directly.

By setting the PACKAGECONFIG of the recipe to run the sshd directly (instead of as a socket), this problem is being solved.

This results in the following addition to my machine.conf:

Quoted 4 lines

PACKAGECONFIG:remove:pn-openssh = "systemd-sshd-socket-mode" PACKAGECONFIG:append:pn-openssh = " systemd-sshd-service-mode "

As I wrote above, I have a solution that works for my system. However, as I don't understand the problem, I'm not confident that by doing the current fix I'm not creating future problems.

I couldn't find any other mention of such problems online, or any relevant mention in the release-notes for openssh-9.8, and as the problem happens only when the TPM provider is enabled, I'm not sure how many other people have encountered/are affected by it.

It can be really helpful if anyone with any relevant experience and can point me in the right direction for more debugging or relevant documentation that I can do.

Thank you!
With Kind Regards,
Omri