Apache2
ssl_private.h
Go to the documentation of this file.
1 /* Licensed to the Apache Software Foundation (ASF) under one or more
2  * contributor license agreements. See the NOTICE file distributed with
3  * this work for additional information regarding copyright ownership.
4  * The ASF licenses this file to You under the Apache License, Version 2.0
5  * (the "License"); you may not use this file except in compliance with
6  * the License. You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef SSL_PRIVATE_H
18 #define SSL_PRIVATE_H
19 
30 #include "ap_config.h"
31 #include "httpd.h"
32 #include "http_config.h"
33 #include "http_core.h"
34 #include "http_log.h"
35 #include "http_main.h"
36 #include "http_connection.h"
37 #include "http_request.h"
38 #include "http_protocol.h"
39 #include "http_ssl.h"
40 #include "http_vhost.h"
41 #include "util_script.h"
42 #include "util_filter.h"
43 #include "util_ebcdic.h"
44 #include "util_mutex.h"
45 #include "apr.h"
46 #include "apr_strings.h"
47 #define APR_WANT_STRFUNC
48 #define APR_WANT_MEMFUNC
49 #include "apr_want.h"
50 #include "apr_tables.h"
51 #include "apr_lib.h"
52 #include "apr_fnmatch.h"
53 #include "apr_strings.h"
54 #include "apr_global_mutex.h"
55 #include "apr_optional.h"
56 #include "ap_socache.h"
57 #include "mod_auth.h"
58 
59 /* The #ifdef macros are only defined AFTER including the above
60  * therefore we cannot include these system files at the top :-(
61  */
62 #if APR_HAVE_STDLIB_H
63 #include <stdlib.h>
64 #endif
65 #if APR_HAVE_SYS_TIME_H
66 #include <sys/time.h>
67 #endif
68 #if APR_HAVE_UNISTD_H
69 #include <unistd.h> /* needed for STDIN_FILENO et.al., at least on FreeBSD */
70 #endif
71 
72 #ifndef FALSE
73 #define FALSE 0
74 #endif
75 
76 #ifndef TRUE
77 #define TRUE !FALSE
78 #endif
79 
80 #ifndef BOOL
81 #define BOOL unsigned int
82 #endif
83 
84 #include "ap_expr.h"
85 
86 /* keep first for compat API */
87 #ifndef OPENSSL_API_COMPAT
88 #define OPENSSL_API_COMPAT 0x10101000 /* for ENGINE_ API */
89 #endif
90 #include "mod_ssl_openssl.h"
91 
92 /* OpenSSL headers */
93 #include <openssl/err.h>
94 #include <openssl/x509.h>
95 #include <openssl/pem.h>
96 #include <openssl/crypto.h>
97 #include <openssl/evp.h>
98 #include <openssl/rand.h>
99 #include <openssl/x509v3.h>
100 #include <openssl/x509_vfy.h>
101 #include <openssl/ocsp.h>
102 #include <openssl/dh.h>
103 #if OPENSSL_VERSION_NUMBER >= 0x30000000
104 #include <openssl/core_names.h>
105 #endif
106 
107 /* Avoid tripping over an engine build installed globally and detected
108  * when the user points at an explicit non-engine flavor of OpenSSL
109  */
110 #if defined(HAVE_OPENSSL_ENGINE_H) && defined(HAVE_ENGINE_INIT) \
111  && (OPENSSL_VERSION_NUMBER < 0x30000000 \
112  || (defined(OPENSSL_API_LEVEL) && OPENSSL_API_LEVEL < 30000)) \
113  && !defined(OPENSSL_NO_ENGINE)
114 #include <openssl/engine.h>
115 #define MODSSL_HAVE_ENGINE_API 1
116 #endif
117 #ifndef MODSSL_HAVE_ENGINE_API
118 #define MODSSL_HAVE_ENGINE_API 0
119 #endif
120 
121 /* Use OpenSSL 3.x STORE for loading URI keys and certificates starting with
122  * OpenSSL 3.0
123  */
124 #if OPENSSL_VERSION_NUMBER >= 0x30000000
125 #define MODSSL_HAVE_OPENSSL_STORE 1
126 #else
127 #define MODSSL_HAVE_OPENSSL_STORE 0
128 #endif
129 
130 #if (OPENSSL_VERSION_NUMBER < 0x0090801f)
131 #error mod_ssl requires OpenSSL 0.9.8a or later
132 #endif
133 
140 #if (OPENSSL_VERSION_NUMBER >= 0x10000000)
141 #define MODSSL_SSL_CIPHER_CONST const
142 #define MODSSL_SSL_METHOD_CONST const
143 #else
144 #define MODSSL_SSL_CIPHER_CONST
145 #define MODSSL_SSL_METHOD_CONST
146 #endif
147 
148 #if defined(LIBRESSL_VERSION_NUMBER)
149 /* Missing from LibreSSL */
150 #if LIBRESSL_VERSION_NUMBER < 0x2060000f
151 #define SSL_CTRL_SET_MIN_PROTO_VERSION 123
152 #define SSL_CTRL_SET_MAX_PROTO_VERSION 124
153 #define SSL_CTX_set_min_proto_version(ctx, version) \
154  SSL_CTX_ctrl(ctx, SSL_CTRL_SET_MIN_PROTO_VERSION, version, NULL)
155 #define SSL_CTX_set_max_proto_version(ctx, version) \
156  SSL_CTX_ctrl(ctx, SSL_CTRL_SET_MAX_PROTO_VERSION, version, NULL)
157 #endif /* LIBRESSL_VERSION_NUMBER < 0x2060000f */
158 /* LibreSSL before 2.7 declares OPENSSL_VERSION_NUMBER == 2.0 but does not
159  * include most changes from OpenSSL >= 1.1 (new functions, macros,
160  * deprecations, ...), so we have to work around this...
161  */
162 #if LIBRESSL_VERSION_NUMBER < 0x2070000f
163 #define MODSSL_USE_OPENSSL_PRE_1_1_API 1
164 #else
165 #define MODSSL_USE_OPENSSL_PRE_1_1_API 0
166 #endif
167 #else /* defined(LIBRESSL_VERSION_NUMBER) */
168 #if OPENSSL_VERSION_NUMBER < 0x10100000L
169 #define MODSSL_USE_OPENSSL_PRE_1_1_API 1
170 #else
171 #define MODSSL_USE_OPENSSL_PRE_1_1_API 0
172 #endif
173 #endif /* defined(LIBRESSL_VERSION_NUMBER) */
174 
175 #if OPENSSL_VERSION_NUMBER < 0x10101000
176 #define MODSSL_USE_SSLRAND
177 #endif
178 
179 #if defined(OPENSSL_FIPS) || OPENSSL_VERSION_NUMBER >= 0x30000000L
180 #define HAVE_FIPS
181 #endif
182 
183 #if defined(SSL_OP_NO_TLSv1_2)
184 #define HAVE_TLSV1_X
185 #endif
186 
187 #if defined(SSL_CONF_FLAG_FILE)
188 #define HAVE_SSL_CONF_CMD
189 #endif
190 
191 /* session id constness */
192 #if MODSSL_USE_OPENSSL_PRE_1_1_API
193 #define IDCONST
194 #else
195 #define IDCONST const
196 #endif
197 
202 #if !defined(OPENSSL_NO_TLSEXT) && defined(SSL_set_tlsext_host_name)
203 
204 #define HAVE_TLSEXT
205 
206 /* ECC: make sure we have at least 1.0.0 */
207 #if !defined(OPENSSL_NO_EC) && defined(TLSEXT_ECPOINTFORMAT_uncompressed)
208 #define HAVE_ECC
209 #endif
210 
211 /* OCSP stapling */
212 #if !defined(OPENSSL_NO_OCSP) && defined(SSL_CTX_set_tlsext_status_cb)
213 #define HAVE_OCSP_STAPLING
214 /* All exist but are no longer macros since OpenSSL 1.1.0 */
215 #if OPENSSL_VERSION_NUMBER < 0x10100000L
216 /* backward compatibility with OpenSSL < 1.0 */
217 #ifndef sk_OPENSSL_STRING_num
218 #define sk_OPENSSL_STRING_num sk_num
219 #endif
220 #ifndef sk_OPENSSL_STRING_value
221 #define sk_OPENSSL_STRING_value sk_value
222 #endif
223 #ifndef sk_OPENSSL_STRING_pop
224 #define sk_OPENSSL_STRING_pop sk_pop
225 #endif
226 #endif /* if OPENSSL_VERSION_NUMBER < 0x10100000L */
227 #endif /* if !defined(OPENSSL_NO_OCSP) && defined(SSL_CTX_set_tlsext_status_cb) */
228 
229 /* TLS session tickets */
230 #if defined(SSL_CTX_set_tlsext_ticket_key_cb)
231 #define HAVE_TLS_SESSION_TICKETS
232 #define TLSEXT_TICKET_KEY_LEN 48
233 #ifndef tlsext_tick_md
234 #ifdef OPENSSL_NO_SHA256
235 #define tlsext_tick_md EVP_sha1
236 #else
237 #define tlsext_tick_md EVP_sha256
238 #endif
239 #endif
240 #endif
241 
242 /* Secure Remote Password */
243 #if !defined(OPENSSL_NO_SRP) \
244  && (OPENSSL_VERSION_NUMBER < 0x30000000L \
245  || (defined(OPENSSL_API_LEVEL) && OPENSSL_API_LEVEL < 30000)) \
246  && defined(SSL_CTRL_SET_TLS_EXT_SRP_USERNAME_CB)
247 #define HAVE_SRP
248 #include <openssl/srp.h>
249 #endif
250 
251 /* ALPN Protocol Negotiation */
252 #if defined(TLSEXT_TYPE_application_layer_protocol_negotiation)
253 #define HAVE_TLS_ALPN
254 #endif
255 
256 #endif /* !defined(OPENSSL_NO_TLSEXT) && defined(SSL_set_tlsext_host_name) */
257 
258 #if MODSSL_USE_OPENSSL_PRE_1_1_API
259 #define BN_get_rfc2409_prime_768 get_rfc2409_prime_768
260 #define BN_get_rfc2409_prime_1024 get_rfc2409_prime_1024
261 #define BN_get_rfc3526_prime_1536 get_rfc3526_prime_1536
262 #define BN_get_rfc3526_prime_2048 get_rfc3526_prime_2048
263 #define BN_get_rfc3526_prime_3072 get_rfc3526_prime_3072
264 #define BN_get_rfc3526_prime_4096 get_rfc3526_prime_4096
265 #define BN_get_rfc3526_prime_6144 get_rfc3526_prime_6144
266 #define BN_get_rfc3526_prime_8192 get_rfc3526_prime_8192
267 #define BIO_set_init(x,v) (x->init=v)
268 #define BIO_get_data(x) (x->ptr)
269 #define BIO_set_data(x,v) (x->ptr=v)
270 #define BIO_get_shutdown(x) (x->shutdown)
271 #define BIO_set_shutdown(x,v) (x->shutdown=v)
272 #define DH_bits(x) (BN_num_bits(x->p))
273 #define X509_up_ref(x) (CRYPTO_add(&(x)->references, +1, CRYPTO_LOCK_X509))
274 #define EVP_PKEY_up_ref(pk) (CRYPTO_add(&(pk)->references, +1, CRYPTO_LOCK_EVP_PKEY))
275 #else
276 void init_bio_methods(void);
277 void free_bio_methods(void);
278 #endif
279 
280 #if OPENSSL_VERSION_NUMBER < 0x10002000L || \
281  (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x2070000f)
282 #define X509_STORE_CTX_get0_store(x) (x->ctx)
283 #endif
284 
285 #if OPENSSL_VERSION_NUMBER < 0x10000000L
286 #ifndef X509_STORE_CTX_get0_current_issuer
287 #define X509_STORE_CTX_get0_current_issuer(x) (x->current_issuer)
288 #endif
289 #endif
290 
291 /* those may be deprecated */
292 #ifndef X509_get_notBefore
293 #define X509_get_notBefore X509_getm_notBefore
294 #endif
295 #ifndef X509_get_notAfter
296 #define X509_get_notAfter X509_getm_notAfter
297 #endif
298 
299 #if OPENSSL_VERSION_NUMBER >= 0x10101000L && !defined(LIBRESSL_VERSION_NUMBER)
300 #define HAVE_OPENSSL_KEYLOG
301 #endif
302 
303 #ifdef HAVE_FIPS
304 #if OPENSSL_VERSION_NUMBER >= 0x30000000L
305 #define modssl_fips_is_enabled() EVP_default_properties_is_fips_enabled(NULL)
306 #define modssl_fips_enable(to) EVP_default_properties_enable_fips(NULL, (to))
307 #else
308 #define modssl_fips_is_enabled() FIPS_mode()
309 #define modssl_fips_enable(to) FIPS_mode_set((to))
310 #endif
311 #endif /* HAVE_FIPS */
312 
313 /* mod_ssl headers */
314 #include "ssl_util_ssl.h"
315 
317 
318 /*
319  * Provide reasonable default for some defines
320  */
321 #ifndef UNSET
322 #define UNSET (-1)
323 #endif
324 #ifndef NUL
325 #define NUL '\0'
326 #endif
327 #ifndef RAND_MAX
328 #include <limits.h>
329 #define RAND_MAX INT_MAX
330 #endif
331 
335 #ifndef UCHAR
336 #define UCHAR unsigned char
337 #endif
338 
342 #define strEQ(s1,s2) (strcmp(s1,s2) == 0)
343 #define strNE(s1,s2) (strcmp(s1,s2) != 0)
344 #define strEQn(s1,s2,n) (strncmp(s1,s2,n) == 0)
345 #define strNEn(s1,s2,n) (strncmp(s1,s2,n) != 0)
346 
347 #define strcEQ(s1,s2) (strcasecmp(s1,s2) == 0)
348 #define strcNE(s1,s2) (strcasecmp(s1,s2) != 0)
349 #define strcEQn(s1,s2,n) (strncasecmp(s1,s2,n) == 0)
350 #define strcNEn(s1,s2,n) (strncasecmp(s1,s2,n) != 0)
351 
352 #define strIsEmpty(s) (s == NULL || s[0] == NUL)
353 
354 #define myConnConfig(c) \
355  ((SSLConnRec *)ap_get_module_config(c->conn_config, &ssl_module))
356 #define myConnConfigSet(c, val) \
357  ap_set_module_config(c->conn_config, &ssl_module, val)
358 #define mySrvConfig(srv) \
359  ((SSLSrvConfigRec *)ap_get_module_config(srv->module_config, &ssl_module))
360 #define myDirConfig(req) \
361  ((SSLDirConfigRec *)ap_get_module_config(req->per_dir_config, &ssl_module))
362 #define myConnCtxConfig(c, sc) \
363  (c->outgoing ? myConnConfig(c)->dc->proxy : sc->server)
364 #define myModConfig(srv) mySrvConfig((srv))->mc
365 #define mySrvFromConn(c) myConnConfig(c)->server
366 #define myDirConfigFromConn(c) myConnConfig(c)->dc
367 #define mySrvConfigFromConn(c) mySrvConfig(mySrvFromConn(c))
368 #define myModConfigFromConn(c) myModConfig(mySrvFromConn(c))
369 
373 #ifndef SSL_SESSION_CACHE_TIMEOUT
374 #define SSL_SESSION_CACHE_TIMEOUT 300
375 #endif
376 
377 /* Default setting for per-dir reneg buffer. */
378 #ifndef DEFAULT_RENEG_BUFFER_SIZE
379 #define DEFAULT_RENEG_BUFFER_SIZE (128 * 1024)
380 #endif
381 
382 /* Default for OCSP response validity */
383 #ifndef DEFAULT_OCSP_MAX_SKEW
384 #define DEFAULT_OCSP_MAX_SKEW (60 * 5)
385 #endif
386 
387 /* Default timeout for OCSP queries */
388 #ifndef DEFAULT_OCSP_TIMEOUT
389 #define DEFAULT_OCSP_TIMEOUT 10
390 #endif
391 
395 #define SSL_OPT_NONE (0)
396 #define SSL_OPT_RELSET (1<<0)
397 #define SSL_OPT_STDENVVARS (1<<1)
398 #define SSL_OPT_EXPORTCERTDATA (1<<3)
399 #define SSL_OPT_FAKEBASICAUTH (1<<4)
400 #define SSL_OPT_STRICTREQUIRE (1<<5)
401 #define SSL_OPT_OPTRENEGOTIATE (1<<6)
402 #define SSL_OPT_LEGACYDNFORMAT (1<<7)
403 #define SSL_OPT_EXPORTCB64DATA (1<<8)
404 typedef int ssl_opt_t;
405 
409 #define SSL_PROTOCOL_NONE (0)
410 #ifndef OPENSSL_NO_SSL3
411 #define SSL_PROTOCOL_SSLV3 (1<<1)
412 #endif
413 #define SSL_PROTOCOL_TLSV1 (1<<2)
414 #ifndef OPENSSL_NO_SSL3
415 #define SSL_PROTOCOL_BASIC (SSL_PROTOCOL_SSLV3|SSL_PROTOCOL_TLSV1)
416 #else
417 #define SSL_PROTOCOL_BASIC (SSL_PROTOCOL_TLSV1)
418 #endif
419 #ifdef HAVE_TLSV1_X
420 #define SSL_PROTOCOL_TLSV1_1 (1<<3)
421 #define SSL_PROTOCOL_TLSV1_2 (1<<4)
422 #define SSL_PROTOCOL_TLSV1_3 (1<<5)
423 
424 #ifdef SSL_OP_NO_TLSv1_3
425 #define SSL_HAVE_PROTOCOL_TLSV1_3 (1)
426 #define SSL_PROTOCOL_ALL (SSL_PROTOCOL_BASIC| \
427  SSL_PROTOCOL_TLSV1_1|SSL_PROTOCOL_TLSV1_2|SSL_PROTOCOL_TLSV1_3)
428 #else
429 #define SSL_HAVE_PROTOCOL_TLSV1_3 (0)
430 #define SSL_PROTOCOL_ALL (SSL_PROTOCOL_BASIC| \
431  SSL_PROTOCOL_TLSV1_1|SSL_PROTOCOL_TLSV1_2)
432 #endif
433 #else
434 #define SSL_PROTOCOL_ALL (SSL_PROTOCOL_BASIC)
435 #endif
436 #ifndef OPENSSL_NO_SSL3
437 #define SSL_PROTOCOL_DEFAULT (SSL_PROTOCOL_ALL & ~SSL_PROTOCOL_SSLV3)
438 #else
439 #define SSL_PROTOCOL_DEFAULT (SSL_PROTOCOL_ALL)
440 #endif
441 typedef int ssl_proto_t;
442 
446 typedef enum {
453 
454 #define SSL_VERIFY_PEER_STRICT \
455  (SSL_VERIFY_PEER|SSL_VERIFY_FAIL_IF_NO_PEER_CERT)
456 
457 #define ssl_verify_error_is_optional(errnum) \
458  ((errnum == X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT) \
459  || (errnum == X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN) \
460  || (errnum == X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY) \
461  || (errnum == X509_V_ERR_CERT_UNTRUSTED) \
462  || (errnum == X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE))
463 
467 typedef enum {
469  SSL_CRLCHECK_LEAF = (1 << 0),
470  SSL_CRLCHECK_CHAIN = (1 << 1),
471 
472 #define SSL_CRLCHECK_FLAGS (~0x3)
475 
479 typedef enum {
481  SSL_OCSPCHECK_LEAF = (1 << 0),
485 
489 typedef enum {
493  SSL_PPTYPE_PIPE = 2
495 
499 #define SSL_PCM_EXISTS 1
500 #define SSL_PCM_ISREG 2
501 #define SSL_PCM_ISDIR 4
502 #define SSL_PCM_ISNONZERO 8
503 typedef unsigned int ssl_pathcheck_t;
504 
508 typedef enum {
514 
518 typedef struct {
519  const char *cpExpr;
521 } ssl_require_t;
522 
526 typedef enum {
530 typedef enum {
534  SSL_RSSRC_EGD = 4
536 typedef struct {
539  char *cpPath;
540  int nBytes;
542 
546 typedef struct {
547  long int nData;
548  unsigned char *cpData;
550 } ssl_asn1_t;
551 
552 typedef enum {
553  RENEG_INIT = 0, /* Before initial handshake */
554  RENEG_REJECT, /* After initial handshake; any client-initiated
555  * renegotiation should be rejected */
556  RENEG_ALLOW, /* A server-initiated renegotiation is taking
557  * place (as dictated by configuration) */
558  RENEG_ABORT /* Renegotiation initiated by client, abort the
559  * connection */
561 
567 typedef struct SSLSrvConfigRec SSLSrvConfigRec;
568 typedef struct SSLDirConfigRec SSLDirConfigRec;
569 
570 typedef enum {
576 
577 typedef struct {
578  SSL *ssl;
579  const char *client_dn;
580  X509 *client_cert;
582  const char *verify_info;
583  const char *verify_error;
585  int disabled;
586  enum {
587  NON_SSL_OK = 0, /* is SSL request, or error handling completed */
588  NON_SSL_SEND_REQLINE, /* Need to send the fake request line */
589  NON_SSL_SEND_HDR_SEP, /* Need to send the header separator */
590  NON_SSL_SET_ERROR_MSG /* Need to set the error message */
591  } non_ssl_request;
592 
593 #ifndef SSL_OP_NO_RENEGOTIATION
594  /* For OpenSSL < 1.1.1, track the handshake/renegotiation state
595  * for the connection to block client-initiated renegotiations.
596  * For OpenSSL >=1.1.1, the SSL_OP_NO_RENEGOTIATION flag is used in
597  * the SSL * options state with equivalent effect. */
599 #endif
600 
603 
604  const char *cipher_suite; /* cipher suite used in last reneg */
605  int service_unavailable; /* thouugh we negotiate SSL, no requests will be served */
606  int vhost_found; /* whether we found vhost from SNI already */
607 } SSLConnRec;
608 
609 /* Private keys are retained across reloads, since decryption
610  * passphrases can only be entered during startup (before detaching
611  * from a terminal). This structure is stored via the ap_retained_*
612  * API and retrieved on later module reloads. If the structure
613  * changes, the key name must be changed by increasing the digit at
614  * the end, to avoid an updated version of mod_ssl loading retained
615  * data with a different struct definition.
616  *
617  * All objects used here must be allocated from the process pool
618  * (s->process->pool) so they also survives restarts. */
619 #define MODSSL_RETAINED_KEY "mod_ssl-retained-1"
620 
621 typedef struct {
622  /* A hash table of vhost key-IDs used to index the privkeys hash,
623  * for example the string "vhost.example.com:443:0". For each
624  * (key, value) pair the value is the same as the key, allowing
625  * the keys to be retrieved on subsequent reloads rather than
626  * rellocated. ### This optimisation seems to be of dubious
627  * value. Allocating the vhost-key-ids from pconf and duping them
628  * when storing them in ->privkeys would be simpler. */
630 
631  /* A hash table of pointers to ssl_asn1_t structures. The
632  * structures are used to store private keys in raw DER format
633  * (serialized OpenSSL PrivateKey structures). The table is
634  * indexed by key-IDs from the key_ids hash table. */
636 
637  /* Do NOT add fields here without changing the key name, as above. */
639 
640 typedef struct {
642 
643  /* OpenSSL SSL_SESS_CACHE_* flags: */
645 
646  /* Data retained across reloads. */
648 
649  /* The configured provider, and associated private data
650  * structure. */
653 
655 
656 #ifdef MODSSL_USE_SSLRAND
657  pid_t pid; /* used for seeding after fork() */
659 #endif
660 
661 #if defined(HAVE_OPENSSL_ENGINE_H) && defined(HAVE_ENGINE_INIT)
662  const char *szCryptoDevice;
663 #endif
664 
665 #ifdef HAVE_OCSP_STAPLING
666  const ap_socache_provider_t *stapling_cache;
667  ap_socache_instance_t *stapling_cache_context;
668  apr_global_mutex_t *stapling_cache_mutex;
669  apr_global_mutex_t *stapling_refresh_mutex;
670 #endif
671 
672 #ifdef HAVE_OPENSSL_KEYLOG
673  /* Used for logging if SSLKEYLOGFILE is set at startup. */
674  apr_file_t *keylog_file;
675 #endif
676 
677 #ifdef HAVE_FIPS
678  BOOL fips;
679 #endif
681 
684 typedef struct {
685  /* Lists of configured certs and keys for this server */
688 
691  const char *ca_name_path;
692  const char *ca_name_file;
693 
694  /* TLS service for this server is suspended */
697 
698 typedef struct {
700  const char *cert_file;
701  const char *cert_path;
702  const char *ca_cert_file;
703  /* certs is a stack of configured cert, key pairs. */
704  STACK_OF(X509_INFO) *certs;
705  /* ca_certs contains ONLY chain certs for each item in certs.
706  * ca_certs[n] is a pointer to the (STACK_OF(X509) *) stack which
707  * holds the cert chain for the 'n'th cert in the certs stack, or
708  * NULL if no chain is configured. */
709  STACK_OF(X509) **ca_certs;
711 
713 typedef struct {
715  const char *ca_cert_path;
716  const char *ca_cert_file;
717 
718  const char *cipher_suite;
719 
723 
727  const char *tls13_ciphers;
729 
730 #ifdef HAVE_TLS_SESSION_TICKETS
731 typedef struct {
732  const char *file_path;
733  unsigned char key_name[16];
734 #if OPENSSL_VERSION_NUMBER < 0x30000000L
735  unsigned char hmac_secret[16];
736 #else
737  OSSL_PARAM mac_params[3];
738 #endif
739  unsigned char aes_key[16];
740 } modssl_ticket_key_t;
741 #endif
742 
743 #ifdef HAVE_SSL_CONF_CMD
744 typedef struct {
745  const char *name;
746  const char *value;
747 } ssl_ctx_param_t;
748 #endif
749 
750 typedef struct {
752  SSL_CTX *ssl_ctx;
753 
757 
758 #ifdef HAVE_TLS_SESSION_TICKETS
759  modssl_ticket_key_t *ticket_key;
760 #endif
761 
764 
767  const char *pphrase_dialog_path;
768 
769  const char *cert_chain;
770 
772  const char *crl_path;
773  const char *crl_file;
775 
776 #ifdef HAVE_OCSP_STAPLING
778  BOOL stapling_enabled;
779  long stapling_resptime_skew;
780  long stapling_resp_maxage;
781  int stapling_cache_timeout;
782  BOOL stapling_return_errors;
783  BOOL stapling_fake_trylater;
784  int stapling_errcache_timeout;
785  apr_interval_time_t stapling_responder_timeout;
786  const char *stapling_force_url;
787 #endif
788 
789 #ifdef HAVE_SRP
790  char *srp_vfile;
791  char *srp_unknown_user_seed;
792  SRP_VBASE *srp_vbase;
793 #endif
794 
796 
798  BOOL ocsp_force_default; /* true if the default responder URL is
799  * used regardless of per-cert URL */
800  const char *ocsp_responder; /* default responder URL */
806 
807  BOOL ocsp_noverify; /* true if skipping OCSP certification verification like openssl -noverify */
808  /* Declare variables for using OCSP Responder Certs for OCSP verification */
809  int ocsp_verify_flags; /* Flags to use when verifying OCSP response */
810  const char *ocsp_certs_file; /* OCSP other certificates filename */
811  STACK_OF(X509) *ocsp_certs; /* OCSP other certificates */
812 
813 #ifdef HAVE_SSL_CONF_CMD
814  SSL_CONF_CTX *ssl_ctx_config; /* Configuration context */
815  apr_array_header_t *ssl_ctx_param; /* parameters to pass to SSL_CTX */
816 #endif
817 
821 } modssl_ctx_t;
822 
826  const char *vhost_id;
827  const unsigned char *vhost_md5; /* = ap_md5_binary(vhost_id, ...) */
832 #ifdef HAVE_TLSEXT
833  ssl_enabled_t strict_sni_vhost_check;
834 #endif
835 #ifndef OPENSSL_NO_COMP
837 #endif
839 
840 };
841 
853  const char *szCipherSuite;
856  const char *szUserName;
858 
862 };
863 
865 
872 
877 void *ssl_config_server_merge(apr_pool_t *, void *, void *);
879 void *ssl_config_perdir_merge(apr_pool_t *, void *, void *);
882 const char *ssl_cmd_SSLPolicyApply(cmd_parms *, void *, const char *);
883 const char *ssl_cmd_SSLPassPhraseDialog(cmd_parms *, void *, const char *);
884 const char *ssl_cmd_SSLCryptoDevice(cmd_parms *, void *, const char *);
885 const char *ssl_cmd_SSLRandomSeed(cmd_parms *, void *, const char *, const char *, const char *);
886 const char *ssl_cmd_SSLEngine(cmd_parms *, void *, const char *);
887 const char *ssl_cmd_SSLCipherSuite(cmd_parms *, void *, const char *, const char *);
888 const char *ssl_cmd_SSLCertificateFile(cmd_parms *, void *, const char *);
889 const char *ssl_cmd_SSLCertificateKeyFile(cmd_parms *, void *, const char *);
890 const char *ssl_cmd_SSLCertificateChainFile(cmd_parms *, void *, const char *);
891 const char *ssl_cmd_SSLCACertificatePath(cmd_parms *, void *, const char *);
892 const char *ssl_cmd_SSLCACertificateFile(cmd_parms *, void *, const char *);
893 const char *ssl_cmd_SSLCADNRequestPath(cmd_parms *, void *, const char *);
894 const char *ssl_cmd_SSLCADNRequestFile(cmd_parms *, void *, const char *);
895 const char *ssl_cmd_SSLCARevocationPath(cmd_parms *, void *, const char *);
896 const char *ssl_cmd_SSLCARevocationFile(cmd_parms *, void *, const char *);
897 const char *ssl_cmd_SSLCARevocationCheck(cmd_parms *, void *, const char *);
898 const char *ssl_cmd_SSLHonorCipherOrder(cmd_parms *cmd, void *dcfg, int flag);
899 const char *ssl_cmd_SSLCompression(cmd_parms *, void *, int flag);
900 const char *ssl_cmd_SSLSessionTickets(cmd_parms *, void *, int flag);
901 const char *ssl_cmd_SSLVerifyClient(cmd_parms *, void *, const char *);
902 const char *ssl_cmd_SSLVerifyDepth(cmd_parms *, void *, const char *);
903 const char *ssl_cmd_SSLSessionCache(cmd_parms *, void *, const char *);
904 const char *ssl_cmd_SSLSessionCacheTimeout(cmd_parms *, void *, const char *);
905 const char *ssl_cmd_SSLProtocol(cmd_parms *, void *, const char *);
906 const char *ssl_cmd_SSLOptions(cmd_parms *, void *, const char *);
907 const char *ssl_cmd_SSLRequireSSL(cmd_parms *, void *);
908 const char *ssl_cmd_SSLRequire(cmd_parms *, void *, const char *);
909 const char *ssl_cmd_SSLUserName(cmd_parms *, void *, const char *);
910 const char *ssl_cmd_SSLRenegBufferSize(cmd_parms *cmd, void *dcfg, const char *arg);
911 const char *ssl_cmd_SSLStrictSNIVHostCheck(cmd_parms *cmd, void *dcfg, int flag);
912 const char *ssl_cmd_SSLInsecureRenegotiation(cmd_parms *cmd, void *dcfg, int flag);
913 
914 const char *ssl_cmd_SSLProxyEngine(cmd_parms *cmd, void *dcfg, int flag);
915 const char *ssl_cmd_SSLProxyProtocol(cmd_parms *, void *, const char *);
916 const char *ssl_cmd_SSLProxyCipherSuite(cmd_parms *, void *, const char *, const char *);
917 const char *ssl_cmd_SSLProxyVerify(cmd_parms *, void *, const char *);
918 const char *ssl_cmd_SSLProxyVerifyDepth(cmd_parms *, void *, const char *);
919 const char *ssl_cmd_SSLProxyCACertificatePath(cmd_parms *, void *, const char *);
920 const char *ssl_cmd_SSLProxyCACertificateFile(cmd_parms *, void *, const char *);
921 const char *ssl_cmd_SSLProxyCARevocationPath(cmd_parms *, void *, const char *);
922 const char *ssl_cmd_SSLProxyCARevocationFile(cmd_parms *, void *, const char *);
923 const char *ssl_cmd_SSLProxyCARevocationCheck(cmd_parms *, void *, const char *);
924 const char *ssl_cmd_SSLProxyMachineCertificatePath(cmd_parms *, void *, const char *);
925 const char *ssl_cmd_SSLProxyMachineCertificateFile(cmd_parms *, void *, const char *);
926 const char *ssl_cmd_SSLProxyMachineCertificateChainFile(cmd_parms *, void *, const char *);
927 #ifdef HAVE_TLS_SESSION_TICKETS
928 const char *ssl_cmd_SSLSessionTicketKeyFile(cmd_parms *cmd, void *dcfg, const char *arg);
929 #endif
930 const char *ssl_cmd_SSLProxyCheckPeerExpire(cmd_parms *cmd, void *dcfg, int flag);
931 const char *ssl_cmd_SSLProxyCheckPeerCN(cmd_parms *cmd, void *dcfg, int flag);
932 const char *ssl_cmd_SSLProxyCheckPeerName(cmd_parms *cmd, void *dcfg, int flag);
933 
934 const char *ssl_cmd_SSLOCSPOverrideResponder(cmd_parms *cmd, void *dcfg, int flag);
935 const char *ssl_cmd_SSLOCSPDefaultResponder(cmd_parms *cmd, void *dcfg, const char *arg);
936 const char *ssl_cmd_SSLOCSPResponseTimeSkew(cmd_parms *cmd, void *dcfg, const char *arg);
937 const char *ssl_cmd_SSLOCSPResponseMaxAge(cmd_parms *cmd, void *dcfg, const char *arg);
938 const char *ssl_cmd_SSLOCSPResponderTimeout(cmd_parms *cmd, void *dcfg, const char *arg);
939 const char *ssl_cmd_SSLOCSPUseRequestNonce(cmd_parms *cmd, void *dcfg, int flag);
940 const char *ssl_cmd_SSLOCSPEnable(cmd_parms *cmd, void *dcfg, const char *arg);
941 const char *ssl_cmd_SSLOCSPProxyURL(cmd_parms *cmd, void *dcfg, const char *arg);
942 
943 /* Declare OCSP Responder Certificate Verification Directive */
944 const char *ssl_cmd_SSLOCSPNoVerify(cmd_parms *cmd, void *dcfg, int flag);
945 /* Declare OCSP Responder Certificate File Directive */
946 const char *ssl_cmd_SSLOCSPResponderCertificateFile(cmd_parms *cmd, void *dcfg, const char *arg);
947 
948 #ifdef HAVE_SSL_CONF_CMD
949 const char *ssl_cmd_SSLOpenSSLConfCmd(cmd_parms *cmd, void *dcfg, const char *arg1, const char *arg2);
950 #endif
951 
952 #ifdef HAVE_SRP
953 const char *ssl_cmd_SSLSRPVerifierFile(cmd_parms *cmd, void *dcfg, const char *arg);
954 const char *ssl_cmd_SSLSRPUnknownUserSeed(cmd_parms *cmd, void *dcfg, const char *arg);
955 #endif
956 
957 const char *ssl_cmd_SSLFIPS(cmd_parms *cmd, void *dcfg, int flag);
958 
966  apr_pool_t *ptemp, server_rec *s,
967  ap_conf_vector_t *section_config);
968 STACK_OF(X509_NAME)
969  *ssl_init_FindCAList(server_rec *, apr_pool_t *, const char *, const char *);
972 
981 
985 
987 DH *ssl_callback_TmpDH(SSL *, int, int);
988 int ssl_callback_SSLVerify(int, X509_STORE_CTX *);
989 int ssl_callback_SSLVerify_CRL(int, X509_STORE_CTX *, conn_rec *);
990 int ssl_callback_proxy_cert(SSL *ssl, X509 **x509, EVP_PKEY **pkey);
991 int ssl_callback_NewSessionCacheEntry(SSL *, SSL_SESSION *);
992 SSL_SESSION *ssl_callback_GetSessionCacheEntry(SSL *, IDCONST unsigned char *, int, int *);
993 void ssl_callback_DelSessionCacheEntry(SSL_CTX *, SSL_SESSION *);
994 void ssl_callback_Info(const SSL *, int, int);
995 #ifdef HAVE_TLSEXT
996 int ssl_callback_ServerNameIndication(SSL *, int *, modssl_ctx_t *);
997 #endif
998 #if OPENSSL_VERSION_NUMBER >= 0x10101000L && !defined(LIBRESSL_VERSION_NUMBER)
999 int ssl_callback_ClientHello(SSL *, int *, void *);
1000 #endif
1001 #ifdef HAVE_TLS_SESSION_TICKETS
1002 int ssl_callback_SessionTicket(SSL *ssl,
1003  unsigned char *keyname,
1004  unsigned char *iv,
1005  EVP_CIPHER_CTX *cipher_ctx,
1006 #if OPENSSL_VERSION_NUMBER < 0x30000000L
1007  HMAC_CTX *hmac_ctx,
1008 #else
1009  EVP_MAC_CTX *mac_ctx,
1010 #endif
1011  int mode);
1012 #endif
1013 
1014 #ifdef HAVE_TLS_ALPN
1015 int ssl_callback_alpn_select(SSL *ssl, const unsigned char **out,
1016  unsigned char *outlen, const unsigned char *in,
1017  unsigned int inlen, void *arg);
1018 #endif
1019 
1025  apr_time_t, SSL_SESSION *, apr_pool_t *);
1028  apr_pool_t *);
1029 
1031 #ifdef HAVE_OCSP_STAPLING
1032 const char *ssl_cmd_SSLStaplingCache(cmd_parms *, void *, const char *);
1033 const char *ssl_cmd_SSLUseStapling(cmd_parms *, void *, int);
1034 const char *ssl_cmd_SSLStaplingResponseTimeSkew(cmd_parms *, void *, const char *);
1035 const char *ssl_cmd_SSLStaplingResponseMaxAge(cmd_parms *, void *, const char *);
1036 const char *ssl_cmd_SSLStaplingStandardCacheTimeout(cmd_parms *, void *, const char *);
1037 const char *ssl_cmd_SSLStaplingErrorCacheTimeout(cmd_parms *, void *, const char *);
1038 const char *ssl_cmd_SSLStaplingReturnResponderErrors(cmd_parms *, void *, int);
1039 const char *ssl_cmd_SSLStaplingFakeTryLater(cmd_parms *, void *, int);
1040 const char *ssl_cmd_SSLStaplingResponderTimeout(cmd_parms *, void *, const char *);
1041 const char *ssl_cmd_SSLStaplingForceURL(cmd_parms *, void *, const char *);
1042 apr_status_t modssl_init_stapling(server_rec *, apr_pool_t *, apr_pool_t *, modssl_ctx_t *);
1043 void ssl_stapling_certinfo_hash_init(apr_pool_t *);
1044 int ssl_stapling_init_cert(server_rec *, apr_pool_t *, apr_pool_t *,
1045  modssl_ctx_t *, X509 *);
1046 #endif
1047 #ifdef HAVE_SRP
1048 int ssl_callback_SRPServerParams(SSL *, int *, void *);
1049 #endif
1050 
1051 #ifdef HAVE_OPENSSL_KEYLOG
1052 /* Callback used with SSL_CTX_set_keylog_callback. */
1053 void modssl_callback_keylog(const SSL *ssl, const char *line);
1054 #endif
1055 
1060 
1061 /* ssl_io_buffer_fill fills the setaside buffering of the HTTP request
1062  * to allow an SSL renegotiation to take place. */
1064 
1065 #ifdef MODSSL_USE_SSLRAND
1068 #else
1069 #define ssl_rand_seed(s, p, ctx, c) /* noop */
1070 #endif
1071 
1075  const char * const *);
1077 char *ssl_util_readfilter(server_rec *, apr_pool_t *, const char *,
1078  const char * const *);
1080 #if APR_HAS_THREADS && MODSSL_USE_OPENSSL_PRE_1_1_API
1083 #endif
1085 
1086 BOOL ssl_util_vhost_matches(const char *servername, server_rec *s);
1087 
1090  const char *, apr_array_header_t **);
1091 
1092 /* Load public and/or private key from the configured ENGINE. Private
1093  * key returned as *pkey. certid can be NULL, in which case *pubkey
1094  * is not altered. Errors logged on failure. */
1096  const char *vhostid,
1097  const char *certid, const char *keyid,
1098  X509 **pubkey, EVP_PKEY **privkey);
1099 
1101 #if OPENSSL_VERSION_NUMBER < 0x30000000L
1102 DH *modssl_dh_from_file(const char *);
1103 #else
1104 EVP_PKEY *modssl_dh_pkey_from_file(const char *);
1105 #endif
1106 #ifdef HAVE_ECC
1107 EC_GROUP *modssl_ec_group_from_file(const char *);
1108 #endif
1109 
1110 /* Store the EVP_PKEY key (serialized into DER) in the hash table with
1111  * key, returning the ssl_asn1_t structure pointer. */
1112 ssl_asn1_t *ssl_asn1_table_set(apr_hash_t *table, const char *key,
1113  EVP_PKEY *pkey);
1114 /* Retrieve the ssl_asn1_t structure with given key from the hash. */
1115 ssl_asn1_t *ssl_asn1_table_get(apr_hash_t *table, const char *key);
1116 
1122 
1124 
1125 /* mutex type names for Mutex directive */
1126 #define SSL_CACHE_MUTEX_TYPE "ssl-cache"
1127 #define SSL_STAPLING_CACHE_MUTEX_TYPE "ssl-stapling"
1128 #define SSL_STAPLING_REFRESH_MUTEX_TYPE "ssl-stapling-refresh"
1129 
1131 
1133 void ssl_log_ssl_error(const char *, int, int, server_rec *);
1134 
1135 /* ssl_log_xerror, ssl_log_cxerror and ssl_log_rxerror are wrappers for the
1136  * respective ap_log_*error functions and take a certificate as an
1137  * additional argument (whose details are appended to the log message).
1138  * The other arguments are interpreted exactly as with their ap_log_*error
1139  * counterparts. */
1140 void ssl_log_xerror(const char *file, int line, int level,
1142  X509 *cert, const char *format, ...)
1143  __attribute__((format(printf,8,9)));
1144 
1145 void ssl_log_cxerror(const char *file, int line, int level,
1146  apr_status_t rv, conn_rec *c, X509 *cert,
1147  const char *format, ...)
1148  __attribute__((format(printf,7,8)));
1149 
1150 void ssl_log_rxerror(const char *file, int line, int level,
1151  apr_status_t rv, request_rec *r, X509 *cert,
1152  const char *format, ...)
1153  __attribute__((format(printf,7,8)));
1154 
1155 #define SSLLOG_MARK __FILE__,__LINE__
1156 
1159 /* Register variables for the lifetime of the process pool 'p'. */
1161 
1162 /* Matches optional function of the same name in the public API. The
1163  * pool in which to allocate the return value must be non-NULL; c
1164  * and/or r may be NULL. */
1166  const char *name)
1168 apr_array_header_t *ssl_ext_list(apr_pool_t *p, conn_rec *c, int peer, const char *extension);
1169 
1170 /* Extract SSL_*_DN_* variables into table 't' from SSL object 'ssl',
1171  * allocating from 'p': */
1173 
1174 /* Extract SSL_*_SAN_* variables (subjectAltName entries) into table 't'
1175  * from SSL object 'ssl', allocating from 'p'. */
1177 
1178 #ifndef OPENSSL_NO_OCSP
1179 /* Perform OCSP validation of the current cert in the given context.
1180  * Returns non-zero on success or zero on failure. On failure, the
1181  * context error code is set. */
1182 int modssl_verify_ocsp(X509_STORE_CTX *ctx, SSLSrvConfigRec *sc,
1184 
1185 /* OCSP helper interface; dispatches the given OCSP request to the
1186  * responder at the given URI. Returns the decoded OCSP response
1187  * object, or NULL on error (in which case, errors will have been
1188  * logged). Pool 'p' is used for temporary allocations. */
1190  apr_interval_time_t timeout,
1191  OCSP_REQUEST *request,
1192  conn_rec *c, apr_pool_t *p);
1193 
1194 /* Initialize OCSP trusted certificate list */
1196 
1197 #endif
1198 
1199 #if MODSSL_USE_OPENSSL_PRE_1_1_API
1200 /* Retrieve DH parameters for given key length. Return value should
1201  * be treated as unmutable, since it is stored in process-global
1202  * memory. */
1203 DH *modssl_get_dh_params(unsigned keylen);
1204 #endif
1205 
1206 /* Returns non-zero if the request was made over SSL/TLS. If sslconn
1207  * is non-NULL and the request is using SSL/TLS, sets *sslconn to the
1208  * corresponding SSLConnRec structure for the connection. */
1210 
1211 /* Returns non-zero if the cert/key filename should be handled through
1212  * the configured ENGINE. */
1213 int modssl_is_engine_id(const char *name);
1214 
1215 #if HAVE_VALGRIND
1216 extern int ssl_running_on_valgrind;
1217 #endif
1218 
1219 int ssl_is_challenge(conn_rec *c, const char *servername,
1220  X509 **pcert, EVP_PKEY **pkey,
1221  const char **pcert_file, const char **pkey_file);
1222 
1223 /* Set the renegotiation state for connection. */
1225 
1226 #endif /* SSL_PRIVATE_H */
Symbol export macros and hook functions.
Expression parser.
Small object cache provider interface.
APR Platform Definitions.
APR FNMatch Functions.
APR Global Locking Routines.
APR general purpose library routines.
APR-UTIL registration of functions exported by modules.
APR Strings library.
APR Table library.
APR Standard Headers Support.
struct ap_conf_vector_t ap_conf_vector_t
Definition: http_config.h:512
struct ap_socache_instance_t ap_socache_instance_t
Definition: ap_socache.h:49
request_rec * r
Definition: mod_dav.h:518
const char * s
Definition: mod_dav.h:1327
apr_bucket_brigade ap_input_mode_t mode
Definition: mod_dav.h:2662
const dav_resource dav_lockdb dav_lock * request
Definition: mod_dav.h:1441
apr_bucket_brigade request_rec apr_pool_t * pool
Definition: mod_dav.h:557
const char const char * uri
Definition: mod_dav.h:631
const char * name
Definition: mod_dav.h:805
modssl_reneg_state
Definition: ssl_private.h:552
const char * ssl_cmd_SSLProxyVerify(cmd_parms *, void *, const char *)
const authz_provider ssl_authz_provider_require_ssl
const char * ssl_cmd_SSLProxyCARevocationFile(cmd_parms *, void *, const char *)
const char * ssl_cmd_SSLCADNRequestPath(cmd_parms *, void *, const char *)
const char * ssl_cmd_SSLSessionCacheTimeout(cmd_parms *, void *, const char *)
int ssl_callback_NewSessionCacheEntry(SSL *, SSL_SESSION *)
apr_status_t modssl_load_engine_keypair(server_rec *s, apr_pool_t *p, const char *vhostid, const char *certid, const char *keyid, X509 **pubkey, EVP_PKEY **privkey)
const char * ssl_cmd_SSLProxyMachineCertificateChainFile(cmd_parms *, void *, const char *)
apr_status_t ssl_die(server_rec *)
int modssl_request_is_tls(const request_rec *r, SSLConnRec **sslconn)
void ssl_scache_kill(server_rec *)
int modssl_is_engine_id(const char *name)
const char * ssl_cmd_SSLCARevocationCheck(cmd_parms *, void *, const char *)
const char * ssl_cmd_SSLEngine(cmd_parms *, void *, const char *)
void ssl_log_xerror(const char *file, int line, int level, apr_status_t rv, apr_pool_t *p, server_rec *s, X509 *cert, const char *format,...) __attribute__((format(printf
apr_status_t ssl_init_CheckServers(server_rec *, apr_pool_t *)
const char * ssl_cmd_SSLProxyCheckPeerName(cmd_parms *cmd, void *dcfg, int flag)
const char * ssl_cmd_SSLCARevocationPath(cmd_parms *, void *, const char *)
module AP_MODULE_DECLARE_DATA ssl_module
const char * ssl_cmd_SSLOCSPOverrideResponder(cmd_parms *cmd, void *dcfg, int flag)
apr_array_header_t * ssl_ext_list(apr_pool_t *p, conn_rec *c, int peer, const char *extension)
const char * ssl_var_lookup(apr_pool_t *p, server_rec *s, conn_rec *c, request_rec *r, const char *name) AP_FN_ATTR_NONNULL((1
ssl_ocspcheck_t
Definition: ssl_private.h:479
const char * ssl_cmd_SSLCertificateChainFile(cmd_parms *, void *, const char *)
const char * ssl_cmd_SSLFIPS(cmd_parms *cmd, void *dcfg, int flag)
int ssl_hook_Fixup(request_rec *)
DH * modssl_dh_from_file(const char *)
ssl_enabled_t
Definition: ssl_private.h:508
const char * ssl_cmd_SSLVerifyClient(cmd_parms *, void *, const char *)
const char * ssl_cmd_SSLProxyEngine(cmd_parms *cmd, void *dcfg, int flag)
const char * ssl_cmd_SSLOCSPResponseTimeSkew(cmd_parms *cmd, void *dcfg, const char *arg)
SSLSrvConfigRec * ssl_policy_lookup(apr_pool_t *pool, const char *name)
const char * ssl_cmd_SSLCADNRequestFile(cmd_parms *, void *, const char *)
DH * ssl_callback_TmpDH(SSL *, int, int)
BOOL ssl_scache_store(server_rec *, IDCONST UCHAR *, int, apr_time_t, SSL_SESSION *, apr_pool_t *)
int ssl_hook_Auth(request_rec *)
const char * ssl_cmd_SSLOCSPDefaultResponder(cmd_parms *cmd, void *dcfg, const char *arg)
const char * ssl_cmd_SSLProxyCACertificateFile(cmd_parms *, void *, const char *)
ssl_rsctx_t
Definition: ssl_private.h:526
const char * ssl_cmd_SSLRenegBufferSize(cmd_parms *cmd, void *dcfg, const char *arg)
const char * ssl_cmd_SSLSessionTickets(cmd_parms *, void *, int flag)
* ssl_init_FindCAList(server_rec *, apr_pool_t *, const char *, const char *)
const char * ssl_cmd_SSLProtocol(cmd_parms *, void *, const char *)
int ssl_init_ssl_connection(conn_rec *c, request_rec *r)
const char * ssl_cmd_SSLCARevocationFile(cmd_parms *, void *, const char *)
const char * ssl_cmd_SSLInsecureRenegotiation(cmd_parms *cmd, void *dcfg, int flag)
char * ssl_util_vhostid(apr_pool_t *, server_rec *)
const char * ssl_cmd_SSLProxyCACertificatePath(cmd_parms *, void *, const char *)
const char * ssl_cmd_SSLPassPhraseDialog(cmd_parms *, void *, const char *)
const char AP_FN_ATTR_WARN_UNUSED_RESULT
Definition: ssl_private.h:1167
SSL_SESSION * ssl_callback_GetSessionCacheEntry(SSL *, IDCONST unsigned char *, int, int *)
apr_status_t ssl_init_Module(apr_pool_t *, apr_pool_t *, apr_pool_t *, server_rec *)
int ssl_proto_t
Definition: ssl_private.h:441
apr_status_t ssl_scache_init(server_rec *, apr_pool_t *)
ssl_asn1_t * ssl_asn1_table_get(apr_hash_t *table, const char *key)
int ssl_callback_SSLVerify_CRL(int, X509_STORE_CTX *, conn_rec *)
const char * ssl_cmd_SSLHonorCipherOrder(cmd_parms *cmd, void *dcfg, int flag)
ssl_verify_t
Definition: ssl_private.h:446
int modssl_verify_ocsp(X509_STORE_CTX *ctx, SSLSrvConfigRec *sc, server_rec *s, conn_rec *c, apr_pool_t *pool)
const char * ssl_cmd_SSLProxyCARevocationPath(cmd_parms *, void *, const char *)
ssl_crlcheck_t
Definition: ssl_private.h:467
apr_status_t ssl_load_encrypted_pkey(server_rec *, apr_pool_t *, int, const char *, apr_array_header_t **)
const char * ssl_cmd_SSLOCSPResponderTimeout(cmd_parms *cmd, void *dcfg, const char *arg)
apr_status_t ssl_init_ModuleKill(void *data)
void ssl_scache_remove(server_rec *, IDCONST UCHAR *, int, apr_pool_t *)
const char * ssl_cmd_SSLProxyMachineCertificatePath(cmd_parms *, void *, const char *)
void ssl_util_thread_id_setup(apr_pool_t *)
void * ssl_config_server_create(apr_pool_t *, server_rec *)
char * ssl_util_readfilter(server_rec *, apr_pool_t *, const char *, const char *const *)
BOOL ssl_util_vhost_matches(const char *servername, server_rec *s)
const char * ssl_cmd_SSLStrictSNIVHostCheck(cmd_parms *cmd, void *dcfg, int flag)
void * ssl_config_perdir_merge(apr_pool_t *, void *, void *)
const char * ssl_cmd_SSLUserName(cmd_parms *, void *, const char *)
void void ssl_log_cxerror(const char *file, int line, int level, apr_status_t rv, conn_rec *c, X509 *cert, const char *format,...) __attribute__((format(printf
void modssl_set_reneg_state(SSLConnRec *sslconn, modssl_reneg_state state)
void ssl_io_filter_register(apr_pool_t *)
const char * ssl_cmd_SSLVerifyDepth(cmd_parms *, void *, const char *)
#define IDCONST
Definition: ssl_private.h:193
BOOL ssl_config_global_isfixed(SSLModConfigRec *)
DH * modssl_get_dh_params(unsigned keylen)
int ssl_proxy_section_post_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s, ap_conf_vector_t *section_config)
const char * ssl_cmd_SSLOCSPEnable(cmd_parms *cmd, void *dcfg, const char *arg)
void ssl_config_proxy_merge(apr_pool_t *, SSLDirConfigRec *, SSLDirConfigRec *)
void ssl_scache_status_register(apr_pool_t *p)
const char * ssl_cmd_SSLProxyMachineCertificateFile(cmd_parms *, void *, const char *)
SSL_SESSION * ssl_scache_retrieve(server_rec *, IDCONST UCHAR *, int, apr_pool_t *)
const char * ssl_cmd_SSLCACertificatePath(cmd_parms *, void *, const char *)
const char * ssl_cmd_SSLProxyCARevocationCheck(cmd_parms *, void *, const char *)
const char * ssl_cmd_SSLProxyProtocol(cmd_parms *, void *, const char *)
apr_status_t ssl_io_filter_init(conn_rec *, request_rec *r, SSL *)
const char * ssl_cmd_SSLCompression(cmd_parms *, void *, int flag)
int ssl_opt_t
Definition: ssl_private.h:404
ssl_rssrc_t
Definition: ssl_private.h:530
int ssl_mutex_off(server_rec *)
int ssl_hook_Upgrade(request_rec *)
const char * ssl_cmd_SSLRequire(cmd_parms *, void *, const char *)
const char * ssl_cmd_SSLRandomSeed(cmd_parms *, void *, const char *, const char *, const char *)
#define UCHAR
Definition: ssl_private.h:336
void ssl_log_ssl_error(const char *, int, int, server_rec *)
unsigned int ssl_pathcheck_t
Definition: ssl_private.h:503
const char * ssl_cmd_SSLCryptoDevice(cmd_parms *, void *, const char *)
int ssl_is_challenge(conn_rec *c, const char *servername, X509 **pcert, EVP_PKEY **pkey, const char **pcert_file, const char **pkey_file)
BOOL ssl_util_path_check(ssl_pathcheck_t, const char *, apr_pool_t *)
const char * ssl_cmd_SSLOCSPResponseMaxAge(cmd_parms *cmd, void *dcfg, const char *arg)
const char * ssl_cmd_SSLOCSPResponderCertificateFile(cmd_parms *cmd, void *dcfg, const char *arg)
const char * ssl_cmd_SSLCACertificateFile(cmd_parms *, void *, const char *)
int ssl_stapling_mutex_reinit(server_rec *, apr_pool_t *)
void ssl_callback_Info(const SSL *, int, int)
void ssl_rand_seed(server_rec *, apr_pool_t *, ssl_rsctx_t, char *)
#define UNSET
Definition: ssl_private.h:322
const char * ssl_cmd_SSLCipherSuite(cmd_parms *, void *, const char *, const char *)
void modssl_set_io_callbacks(SSL *ssl)
const char * ssl_cmd_SSLOCSPNoVerify(cmd_parms *cmd, void *dcfg, int flag)
const char * ssl_cmd_SSLRequireSSL(cmd_parms *, void *)
const char * ssl_cmd_SSLSessionCache(cmd_parms *, void *, const char *)
int ssl_hook_ReadReq(request_rec *)
void void void ssl_log_rxerror(const char *file, int line, int level, apr_status_t rv, request_rec *r, X509 *cert, const char *format,...) __attribute__((format(printf
void ssl_callback_DelSessionCacheEntry(SSL_CTX *, SSL_SESSION *)
apr_status_t ssl_init_Engine(server_rec *, apr_pool_t *)
const char * ssl_cmd_SSLOCSPUseRequestNonce(cmd_parms *cmd, void *dcfg, int flag)
void * ssl_config_perdir_create(apr_pool_t *, char *)
const authz_provider ssl_authz_provider_verify_client
void ssl_util_thread_setup(apr_pool_t *)
const char * ssl_cmd_SSLCertificateKeyFile(cmd_parms *, void *, const char *)
const char * ssl_cmd_SSLProxyCheckPeerExpire(cmd_parms *cmd, void *dcfg, int flag)
apr_status_t ssl_init_ConfigureServer(server_rec *, apr_pool_t *, apr_pool_t *, SSLSrvConfigRec *, apr_array_header_t *)
int ssl_hook_UserCheck(request_rec *)
int ssl_hook_Access(request_rec *)
const char * ssl_cmd_SSLCertificateFile(cmd_parms *, void *, const char *)
ssl_pphrase_t
Definition: ssl_private.h:489
const char * ssl_cmd_SSLOptions(cmd_parms *, void *, const char *)
int ssl_mutex_init(server_rec *, apr_pool_t *)
void modssl_var_extract_dns(apr_table_t *t, SSL *ssl, apr_pool_t *p)
const char * ssl_cmd_SSLProxyCheckPeerCN(cmd_parms *cmd, void *dcfg, int flag)
void ssl_init_Child(apr_pool_t *, server_rec *)
#define BOOL
Definition: ssl_private.h:81
APLOG_USE_MODULE(ssl)
int ssl_io_buffer_fill(request_rec *r, apr_size_t maxlen)
void * ssl_config_server_merge(apr_pool_t *, void *, void *)
apr_file_t * ssl_util_ppopen(server_rec *, apr_pool_t *, const char *, const char *const *)
const char * ssl_cmd_SSLProxyVerifyDepth(cmd_parms *, void *, const char *)
int ssl_mutex_reinit(server_rec *, apr_pool_t *)
const char * ssl_cmd_SSLPolicyApply(cmd_parms *, void *, const char *)
int ssl_callback_proxy_cert(SSL *ssl, X509 **x509, EVP_PKEY **pkey)
int ssl_mutex_on(server_rec *)
ssl_shutdown_type_e
Definition: ssl_private.h:570
ssl_asn1_t * ssl_asn1_table_set(apr_hash_t *table, const char *key, EVP_PKEY *pkey)
const char * ssl_cmd_SSLProxyCipherSuite(cmd_parms *, void *, const char *, const char *)
void ssl_var_register(apr_pool_t *p)
const char * ssl_cmd_SSLOCSPProxyURL(cmd_parms *cmd, void *dcfg, const char *arg)
void ssl_init_ocsp_certificates(server_rec *s, modssl_ctx_t *mctx)
void ssl_hook_ConfigTest(apr_pool_t *pconf, server_rec *s)
void modssl_var_extract_san_entries(apr_table_t *t, SSL *ssl, apr_pool_t *p)
void ssl_config_global_fix(SSLModConfigRec *)
OCSP_RESPONSE * modssl_dispatch_ocsp_request(const apr_uri_t *uri, apr_interval_time_t timeout, OCSP_REQUEST *request, conn_rec *c, apr_pool_t *p)
void ssl_util_ppclose(server_rec *, apr_pool_t *, apr_file_t *)
int ssl_callback_SSLVerify(int, X509_STORE_CTX *)
@ RENEG_INIT
Definition: ssl_private.h:553
@ RENEG_ALLOW
Definition: ssl_private.h:556
@ RENEG_ABORT
Definition: ssl_private.h:558
@ RENEG_REJECT
Definition: ssl_private.h:554
@ SSL_OCSPCHECK_CHAIN
Definition: ssl_private.h:482
@ SSL_OCSPCHECK_LEAF
Definition: ssl_private.h:481
@ SSL_OCSPCHECK_NONE
Definition: ssl_private.h:480
@ SSL_OCSPCHECK_NO_OCSP_FOR_CERT_OK
Definition: ssl_private.h:483
@ SSL_ENABLED_TRUE
Definition: ssl_private.h:511
@ SSL_ENABLED_UNSET
Definition: ssl_private.h:509
@ SSL_ENABLED_FALSE
Definition: ssl_private.h:510
@ SSL_ENABLED_OPTIONAL
Definition: ssl_private.h:512
@ SSL_RSCTX_CONNECT
Definition: ssl_private.h:528
@ SSL_RSCTX_STARTUP
Definition: ssl_private.h:527
@ SSL_CVERIFY_OPTIONAL
Definition: ssl_private.h:449
@ SSL_CVERIFY_OPTIONAL_NO_CA
Definition: ssl_private.h:451
@ SSL_CVERIFY_UNSET
Definition: ssl_private.h:447
@ SSL_CVERIFY_NONE
Definition: ssl_private.h:448
@ SSL_CVERIFY_REQUIRE
Definition: ssl_private.h:450
@ SSL_CRLCHECK_NO_CRL_FOR_CERT_OK
Definition: ssl_private.h:473
@ SSL_CRLCHECK_LEAF
Definition: ssl_private.h:469
@ SSL_CRLCHECK_NONE
Definition: ssl_private.h:468
@ SSL_CRLCHECK_CHAIN
Definition: ssl_private.h:470
@ SSL_RSSRC_EGD
Definition: ssl_private.h:534
@ SSL_RSSRC_BUILTIN
Definition: ssl_private.h:531
@ SSL_RSSRC_FILE
Definition: ssl_private.h:532
@ SSL_RSSRC_EXEC
Definition: ssl_private.h:533
@ SSL_PPTYPE_PIPE
Definition: ssl_private.h:493
@ SSL_PPTYPE_BUILTIN
Definition: ssl_private.h:491
@ SSL_PPTYPE_FILTER
Definition: ssl_private.h:492
@ SSL_PPTYPE_UNSET
Definition: ssl_private.h:490
@ SSL_SHUTDOWN_TYPE_STANDARD
Definition: ssl_private.h:572
@ SSL_SHUTDOWN_TYPE_UNCLEAN
Definition: ssl_private.h:573
@ SSL_SHUTDOWN_TYPE_ACCURATE
Definition: ssl_private.h:574
@ SSL_SHUTDOWN_TYPE_UNSET
Definition: ssl_private.h:571
AP_FN_ATTR_NONNULL((1, 2, 5)) AP_FN_ATTR_WARN_UNUSED_RESULT
int apr_status_t
Definition: apr_errno.h:44
struct apr_hash_t apr_hash_t
Definition: apr_hash.h:52
#define __attribute__(__x)
Definition: apr.h:63
size_t apr_size_t
Definition: apr.h:394
struct apr_pool_t apr_pool_t
Definition: apr_pools.h:60
struct apr_table_t apr_table_t
Definition: apr_tables.h:56
apr_int64_t apr_interval_time_t
Definition: apr_time.h:55
apr_int64_t apr_time_t
Definition: apr_time.h:45
Apache Configuration.
Apache connection library.
CORE HTTP Daemon.
Apache Logging library.
Command line options.
HTTP protocol handling.
Apache Request library.
SSL protocol handling.
Virtual Host package.
HTTP Daemon routines.
#define STACK_OF(x)
Definition: macros.h:26
#define AP_MODULE_DECLARE_DATA
Definition: macros.h:16
Authentication and Authorization Extension for Apache.
Interface to OpenSSL-specific APIs provided by mod_ssl.
#define SSL_CRLCHECK_FLAGS
Definition: ssl_private.h:472
Additional Utility Functions for OpenSSL.
Definition: ssl_private.h:577
int service_unavailable
Definition: ssl_private.h:605
modssl_reneg_state reneg_state
Definition: ssl_private.h:598
const char * verify_error
Definition: ssl_private.h:583
const char * verify_info
Definition: ssl_private.h:582
const char * client_dn
Definition: ssl_private.h:579
int disabled
Definition: ssl_private.h:585
@ NON_SSL_SEND_REQLINE
Definition: ssl_private.h:588
@ NON_SSL_SEND_HDR_SEP
Definition: ssl_private.h:589
ssl_shutdown_type_e shutdown_type
Definition: ssl_private.h:581
int verify_depth
Definition: ssl_private.h:584
SSLDirConfigRec * dc
Definition: ssl_private.h:602
X509 * client_cert
Definition: ssl_private.h:580
int vhost_found
Definition: ssl_private.h:606
server_rec * server
Definition: ssl_private.h:601
SSL * ssl
Definition: ssl_private.h:578
const char * cipher_suite
Definition: ssl_private.h:604
Definition: ssl_private.h:847
BOOL bSSLRequired
Definition: ssl_private.h:848
ssl_verify_t nVerifyClient
Definition: ssl_private.h:854
ssl_opt_t nOptionsAdd
Definition: ssl_private.h:851
const char * szCipherSuite
Definition: ssl_private.h:853
ssl_opt_t nOptions
Definition: ssl_private.h:850
apr_size_t nRenegBufferSize
Definition: ssl_private.h:857
int nVerifyDepth
Definition: ssl_private.h:855
BOOL proxy_enabled
Definition: ssl_private.h:860
BOOL proxy_post_config
Definition: ssl_private.h:861
apr_array_header_t * aRequirement
Definition: ssl_private.h:849
ssl_opt_t nOptionsDel
Definition: ssl_private.h:852
modssl_ctx_t * proxy
Definition: ssl_private.h:859
const char * szUserName
Definition: ssl_private.h:856
Definition: ssl_private.h:640
apr_array_header_t * aRandSeed
Definition: ssl_private.h:658
pid_t pid
Definition: ssl_private.h:657
ap_socache_instance_t * sesscache_context
Definition: ssl_private.h:652
apr_global_mutex_t * pMutex
Definition: ssl_private.h:654
BOOL bFixed
Definition: ssl_private.h:641
modssl_retained_data_t * retained
Definition: ssl_private.h:647
long sesscache_mode
Definition: ssl_private.h:644
const ap_socache_provider_t * sesscache
Definition: ssl_private.h:651
Definition: ssl_private.h:823
const char * vhost_id
Definition: ssl_private.h:826
BOOL insecure_reneg
Definition: ssl_private.h:830
const unsigned char * vhost_md5
Definition: ssl_private.h:827
SSLModConfigRec * mc
Definition: ssl_private.h:824
modssl_ctx_t * server
Definition: ssl_private.h:831
ssl_enabled_t enabled
Definition: ssl_private.h:825
BOOL cipher_server_pref
Definition: ssl_private.h:829
BOOL session_tickets
Definition: ssl_private.h:838
BOOL compression
Definition: ssl_private.h:836
int session_cache_timeout
Definition: ssl_private.h:828
Definition: ap_expr.h:41
Definition: ap_socache.h:89
Definition: apr_tables.h:62
Definition: apr_arch_file_io.h:107
Definition: apr_arch_global_mutex.h:23
Definition: apr_uri.h:85
Definition: mod_auth.h:141
Definition: http_config.h:288
Structure to store things which are per connection.
Definition: httpd.h:1193
Definition: ssl_private.h:713
ssl_verify_t verify_mode
Definition: ssl_private.h:722
const char * cipher_suite
Definition: ssl_private.h:718
const char * ca_cert_file
Definition: ssl_private.h:716
int verify_depth
Definition: ssl_private.h:721
const char * ca_cert_path
Definition: ssl_private.h:715
const char * tls13_ciphers
Definition: ssl_private.h:727
Definition: ssl_private.h:750
long ocsp_resp_maxage
Definition: ssl_private.h:802
int crl_check_mask
Definition: ssl_private.h:774
ssl_pphrase_t pphrase_dialog_type
Definition: ssl_private.h:766
BOOL ocsp_force_default
Definition: ssl_private.h:798
const char * ocsp_responder
Definition: ssl_private.h:800
int ocsp_mask
Definition: ssl_private.h:797
ssl_proto_t protocol
Definition: ssl_private.h:762
SSLSrvConfigRec * sc
Definition: ssl_private.h:751
modssl_auth_ctx_t auth
Definition: ssl_private.h:795
SSL_CTX * ssl_ctx
Definition: ssl_private.h:752
long ocsp_resptime_skew
Definition: ssl_private.h:801
BOOL ssl_check_peer_name
Definition: ssl_private.h:819
int protocol_set
Definition: ssl_private.h:763
const char * crl_path
Definition: ssl_private.h:772
STACK_OF(X509) *ocsp_certs
BOOL ssl_check_peer_cn
Definition: ssl_private.h:818
int ocsp_verify_flags
Definition: ssl_private.h:809
BOOL ocsp_use_request_nonce
Definition: ssl_private.h:804
const char * pphrase_dialog_path
Definition: ssl_private.h:767
BOOL ocsp_noverify
Definition: ssl_private.h:807
const char * ocsp_certs_file
Definition: ssl_private.h:810
modssl_pk_proxy_t * pkp
Definition: ssl_private.h:756
modssl_pk_server_t * pks
Definition: ssl_private.h:755
BOOL ssl_check_peer_expire
Definition: ssl_private.h:820
const char * crl_file
Definition: ssl_private.h:773
const char * cert_chain
Definition: ssl_private.h:769
apr_interval_time_t ocsp_responder_timeout
Definition: ssl_private.h:803
apr_uri_t * proxy_uri
Definition: ssl_private.h:805
Definition: ssl_private.h:698
const char * cert_file
Definition: ssl_private.h:700
const char * ca_cert_file
Definition: ssl_private.h:702
STACK_OF(X509_INFO) *certs
const char * cert_path
Definition: ssl_private.h:701
STACK_OF(X509) **ca_certs
Definition: ssl_private.h:684
apr_array_header_t * key_files
Definition: ssl_private.h:687
apr_array_header_t * cert_files
Definition: ssl_private.h:686
int service_unavailable
Definition: ssl_private.h:695
const char * ca_name_path
Definition: ssl_private.h:691
const char * ca_name_file
Definition: ssl_private.h:692
Definition: ssl_private.h:621
apr_hash_t * key_ids
Definition: ssl_private.h:629
apr_hash_t * privkeys
Definition: ssl_private.h:635
Definition: http_config.h:348
A structure that represents the current request.
Definition: httpd.h:856
A structure to store information for each virtual server.
Definition: httpd.h:1382
Definition: ssl_private.h:546
apr_time_t source_mtime
Definition: ssl_private.h:549
long int nData
Definition: ssl_private.h:547
unsigned char * cpData
Definition: ssl_private.h:548
Definition: ssl_private.h:536
char * cpPath
Definition: ssl_private.h:539
int nBytes
Definition: ssl_private.h:540
ssl_rssrc_t nSrc
Definition: ssl_private.h:538
ssl_rsctx_t nCtx
Definition: ssl_private.h:537
Definition: ssl_private.h:518
const char * cpExpr
Definition: ssl_private.h:519
ap_expr_info_t * mpExpr
Definition: ssl_private.h:520
apr_pool_t * p
Utilities for EBCDIC conversion.
Apache filter library.
Apache Mutex support library.
Apache script tools.