Changeset cb6476c in mod_gnutls


Ignore:
Timestamp:
Sep 26, 2018, 2:29:35 AM (5 years ago)
Author:
Fiona Klute <fiona.klute@…>
Branches:
asyncio, debian/master, main, master, proxy-ticket
Children:
adceac0
Parents:
efc43b4
Message:

Enable OCSP stapling by default if possible

If the user hasn't explicitly disabled OCSP stapling try to enable it,
and disable if that fails.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/gnutls_hooks.c

    refc43b4 rcb6476c  
    658658        if (sc->client_verify_method == mgs_cvm_unset)
    659659            sc->client_verify_method = mgs_cvm_cartel;
    660         if (sc->ocsp_staple == GNUTLS_ENABLED_UNSET)
    661             // TODO: Check result of mgs_ocsp_configure_stapling()
    662             // below instead, staple if possible.
    663             sc->ocsp_staple = GNUTLS_ENABLED_FALSE;
     660
     661        // TODO: None of the stuff below (and neither some above)
     662        // makes sense if sc->enabled == GNUTLS_ENABLED_FALSE, we
     663        // should just continue to the next host. All code below could
     664        // then safely assume sc->enabled == GNUTLS_ENABLED_TRUE.
    664665
    665666        sc->ocsp_mutex = sc_base->ocsp_mutex;
    666         /* init OCSP configuration if OCSP is enabled for this host */
    667         if (sc->enabled && sc->ocsp_staple)
     667        /* init OCSP configuration unless explicitly disabled */
     668        if (sc->enabled && sc->ocsp_staple != GNUTLS_ENABLED_FALSE)
    668669        {
    669670            const char *err = mgs_ocsp_configure_stapling(pconf, ptemp, s);
    670671            if (err != NULL)
    671672            {
    672                 ap_log_error(APLOG_MARK, APLOG_STARTUP, APR_EINVAL, s,
    673                              "OCSP stapling configuration failed for "
    674                              "host '%s:%d': %s",
    675                              s->server_hostname, s->addrs->host_port, err);
    676                 return HTTP_INTERNAL_SERVER_ERROR;
     673                /* If OCSP stapling is enabled only by default ignore
     674                 * error and disable stapling */
     675                if (sc->ocsp_staple == GNUTLS_ENABLED_UNSET)
     676                {
     677                    ap_log_error(APLOG_MARK, APLOG_INFO, APR_SUCCESS, s,
     678                                 "Cannnot enable OCSP stapling for "
     679                                 "host '%s:%d': %s",
     680                                 s->server_hostname, s->addrs->host_port, err);
     681                    sc->ocsp_staple = GNUTLS_ENABLED_FALSE;
     682                }
     683                /* If OCSP stapling is explicitly enabled this is a
     684                 * critical error. */
     685                else
     686                {
     687                    ap_log_error(APLOG_MARK, APLOG_STARTUP, APR_EINVAL, s,
     688                                 "OCSP stapling configuration failed for "
     689                                 "host '%s:%d': %s",
     690                                 s->server_hostname, s->addrs->host_port, err);
     691                    return HTTP_INTERNAL_SERVER_ERROR;
     692                }
    677693            }
    678             rv = mgs_ocsp_enable_stapling(pconf, ptemp, s);
    679             if (rv != OK && rv != DECLINED)
    680                 return rv;
     694            else
     695            {
     696                /* Might already be set */
     697                sc->ocsp_staple = GNUTLS_ENABLED_TRUE;
     698                /* Set up stapling */
     699                rv = mgs_ocsp_enable_stapling(pconf, ptemp, s);
     700                if (rv != OK && rv != DECLINED)
     701                    return rv;
     702            }
    681703        }
    682704
  • test/tests/27_OCSP_server/apache.conf

    refc43b4 rcb6476c  
    99        ServerName              ${TEST_HOST}
    1010        GnuTLSEnable            On
    11         GnuTLSOCSPStapling      On
     11        # Enabled by default
     12        #GnuTLSOCSPStapling     On
    1213        GnuTLSOCSPCacheTimeout  60
    1314        GnuTLSCertificateFile   server/x509-chain.pem
Note: See TracChangeset for help on using the changeset viewer.