The ssl_c_err, ssl_c_ca_err and ssl_c_ca_err_depth sample fetches read
the verify errors that ssl_sock_bind_verifycbk() stores in the
connection's xprt_st. This callback is only called during a full
handshake: on a resumed session (TLS ticket, session ID or TLS 1.3 PSK),
xprt_st is reset and the callback does not run, so the three fetches
return 0 (X509_V_OK) even when the session was established with a client
certificate whose verification failed, whether the error was ignored by
"ca-ignore-err" or "crt-ignore-err" or not. ssl_c_verify is not affected
because it reads the verify result stored in the session.
A user may mistakenly rely on these fetches for access control on resumed
sessions, for example after ignoring verification errors with
"ca-ignore-err" or "crt-ignore-err". Such a configuration can reject an
expired, revoked or self-signed client certificate on the first
connection, then accept the same client when it resumes the session.
Fix this by clearing the session id context when the verification fails,
whether the error is ignored or not, so that a session established with
a failed verification cannot be resumed: the next connection performs a
full handshake and the verify callback fills xprt_st again.
Sessions whose verification succeeded keep resuming as before.
This should be backported to all stable branches after an observation period.
Reported-by: Justin Sun <justin@capy.ai>
If set to 'all', all errors are ignored. SSL handshake is not aborted if an
error is ignored.
If set to 'all', all errors are ignored. SSL handshake is not aborted if an
error is ignored.
+ A session established with an ignored verification error cannot be resumed.
+
ca-sign-file <cafile>
This setting is only available when support for OpenSSL was built in. It
designates a PEM file containing both the CA certificate and the CA private
ca-sign-file <cafile>
This setting is only available when support for OpenSSL was built in. It
designates a PEM file containing both the CA certificate and the CA private
If set to 'all', all errors are ignored. SSL handshake is not aborted if an
error is ignored.
If set to 'all', all errors are ignored. SSL handshake is not aborted if an
error is ignored.
+ A session established with an ignored verification error cannot be resumed.
+
crt-list <file>
This setting is only available when support for OpenSSL was built in. It
designates a list of PEM file with an optional ssl configuration and a SNI
crt-list <file>
This setting is only available when support for OpenSSL was built in. It
designates a list of PEM file with an optional ssl configuration and a SNI
is aborted, regardless of the 'verify' option, unless the error code exactly
matches one of those listed with 'ca-ignore-err' or 'crt-ignore-err'.
is aborted, regardless of the 'verify' option, unless the error code exactly
matches one of those listed with 'ca-ignore-err' or 'crt-ignore-err'.
+ A session whose client certificate verification failed cannot be resumed,
+ even if the error was ignored with 'ca-ignore-err' or 'crt-ignore-err'.
+ Sessions without verification errors remain resumable.
+
5.2. Server and default-server options
------------------------------------
5.2. Server and default-server options
------------------------------------
+ /* The verification failed: don't let this session be resumed. The
+ * verify callback doesn't run on a resumed session, so ssl_c_err,
+ * ssl_c_ca_err and ssl_c_ca_err_depth would read X509_V_OK. The
+ * "ca-ignore-err" and "crt-ignore-err" keywords don't change this,
+ * an ignored error also prevents the session from being resumed.
+ * Not applied to wolfSSL, which ignores the session id context.
+ */
+ {
+ SSL_SESSION *sess = SSL_get_session(ssl);
+
+ if (sess)
+ SSL_SESSION_set1_id_context(sess, (const unsigned char *)"", 0);
+ }
+
/* Keep a reference to the client's certificate in order to be able to
* dump some fetches values in a log even when the verification process
* fails. */
/* Keep a reference to the client's certificate in order to be able to
* dump some fetches values in a log even when the verification process
* fails. */