41#define SWITCH_STATUS_LINE "HTTP/1.1 101 Switching Protocols"
42#define UPGRADE_HEADER "Upgrade: TLS/1.0, HTTP/1.1"
43#define CONNECTION_HEADER "Connection: Upgrade"
55 "upgrading connection to TLS");
69 "failed to send 101 interim response for connection "
85 "TLS upgrade handshake failed");
165 else if (!
s1 || !
s2 || (
s1->nelts !=
s2->nelts)) {
169 for (
i = 0;
i <
s1->nelts;
i++) {
185 if ((
pks1->ca_name_path !=
pks2->ca_name_path)
186 && (!
pks1->ca_name_path || !
pks2->ca_name_path
190 if ((
pks1->ca_name_file !=
pks2->ca_name_file)
191 && (!
pks1->ca_name_file || !
pks2->ca_name_file
209 if ((
a1->verify_depth !=
a2->verify_depth)
210 || (
a1->verify_mode !=
a2->verify_mode)) {
214 if ((
a1->ca_cert_path !=
a2->ca_cert_path)
215 && (!
a1->ca_cert_path || !
a2->ca_cert_path
216 ||
strcmp(
a1->ca_cert_path,
a2->ca_cert_path))) {
219 if ((
a1->ca_cert_file !=
a2->ca_cert_file)
220 && (!
a1->ca_cert_file || !
a2->ca_cert_file
221 ||
strcmp(
a1->ca_cert_file,
a2->ca_cert_file))) {
225 if ((
a1->cipher_suite !=
a2->cipher_suite)
226 && (!
a1->cipher_suite || !
a2->cipher_suite
227 ||
strcmp(
a1->cipher_suite,
a2->cipher_suite))) {
231 if ((
a1->tls13_ciphers !=
a2->tls13_ciphers)
232 && (!
a1->tls13_ciphers || !
a2->tls13_ciphers
233 ||
strcmp(
a1->tls13_ciphers,
a2->tls13_ciphers))) {
243 || (
ctx1->protocol !=
ctx2->protocol)
312 if (
sslconn->service_unavailable) {
321 if (
sslconn->non_ssl_request == NON_SSL_SET_ERROR_MSG) {
323 "Reason: You're speaking plain HTTP to an SSL-enabled "
324 "server port.<br />\n Instead use the HTTPS scheme to "
325 "access this URL, please.<br />\n");
330 sslconn->non_ssl_request = NON_SSL_OK;
370 "Hostname %s provided via SNI, but no hostname"
382 "Hostname %s provided via SNI and hostname %s provided"
383 " via HTTP have no compatible SSL setup",
399 "No hostname was provided via SNI for a name based"
402 "Reason: The client software did not provide a "
403 "hostname using Server Name Indication (SNI), "
404 "which is required to access this server.<br />\n");
416 "%s HTTPS request received for child %ld (server %s)",
499 "Re-negotiation handshake failed: "
500 "Client verification failed");
508 "Re-negotiation handshake failed: "
509 "Client certificate missing");
625 "Unable to reconfigure (per-directory) "
626 "permitted SSL ciphers");
699#ifdef SSL_OP_CIPHER_SERVER_PREFERENCE
706 "Reconfigured cipher suite will force renegotiation");
783 "Changed client verification type will force "
804 :
hssc->server->auth.verify_depth;
812 "Reduced client verification depth will "
813 "force renegotiation");
831#define MODSSL_CFG_CA_NE(f, sc1, sc2) \
832 (sc1->server->auth.f && \
833 (!sc2->server->auth.f || \
834 strNE(sc1->server->auth.f, sc2->server->auth.f)))
840 "Non-default virtual host with SSLVerify set to "
841 "'require' and VirtualHost-specific CA certificate "
842 "list is only available to clients with TLS server "
843 "name indication (SNI) support");
851 sslconn->verify_info =
"GENEROUS";
861 "could not buffer message body to allow "
862 "SSL renegotiation to proceed");
883 "Requesting connection re-negotiation");
891 "Performing quick renegotiation: "
892 "just re-verifying the peer");
901 "Cannot find peer certificate chain");
919 "Cannot find certificate storage");
942 "Re-negotiation verification step failed");
971 "insecure SSL re-negotiation required, but "
972 "a pipelined request is present; keepalive "
977#if defined(SSL_get_secure_renegotiation_support)
979 "client does" :
"client does not";
985 "Performing full renegotiation: complete handshake "
986 "protocol (%s support secure renegotiation)",
990 (
unsigned char *)&
id,
1002 "Re-negotiation request failed");
1010 "Awaiting re-negotiation handshake");
1026 "Re-negotiation handshake failed");
1053 "SSL cipher suite not renegotiated: "
1054 "access to %s denied using cipher %s",
1069#if SSL_HAVE_PROTOCOL_TLSV1_3
1137 : sc->
server->auth.verify_depth;
1141 "Reduced client verification depth will "
1142 "force renegotiation");
1163 "could not buffer message body to allow "
1164 "TLS Post-Handshake Authentication to proceed");
1169 "verify client post handshake");
1175 "cannot perform post-handshake authentication");
1178 "Reason: Cannot perform Post-Handshake Authentication.<br />");
1250 "access to %s failed, reason: %s",
1251 r->
filename,
"SSL connection required");
1268#if SSL_HAVE_PROTOCOL_TLSV1_3
1298 "Failed to set r->user to '%s'", dc->
szUserName);
1307 for (
i = 0;
i <
requires->nelts;
i++) {
1314 "access to %s failed, reason: Failed to execute "
1315 "SSL requirement expression: %s",
1326 "Access to %s denied for %s "
1327 "(requirement expression not fulfilled)",
1331 "Failed expression: %s", req->
cpExpr);
1334 "access to %s failed, reason: %s",
1336 "SSL requirement expression not fulfilled");
1407 "Encountered FakeBasicAuth spoof: %s",
username);
1450 ":password",
NULL)),
1455 "Faking HTTP Basic Auth header: \"Authorization: %s\"",
1484 "SSL_VERSION_INTERFACE",
1485 "SSL_VERSION_LIBRARY",
1488 "SSL_COMPRESS_METHOD",
1490 "SSL_CIPHER_EXPORT",
1491 "SSL_CIPHER_USEKEYSIZE",
1492 "SSL_CIPHER_ALGKEYSIZE",
1493 "SSL_CLIENT_VERIFY",
1494 "SSL_CLIENT_M_VERSION",
1495 "SSL_CLIENT_M_SERIAL",
1496 "SSL_CLIENT_V_START",
1498 "SSL_CLIENT_V_REMAIN",
1503 "SSL_CLIENT_CERT_RFC4523_CEA",
1504 "SSL_SERVER_M_VERSION",
1505 "SSL_SERVER_M_SERIAL",
1506 "SSL_SERVER_V_START",
1513 "SSL_SESSION_RESUMED",
1571 r,
"SSL_SERVER_CERT");
1576 r,
"SSL_CLIENT_CERT");
1593#ifdef SSL_get_secure_renegotiation_support
1619 const void **parsed)
1622 return "'Require ssl' does not take arguments";
1663 const void **parsed)
1666 return "'Require ssl-verify-client' does not take arguments";
1685#if MODSSL_USE_OPENSSL_PRE_1_1_API
1695#ifdef SSL_CERT_SET_SERVER
1704#if OPENSSL_VERSION_NUMBER < 0x10100000L
1727 "handing out built-in DH parameters for %d-bit authenticated connection",
keylen);
1763 "Certificate Verification, depth %d, "
1764 "CRL checking mode: %s (%x)",
errdepth,
1767 mctx->crl_check_mask);
1797 "Certificate Verification: Verifiable Issuer is "
1798 "configured as optional, therefore we're accepting "
1801 sslconn->verify_info =
"GENEROUS";
1824 "Certificate Verification: Temporary error (%d): %s: "
1825 "optional therefore we're accepting the certificate",
1832#ifndef OPENSSL_NO_OCSP
1845 "cannot perform OCSP validation for cert "
1846 "if issuer has not been verified "
1847 "(optional_no_ca configured)");
1865 "Certificate Verification: Error (%d): %s",
1869 "Certificate Verification: Error (%d): %s",
1892 if (!dc || (depth ==
UNSET)) {
1893 depth =
mctx->auth.verify_depth;
1898 "Certificate Verification: Certificate Chain too long "
1899 "(chain has %d certificates, but maximum allowed are "
1915#define SSLPROXY_CERT_CB_LOG_FMT \
1916 "Proxy client certificate callback: (%s) "
1932#if MODSSL_USE_OPENSSL_PRE_1_1_API
1933#define modssl_set_cert_info(info, cert, pkey) \
1934 *cert = info->x509; \
1935 CRYPTO_add(&(*cert)->references, +1, CRYPTO_LOCK_X509); \
1936 *pkey = info->x_pkey->dec_pkey; \
1937 CRYPTO_add(&(*pkey)->references, +1, CRYPTO_LOCK_EVP_PKEY)
1939#define modssl_set_cert_info(info, cert, pkey) \
1940 *cert = info->x509; \
1941 X509_up_ref(*cert); \
1942 *pkey = info->x_pkey->dec_pkey; \
1943 EVP_PKEY_up_ref(*pkey);
1969 "downstream server wanted client certificate "
1970 "but none are configured", sc->
vhost_id);
2001 "found acceptable cert");
2020 "found acceptable cert by intermediate CA");
2033 "no client certificate found!?", sc->
vhost_id);
2039 const char *request,
2059 "Inter-Process Session Cache: "
2060 "request=%s status=%s id=%s %s(session %s)",
2093#ifdef OPENSSL_NO_SSL_INTERN
2096 id = session->session_id;
2097 idlen = session->session_id_length;
2103 session, conn->
pool);
2106 rc ==
TRUE ?
"OK" :
"BAD",
2138 session ?
"FOUND" :
"MISSED",
2139 session ?
"reuse" :
"renewal", 0);
2178#ifdef OPENSSL_NO_SSL_INTERN
2181 id = session->session_id;
2182 idlen = session->session_id_length;
2227 "%s: Alert: %s:%s:%s",
2235 "%s: Exit: failed in %s",
2240 "%s: Exit: error in %s",
2252 "Protocol: %s, Cipher: %s (%s/%s bits)",
2276#ifndef SSL_OP_NO_RENEGOTIATION
2297 "rejecting client initiated renegotiation");
2318 const char *cert_pem,
const char *
key_pem)
2324 sslcon->service_unavailable = 1;
2333 "Failed to parse PEM of challenge certificate %s",
2341 "Failed to configure challenge certificate %s",
2349 "error '%s' using Challenge key: %s",
2358 "Challenge certificate and private key %s "
2379 if (
sslcon->vhost_found) {
2383 sslcon->vhost_found = -1;
2392 "SSL virtual host for servername %s found",
2395 sslcon->vhost_found = +1;
2400 "No matching SSL virtual host for servername "
2401 "%s found (using default/first virtual host)",
2422 "Server name not provided via TLS extension "
2423 "(using default/first virtual host)");
2442#if OPENSSL_VERSION_NUMBER >= 0x10101000L && !defined(LIBRESSL_VERSION_NUMBER)
2450 const unsigned char *pos;
2451 size_t len, remaining;
2471 len = (*(pos++) << 8);
2473 if (
len + 2 != remaining)
2486 len = (*(pos++) << 8);
2488 if (
len + 2 != remaining)
2528#if OPENSSL_VERSION_NUMBER >= 0x1010007fL \
2529 && (!defined(LIBRESSL_VERSION_NUMBER) \
2530 || LIBRESSL_VERSION_NUMBER >= 0x20800000L)
2597#ifdef HAVE_TLS_SESSION_TICKETS
2638#if OPENSSL_VERSION_NUMBER < 0x30000000L
2646 "TLS session ticket key for %s successfully set, "
2647 "creating new session ticket", sc->
vhost_id);
2651 else if (
mode == 0) {
2665#if OPENSSL_VERSION_NUMBER < 0x30000000L
2673 "TLS session ticket key for %s successfully set, "
2674 "decrypting existing session ticket", sc->
vhost_id);
2699 const unsigned char **
out,
unsigned char *
outlen,
2700 const unsigned char *
in,
unsigned int inlen,
2720 "ALPN client protocol list empty");
2730 "ALPN protocol identifier too long");
2753 "ALPN negotiated protocol name too long");
2765 APLOGNO(02908)
"protocol switch to '%s' failed",
2779 const char *cert_pem, *
key_pem;
2814#if OPENSSL_VERSION_NUMBER >= 0x10100000L
2822#if OPENSSL_VERSION_NUMBER >= 0x10100000L
2832#ifdef HAVE_OPENSSL_KEYLOG
2839 if (sc && sc->
mc->keylog_file) {
const char apr_size_t len
#define ap_fputs(f, bb, str)
apr_status_t ap_pass_brigade(ap_filter_t *filter, apr_bucket_brigade *bucket)
apr_status_t ap_get_brigade(ap_filter_t *filter, apr_bucket_brigade *bucket, ap_input_mode_t mode, apr_read_type_e block, apr_off_t readbytes)
const unsigned char * buf
apr_status_t ap_switch_protocol(conn_rec *c, request_rec *r, server_rec *s, const char *protocol)
const char * ap_get_protocol(conn_rec *c)
const char * ap_select_protocol(conn_rec *c, request_rec *r, server_rec *s, const apr_array_header_t *choices)
int ap_is_initial_req(request_rec *r)
#define APR_MD5_DIGESTSIZE
#define APR_BRIGADE_INSERT_TAIL(b, e)
apr_brigade_flush void * ctx
apr_dbd_transaction_t int mode
apr_memcache_server_t * server
int ap_expr_exec(request_rec *r, const ap_expr_info_t *expr, const char **err)
#define HTTP_SERVICE_UNAVAILABLE
#define HTTP_UPGRADE_REQUIRED
#define HTTP_REQUEST_ENTITY_TOO_LARGE
#define HTTP_MISDIRECTED_REQUEST
const authz_provider ssl_authz_provider_require_ssl
#define DEFAULT_RENEG_BUFFER_SIZE
int ssl_callback_NewSessionCacheEntry(SSL *ssl, SSL_SESSION *session)
DH * modssl_get_dh_params(unsigned keylen)
int modssl_request_is_tls(const request_rec *r, SSLConnRec **sslconn)
#define SSL_OPT_OPTRENEGOTIATE
#define mySrvConfigFromConn(c)
int ssl_hook_Fixup(request_rec *r)
#define SSL_VERIFY_PEER_STRICT
int ssl_hook_Auth(request_rec *r)
#define SSL_OPT_STRICTREQUIRE
void modssl_set_io_callbacks(SSL *ssl, conn_rec *c, server_rec *s)
int ssl_init_ssl_connection(conn_rec *c, request_rec *r)
#define ssl_verify_error_is_optional(errnum)
#define myDirConfigFromConn(c)
char * ssl_util_vhostid(apr_pool_t *, server_rec *)
unsigned int ssl_util_vhost_matches(const char *servername, server_rec *s)
int modssl_verify_ocsp(X509_STORE_CTX *ctx, SSLSrvConfigRec *sc, server_rec *s, conn_rec *c, apr_pool_t *pool)
DH * ssl_callback_TmpDH(SSL *ssl, int export, int keylen)
void modssl_set_reneg_state(SSLConnRec *sslconn, modssl_reneg_state state)
char * ssl_var_lookup(apr_pool_t *p, server_rec *s, conn_rec *c, request_rec *r, char *var)
void ssl_scache_remove(server_rec *, unsigned char *, int, apr_pool_t *)
SSL_SESSION * ssl_scache_retrieve(server_rec *, unsigned char *, int, apr_pool_t *)
void ssl_log_ssl_error(const char *file, int line, int level, server_rec *s)
int ssl_is_challenge(conn_rec *c, const char *servername, X509 **pcert, EVP_PKEY **pkey, const char **pcert_pem, const char **pkey_pem)
void ssl_callback_Info(const SSL *ssl, int where, int rc)
#define myConnCtxConfig(c, sc)
unsigned int ssl_scache_store(server_rec *, unsigned char *, int, apr_time_t, SSL_SESSION *, apr_pool_t *)
int ssl_hook_ReadReq(request_rec *r)
void ssl_callback_DelSessionCacheEntry(SSL_CTX *ctx, SSL_SESSION *session)
#define SSL_OPT_STDENVVARS
#define SSL_OPT_EXPORTCERTDATA
const authz_provider ssl_authz_provider_verify_client
int ssl_hook_UserCheck(request_rec *r)
int ssl_hook_Access(request_rec *r)
void modssl_var_extract_dns(apr_table_t *t, SSL *ssl, apr_pool_t *p)
SSL_SESSION * ssl_callback_GetSessionCacheEntry(SSL *ssl, unsigned char *id, int idlen, int *do_copy)
int ssl_io_buffer_fill(request_rec *r, apr_size_t maxlen)
int ssl_callback_proxy_cert(SSL *ssl, X509 **x509, EVP_PKEY **pkey)
#define SSL_OPT_FAKEBASICAUTH
void modssl_var_extract_san_entries(apr_table_t *t, SSL *ssl, apr_pool_t *p)
int ssl_callback_SSLVerify(int ok, X509_STORE_CTX *ctx)
@ SSL_CVERIFY_OPTIONAL_NO_CA
@ SSL_CRLCHECK_NO_CRL_FOR_CERT_OK
@ SSL_SHUTDOWN_TYPE_STANDARD
@ SSL_SHUTDOWN_TYPE_UNCLEAN
@ SSL_SHUTDOWN_TYPE_ACCURATE
@ SSL_SHUTDOWN_TYPE_UNSET
apr_status_t modssl_read_cert(apr_pool_t *p, const char *cert_pem, const char *key_pem, pem_password_cb *cb, void *ud, X509 **pcert, EVP_PKEY **pkey)
#define MODSSL_SESSION_ID_STRING_LEN
#define MODSSL_LIBRARY_NAME
void modssl_set_app_data2(SSL *ssl, void *arg)
void * modssl_get_app_data2(SSL *ssl)
char * ap_pbase64encode(apr_pool_t *p, char *string)
char * ap_getword(apr_pool_t *p, const char **line, char stop)
int ap_request_has_body(request_rec *r)
char * ap_pbase64decode(apr_pool_t *p, const char *bufcoded)
int ap_find_token(apr_pool_t *p, const char *line, const char *tok)
char * ap_getword_nulls(apr_pool_t *p, const char **line, char stop)
int ap_array_str_contains(const apr_array_header_t *array, const char *s)
void const char apr_status_t(* cleanup)(void *))
apr_array_header_t ** result
apr_vformatter_buff_t * c
char const *const char const *const ** env
const char apr_uint32_t * id
#define APR_ARRAY_PUSH(ary, type)
const apr_array_header_t * arr
#define APR_ARRAY_IDX(ary, i, type)
const char const char * password
#define apr_time_from_sec(sec)
SSL extension module for Apache.
Apache scoreboard library.
int ap_update_child_status_from_server(ap_sb_handle_t *sbh, int status, conn_rec *c, server_rec *s)
#define modssl_set_cert_info(info, cert, pkey)
#define MODSSL_CFG_CA_NE(f, sc1, sc2)
static apr_status_t upgrade_connection(request_rec *r)
static authz_status ssl_authz_verify_client_check(request_rec *r, const char *require_line, const void *parsed)
static void log_tracing_state(const SSL *ssl, conn_rec *c, server_rec *s, int where, int rc)
static int ssl_check_post_client_verify(request_rec *r, SSLSrvConfigRec *sc, SSLDirConfigRec *dc, SSLConnRec *sslconn, SSL *ssl)
static void ssl_configure_env(request_rec *r, SSLConnRec *sslconn)
#define SSLPROXY_CERT_CB_LOG_FMT
static int has_buffered_data(request_rec *r)
#define SWITCH_STATUS_LINE
static const char *const ssl_hook_Fixup_vars[]
static void ssl_session_log(server_rec *s, const char *request, unsigned char *id, unsigned int idlen, const char *status, const char *result, long timeout)
#define CONNECTION_HEADER
static const char * ssl_authz_require_ssl_parse(cmd_parms *cmd, const char *require_line, const void **parsed)
static authz_status ssl_authz_require_ssl_check(request_rec *r, const char *require_line, const void *parsed)
static int ssl_hook_Access_classic(request_rec *r, SSLSrvConfigRec *sc, SSLDirConfigRec *dc, SSLConnRec *sslconn, SSL *ssl)
static void modssl_proxy_info_log(conn_rec *c, X509_INFO *info, const char *msg)
static int fill_reneg_buffer(request_rec *r, SSLDirConfigRec *dc)
static const char * ssl_authz_verify_client_parse(cmd_parms *cmd, const char *require_line, const void **parsed)
void ssl_log_cxerror(const char *file, int line, int level, apr_status_t rv, conn_rec *c, X509 *cert, const char *fmt,...)
Internal interfaces private to mod_ssl.
char * modssl_SSL_SESSION_id2sz(unsigned char *id, int idlen, char *str, int strsize)
modssl_reneg_state reneg_state
unsigned int bSSLRequired
ssl_verify_t nVerifyClient
const char * szCipherSuite
apr_size_t nRenegBufferSize
apr_array_header_t * aRequirement
unsigned int cipher_server_pref
int session_cache_timeout
Structure to store things which are per connection.
ap_conn_keepalive_e keepalive
struct ap_filter_t * input_filters
struct ap_filter_t * output_filters
struct apr_bucket_alloc_t * bucket_alloc
const char * cipher_suite
A structure that represents the current request.
apr_table_t * err_headers_out
apr_table_t * subprocess_env
apr_table_t * headers_out
A structure to keep track of authorization requirements.
A structure to store information for each virtual server.
static apr_array_header_t * a1
char * ap_md5_binary(apr_pool_t *p, const unsigned char *buf, int length)
int ap_vhost_iterate_given_conn(conn_rec *conn, ap_vhost_iterate_conn_cb func_cb, void *baton)
static size_t keylen(KEY s)