Package: ktls-utils
Version: 1.0.0-1
Severity: normal
Tags: upstream fixed-upstream


trixie ships ktls-utils 1.0.0-1. Its tlshd server PSK callback searches only 
the session keyring:


    ret = keyctl_search(KEY_SPEC_SESSION_KEYRING, 
TLS_DEFAULT_PSK_TYPE, username, 0);


config.c links .nvme into tlshd's session keyring at startup, so keys reachable 
through linked keyrings are searched together with the session keyring. If an 
older PSK with the same description remains visible through a linked keyring 
after a credential rotation, the stale key shadows the current key and the 
handshake fails even though the new key is present.


In practice the stale entry can persist: after a PSK rotation we have seen 
/proc/keys list a psk with the same description in more than one keyring under 
.nvme, and the session search returned the stale copy. Removing only the stale 
entry restored the handshake with the current key unchanged.


Reproduced on Debian 13.6 (kernel 6.12.94, ktls-utils 1.0.0-1) against a local 
NVMe/TCP TLS target:


  - old PSK A (serial 519941491) left in .nvme, new PSK B (serial 
909218960) in a keyring linked from .nvme;
  - tlshd looked up the key with keyctl_search(KEY_SPEC_SESSION_KEYRING, 
...) and got serial A;
  - openssl s_client -tls1_3 failed with "unexpected eof";
  - after removing A, the same lookup returned B and the handshake 
succeeded (TLSv1.3, CONNECTION ESTABLISHED).


An independent layout (A in one keyring, B in another, both visible through the 
linked keyring) showed the same result. In both cases the new key was present 
and readable; only the lookup returned the old one.


Upstream fixed this in 1.5.0 with commit 
3a6658e2b99d8f20eeae160da5b4136961ec4a10 ("tlshd: Link the NFS keyrings per 
handshake instead of at startup"). That commit links the keyrings per handshake 
and searches the process keyring first. 1.4.0 and 1.3.0 contain the same 
session-only lookup; Ubuntu 26.04 (1.3.0) reproduced the same failure on its 
NVMe/TCP target side:


    https://bugs.launchpad.net/ubuntu/+source/ktls-utils/+bug/2178406


Please update ktls-utils in trixie to 1.5.0, or backport the keyring lookup 
change. Note that sid/forky currently ship 1.4.0-1, which still has the 
session-only lookup; 1.5.0 is the first release with the fix.


References:


- 
https://github.com/linux-nfs/ktls-utils/commit/3a6658e2b99d8f20eeae160da5b4136961ec4a10
- https://github.com/linux-nfs/ktls-utils/releases/tag/ktls-utils-1.5.0
- https://bugs.launchpad.net/ubuntu/+source/ktls-utils/+bug/2178406


Thanks.

Reply via email to