X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/fb34a7cb31f66ad7311687840214a92e3737f10b..12d95aa62042377fc9f603245a17a43142972447:/src/src/tls-gnu.c diff --git a/src/src/tls-gnu.c b/src/src/tls-gnu.c index 03002c704..423c3a23d 100644 --- a/src/src/tls-gnu.c +++ b/src/src/tls-gnu.c @@ -89,6 +89,12 @@ require current GnuTLS, then we'll drop support for the ancient libraries). # endif #endif +#ifdef EXPERIMENTAL_TLS_RESUME +# if GNUTLS_VERSION_NUMBER < 0x030603 +# error GNUTLS version too early for session-resumption +# endif +#endif + #ifndef DISABLE_OCSP # include #endif @@ -209,7 +215,7 @@ don't want to repeat this. */ static gnutls_dh_params_t dh_server_params = NULL; -static int ssl_session_timeout = 3600; /* One hour */ +static int ssl_session_timeout = 7200; /* Two hours */ static const uschar * const exim_default_gnutls_priority = US"NORMAL"; @@ -1137,6 +1143,14 @@ else #endif gnutls_certificate_set_x509_trust_file(state->x509_cred, CS state->exp_tls_verify_certificates, GNUTLS_X509_FMT_PEM); + +#ifdef SUPPORT_CA_DIR + /* Mimic the behaviour with OpenSSL of not advertising a usable-cert list + when using the directory-of-certs config model. */ + + if ((statbuf.st_mode & S_IFMT) == S_IFDIR) + gnutls_certificate_send_x509_rdn_sequence(state->session, 1); +#endif } if (cert_count < 0) @@ -2451,7 +2465,9 @@ if (verify_check_given_host(CUSS &ob->tls_resumption_hosts, host) == OK) tlsp->resumption |= RESUME_CLIENT_REQUESTED; if ((dbm_file = dbfn_open(US"tls", O_RDONLY, &dbblock, FALSE, FALSE))) { - /* key for the db is the IP */ + /* Key for the db is the IP. We'd like to filter the retrieved session + for ticket advisory expiry, but 3.6.1 seems to give no access to that */ + if ((dt = dbfn_read_with_length(dbm_file, host->address, &len))) if (!(rc = gnutls_session_set_data(session, CUS dt->session, (size_t)len - sizeof(dbdata_tls_session)))) @@ -2475,7 +2491,6 @@ but this flag is not set until the second. TLS 1.3 it's the other way about. Keep both calls as the session data cannot be extracted before handshake completes. */ -#ifdef GNUTLS_SFLAGS_SESSION_TICKET if (gnutls_session_get_flags(session) & GNUTLS_SFLAGS_SESSION_TICKET) { gnutls_datum_t tkt; @@ -2510,7 +2525,6 @@ if (gnutls_session_get_flags(session) & GNUTLS_SFLAGS_SESSION_TICKET) else DEBUG(D_tls) debug_printf("extract session data: %s\n", US gnutls_strerror(rc)); } -#endif } @@ -2751,7 +2765,7 @@ if (!verify_certificate(state, errstr)) } #ifndef DISABLE_OCSP -if (require_ocsp) +if (request_ocsp) { DEBUG(D_tls) { @@ -2775,10 +2789,14 @@ if (require_ocsp) { tlsp->ocsp = OCSP_FAILED; tls_error(US"certificate status check failed", NULL, state->host, errstr); - return FALSE; + if (require_ocsp) + return FALSE; + } + else + { + DEBUG(D_tls) debug_printf("Passed OCSP checking\n"); + tlsp->ocsp = OCSP_VFIED; } - DEBUG(D_tls) debug_printf("Passed OCSP checking\n"); - tlsp->ocsp = OCSP_VFIED; } #endif