Skip to content

Fix x509 server handshake error handling#139

Merged
chucklever merged 2 commits intooracle:mainfrom
chucklever:server-x509-handshake-fixes
Feb 5, 2026
Merged

Fix x509 server handshake error handling#139
chucklever merged 2 commits intooracle:mainfrom
chucklever:server-x509-handshake-fixes

Conversation

@chucklever
Copy link
Copy Markdown
Member

Summary

  • Fix a session object leak when gnutls_credentials_set() or
    tlshd_gnutls_priority_set() fail during x509 server handshake
  • Send a fatal TLS alert to clients when the server is misconfigured
    (missing certificates, private keys, or trust store), so clients
    fail immediately instead of retrying until the mount times out
  • Log received TLS alerts during handshake and log error messages
    for server misconfigurations to help admins take corrective action

chucklever and others added 2 commits February 5, 2026 14:59
After gnutls_init() succeeds, the error paths for gnutls_credentials_set()
and tlshd_gnutls_priority_set() failures jump to out_free_certs without
calling gnutls_deinit(session), leaking the session object.

Introduce an out_deinit_session label so all post-init error paths
properly release the session before cleaning up certificates and
credentials.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Currently if a client attempts an x.509 handshake and the server is
misconfigured (no certificates, no private keys, etc), the server simply
closes the connection.  Prior to b010190 ("tlshd: Pass ETIMEDOUT from
gnutls to kernel"), this would result in a quick failure on the client.
Now the client keeps retrying until the mount program times out, which
takes several minutes.

A misconfigured server isn't a self-correcting problem, so send a fatal
alert to the client when this occurs so the client stops retrying
immediately.  This requires some minor refactoring of
tlshd_tls13_server_x509_handshake() so that the session is initialized
before attempting to load the certs and keys (otherwise it is not
possible to send an alert).  Also log an error message to help the
admin take corrective action.

Finally add some logging when an alert is received during the handshake.
Following suit with handshake completions, alerts will only be logged if
debug logging is enabled.

Signed-off-by: Scott Mayhew <smayhew@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
@chucklever chucklever merged commit e65f3b6 into oracle:main Feb 5, 2026
6 of 7 checks passed
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.

2 participants