|
Packit |
90a5c9 |
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
Packit |
90a5c9 |
* contributor license agreements. See the NOTICE file distributed with
|
|
Packit |
90a5c9 |
* this work for additional information regarding copyright ownership.
|
|
Packit |
90a5c9 |
* The ASF licenses this file to You under the Apache License, Version 2.0
|
|
Packit |
90a5c9 |
* (the "License"); you may not use this file except in compliance with
|
|
Packit |
90a5c9 |
* the License. You may obtain a copy of the License at
|
|
Packit |
90a5c9 |
*
|
|
Packit |
90a5c9 |
* http://www.apache.org/licenses/LICENSE-2.0
|
|
Packit |
90a5c9 |
*
|
|
Packit |
90a5c9 |
* Unless required by applicable law or agreed to in writing, software
|
|
Packit |
90a5c9 |
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
Packit |
90a5c9 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
Packit |
90a5c9 |
* See the License for the specific language governing permissions and
|
|
Packit |
90a5c9 |
* limitations under the License.
|
|
Packit |
90a5c9 |
*/
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#ifndef SSL_PRIVATE_H
|
|
Packit |
90a5c9 |
#define SSL_PRIVATE_H
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/**
|
|
Packit |
90a5c9 |
* @file ssl_private.h
|
|
Packit |
90a5c9 |
* @brief Internal interfaces private to mod_ssl.
|
|
Packit |
90a5c9 |
*
|
|
Packit |
90a5c9 |
* @defgroup MOD_SSL_PRIVATE Private
|
|
Packit |
90a5c9 |
* @ingroup MOD_SSL
|
|
Packit |
90a5c9 |
* @{
|
|
Packit |
90a5c9 |
*/
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/** Apache headers */
|
|
Packit |
90a5c9 |
#include "httpd.h"
|
|
Packit |
90a5c9 |
#include "http_config.h"
|
|
Packit |
90a5c9 |
#include "http_core.h"
|
|
Packit |
90a5c9 |
#include "http_log.h"
|
|
Packit |
90a5c9 |
#include "http_main.h"
|
|
Packit |
90a5c9 |
#include "http_connection.h"
|
|
Packit |
90a5c9 |
#include "http_request.h"
|
|
Packit |
90a5c9 |
#include "http_protocol.h"
|
|
Packit |
90a5c9 |
#include "http_vhost.h"
|
|
Packit |
90a5c9 |
#include "util_script.h"
|
|
Packit |
90a5c9 |
#include "util_filter.h"
|
|
Packit |
90a5c9 |
#include "util_ebcdic.h"
|
|
Packit |
90a5c9 |
#include "util_mutex.h"
|
|
Packit |
90a5c9 |
#include "apr.h"
|
|
Packit |
90a5c9 |
#include "apr_strings.h"
|
|
Packit |
90a5c9 |
#define APR_WANT_STRFUNC
|
|
Packit |
90a5c9 |
#define APR_WANT_MEMFUNC
|
|
Packit |
90a5c9 |
#include "apr_want.h"
|
|
Packit |
90a5c9 |
#include "apr_tables.h"
|
|
Packit |
90a5c9 |
#include "apr_lib.h"
|
|
Packit |
90a5c9 |
#include "apr_fnmatch.h"
|
|
Packit |
90a5c9 |
#include "apr_strings.h"
|
|
Packit |
90a5c9 |
#include "apr_global_mutex.h"
|
|
Packit |
90a5c9 |
#include "apr_optional.h"
|
|
Packit |
90a5c9 |
#include "ap_socache.h"
|
|
Packit |
90a5c9 |
#include "mod_auth.h"
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/* The #ifdef macros are only defined AFTER including the above
|
|
Packit |
90a5c9 |
* therefore we cannot include these system files at the top :-(
|
|
Packit |
90a5c9 |
*/
|
|
Packit |
90a5c9 |
#if APR_HAVE_STDLIB_H
|
|
Packit |
90a5c9 |
#include <stdlib.h>
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
#if APR_HAVE_SYS_TIME_H
|
|
Packit |
90a5c9 |
#include <sys/time.h>
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
#if APR_HAVE_UNISTD_H
|
|
Packit |
90a5c9 |
#include <unistd.h> /* needed for STDIN_FILENO et.al., at least on FreeBSD */
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#ifndef FALSE
|
|
Packit |
90a5c9 |
#define FALSE 0
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#ifndef TRUE
|
|
Packit |
90a5c9 |
#define TRUE !FALSE
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#ifndef BOOL
|
|
Packit |
90a5c9 |
#define BOOL unsigned int
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#include "ap_expr.h"
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/* OpenSSL headers */
|
|
Packit |
90a5c9 |
#include <openssl/opensslv.h>
|
|
Packit |
90a5c9 |
#if (OPENSSL_VERSION_NUMBER >= 0x10001000)
|
|
Packit |
90a5c9 |
/* must be defined before including ssl.h */
|
|
Packit |
90a5c9 |
#define OPENSSL_NO_SSL_INTERN
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
#include <openssl/ssl.h>
|
|
Packit |
90a5c9 |
#include <openssl/err.h>
|
|
Packit |
90a5c9 |
#include <openssl/x509.h>
|
|
Packit |
90a5c9 |
#include <openssl/pem.h>
|
|
Packit |
90a5c9 |
#include <openssl/crypto.h>
|
|
Packit |
90a5c9 |
#include <openssl/evp.h>
|
|
Packit |
90a5c9 |
#include <openssl/rand.h>
|
|
Packit |
90a5c9 |
#include <openssl/x509v3.h>
|
|
Packit |
90a5c9 |
#include <openssl/x509_vfy.h>
|
|
Packit |
90a5c9 |
#include <openssl/ocsp.h>
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/* Avoid tripping over an engine build installed globally and detected
|
|
Packit |
90a5c9 |
* when the user points at an explicit non-engine flavor of OpenSSL
|
|
Packit |
90a5c9 |
*/
|
|
Packit |
90a5c9 |
#if defined(HAVE_OPENSSL_ENGINE_H) && defined(HAVE_ENGINE_INIT)
|
|
Packit |
90a5c9 |
#include <openssl/engine.h>
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#if (OPENSSL_VERSION_NUMBER < 0x0090801f)
|
|
Packit |
90a5c9 |
#error mod_ssl requires OpenSSL 0.9.8a or later
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/**
|
|
Packit |
90a5c9 |
* ...shifting sands of OpenSSL...
|
|
Packit |
90a5c9 |
* Note: when adding support for new OpenSSL features, avoid explicit
|
|
Packit |
90a5c9 |
* version number checks whenever possible, and use "feature-based"
|
|
Packit |
90a5c9 |
* detection instead (check for definitions of constants or functions)
|
|
Packit |
90a5c9 |
*/
|
|
Packit |
90a5c9 |
#if (OPENSSL_VERSION_NUMBER >= 0x10000000)
|
|
Packit |
90a5c9 |
#define MODSSL_SSL_CIPHER_CONST const
|
|
Packit |
90a5c9 |
#define MODSSL_SSL_METHOD_CONST const
|
|
Packit |
90a5c9 |
#else
|
|
Packit |
90a5c9 |
#define MODSSL_SSL_CIPHER_CONST
|
|
Packit |
90a5c9 |
#define MODSSL_SSL_METHOD_CONST
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#if defined(LIBRESSL_VERSION_NUMBER)
|
|
Packit |
90a5c9 |
/* Missing from LibreSSL */
|
|
Packit |
90a5c9 |
#if LIBRESSL_VERSION_NUMBER < 0x2060000f
|
|
Packit |
90a5c9 |
#define SSL_CTRL_SET_MIN_PROTO_VERSION 123
|
|
Packit |
90a5c9 |
#define SSL_CTRL_SET_MAX_PROTO_VERSION 124
|
|
Packit |
90a5c9 |
#define SSL_CTX_set_min_proto_version(ctx, version) \
|
|
Packit |
90a5c9 |
SSL_CTX_ctrl(ctx, SSL_CTRL_SET_MIN_PROTO_VERSION, version, NULL)
|
|
Packit |
90a5c9 |
#define SSL_CTX_set_max_proto_version(ctx, version) \
|
|
Packit |
90a5c9 |
SSL_CTX_ctrl(ctx, SSL_CTRL_SET_MAX_PROTO_VERSION, version, NULL)
|
|
Packit |
90a5c9 |
#elif LIBRESSL_VERSION_NUMBER < 0x2070000f
|
|
Packit |
90a5c9 |
/* LibreSSL before 2.7 declares OPENSSL_VERSION_NUMBER == 2.0 but does not
|
|
Packit |
90a5c9 |
* include most changes from OpenSSL >= 1.1 (new functions, macros,
|
|
Packit |
90a5c9 |
* deprecations, ...), so we have to work around this...
|
|
Packit |
90a5c9 |
*/
|
|
Packit |
90a5c9 |
#define MODSSL_USE_OPENSSL_PRE_1_1_API (1)
|
|
Packit |
90a5c9 |
#endif /* LIBRESSL_VERSION_NUMBER < 0x2060000f */
|
|
Packit |
90a5c9 |
#else /* defined(LIBRESSL_VERSION_NUMBER) */
|
|
Packit |
90a5c9 |
#define MODSSL_USE_OPENSSL_PRE_1_1_API (OPENSSL_VERSION_NUMBER < 0x10100000L)
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#if defined(OPENSSL_FIPS)
|
|
Packit |
90a5c9 |
#define HAVE_FIPS
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#if defined(SSL_OP_NO_TLSv1_2)
|
|
Packit |
90a5c9 |
#define HAVE_TLSV1_X
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#if defined(SSL_CONF_FLAG_FILE)
|
|
Packit |
90a5c9 |
#define HAVE_SSL_CONF_CMD
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/* session id constness */
|
|
Packit |
90a5c9 |
#if MODSSL_USE_OPENSSL_PRE_1_1_API
|
|
Packit |
90a5c9 |
#define IDCONST
|
|
Packit |
90a5c9 |
#else
|
|
Packit |
90a5c9 |
#define IDCONST const
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/**
|
|
Packit |
90a5c9 |
* The following features all depend on TLS extension support.
|
|
Packit |
90a5c9 |
* Within this block, check again for features (not version numbers).
|
|
Packit |
90a5c9 |
*/
|
|
Packit |
90a5c9 |
#if !defined(OPENSSL_NO_TLSEXT) && defined(SSL_set_tlsext_host_name)
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#define HAVE_TLSEXT
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/* ECC: make sure we have at least 1.0.0 */
|
|
Packit |
90a5c9 |
#if !defined(OPENSSL_NO_EC) && defined(TLSEXT_ECPOINTFORMAT_uncompressed)
|
|
Packit |
90a5c9 |
#define HAVE_ECC
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/* OCSP stapling */
|
|
Packit |
90a5c9 |
#if !defined(OPENSSL_NO_OCSP) && defined(SSL_CTX_set_tlsext_status_cb)
|
|
Packit |
90a5c9 |
#define HAVE_OCSP_STAPLING
|
|
Packit |
90a5c9 |
/* All exist but are no longer macros since OpenSSL 1.1.0 */
|
|
Packit |
90a5c9 |
#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
|
Packit |
90a5c9 |
/* backward compatibility with OpenSSL < 1.0 */
|
|
Packit |
90a5c9 |
#ifndef sk_OPENSSL_STRING_num
|
|
Packit |
90a5c9 |
#define sk_OPENSSL_STRING_num sk_num
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
#ifndef sk_OPENSSL_STRING_value
|
|
Packit |
90a5c9 |
#define sk_OPENSSL_STRING_value sk_value
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
#ifndef sk_OPENSSL_STRING_pop
|
|
Packit |
90a5c9 |
#define sk_OPENSSL_STRING_pop sk_pop
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
#endif /* if OPENSSL_VERSION_NUMBER < 0x10100000L */
|
|
Packit |
90a5c9 |
#endif /* if !defined(OPENSSL_NO_OCSP) && defined(SSL_CTX_set_tlsext_status_cb) */
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/* TLS session tickets */
|
|
Packit |
90a5c9 |
#if defined(SSL_CTX_set_tlsext_ticket_key_cb)
|
|
Packit |
90a5c9 |
#define HAVE_TLS_SESSION_TICKETS
|
|
Packit |
90a5c9 |
#define TLSEXT_TICKET_KEY_LEN 48
|
|
Packit |
90a5c9 |
#ifndef tlsext_tick_md
|
|
Packit |
90a5c9 |
#ifdef OPENSSL_NO_SHA256
|
|
Packit |
90a5c9 |
#define tlsext_tick_md EVP_sha1
|
|
Packit |
90a5c9 |
#else
|
|
Packit |
90a5c9 |
#define tlsext_tick_md EVP_sha256
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/* Secure Remote Password */
|
|
Packit |
90a5c9 |
#if !defined(OPENSSL_NO_SRP) && defined(SSL_CTRL_SET_TLS_EXT_SRP_USERNAME_CB)
|
|
Packit |
90a5c9 |
#define HAVE_SRP
|
|
Packit |
90a5c9 |
#include <openssl/srp.h>
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/* ALPN Protocol Negotiation */
|
|
Packit |
90a5c9 |
#if defined(TLSEXT_TYPE_application_layer_protocol_negotiation)
|
|
Packit |
90a5c9 |
#define HAVE_TLS_ALPN
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#endif /* !defined(OPENSSL_NO_TLSEXT) && defined(SSL_set_tlsext_host_name) */
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#if MODSSL_USE_OPENSSL_PRE_1_1_API
|
|
Packit |
90a5c9 |
#define BN_get_rfc2409_prime_768 get_rfc2409_prime_768
|
|
Packit |
90a5c9 |
#define BN_get_rfc2409_prime_1024 get_rfc2409_prime_1024
|
|
Packit |
90a5c9 |
#define BN_get_rfc3526_prime_1536 get_rfc3526_prime_1536
|
|
Packit |
90a5c9 |
#define BN_get_rfc3526_prime_2048 get_rfc3526_prime_2048
|
|
Packit |
90a5c9 |
#define BN_get_rfc3526_prime_3072 get_rfc3526_prime_3072
|
|
Packit |
90a5c9 |
#define BN_get_rfc3526_prime_4096 get_rfc3526_prime_4096
|
|
Packit |
90a5c9 |
#define BN_get_rfc3526_prime_6144 get_rfc3526_prime_6144
|
|
Packit |
90a5c9 |
#define BN_get_rfc3526_prime_8192 get_rfc3526_prime_8192
|
|
Packit |
90a5c9 |
#define BIO_set_init(x,v) (x->init=v)
|
|
Packit |
90a5c9 |
#define BIO_get_data(x) (x->ptr)
|
|
Packit |
90a5c9 |
#define BIO_set_data(x,v) (x->ptr=v)
|
|
Packit |
90a5c9 |
#define BIO_get_shutdown(x) (x->shutdown)
|
|
Packit |
90a5c9 |
#define BIO_set_shutdown(x,v) (x->shutdown=v)
|
|
Packit |
90a5c9 |
#define DH_bits(x) (BN_num_bits(x->p))
|
|
Packit |
90a5c9 |
#else
|
|
Packit |
90a5c9 |
void init_bio_methods(void);
|
|
Packit |
90a5c9 |
void free_bio_methods(void);
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#if OPENSSL_VERSION_NUMBER < 0x10002000L || \
|
|
Packit |
90a5c9 |
(defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x2070000f)
|
|
Packit |
90a5c9 |
#define X509_STORE_CTX_get0_store(x) (x->ctx)
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#if OPENSSL_VERSION_NUMBER < 0x10000000L
|
|
Packit |
90a5c9 |
#ifndef X509_STORE_CTX_get0_current_issuer
|
|
Packit |
90a5c9 |
#define X509_STORE_CTX_get0_current_issuer(x) (x->current_issuer)
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
|
|
Packit |
003d89 |
#if OPENSSL_VERSION_NUMBER >= 0x10101000L && !defined(LIBRESSL_VERSION_NUMBER)
|
|
Packit |
003d89 |
#define HAVE_OPENSSL_KEYLOG
|
|
Packit |
003d89 |
#endif
|
|
Packit |
003d89 |
|
|
Packit |
90a5c9 |
/* mod_ssl headers */
|
|
Packit |
90a5c9 |
#include "ssl_util_ssl.h"
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
APLOG_USE_MODULE(ssl);
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/*
|
|
Packit |
90a5c9 |
* Provide reasonable default for some defines
|
|
Packit |
90a5c9 |
*/
|
|
Packit |
90a5c9 |
#ifndef PFALSE
|
|
Packit |
90a5c9 |
#define PFALSE ((void *)FALSE)
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
#ifndef PTRUE
|
|
Packit |
90a5c9 |
#define PTRUE ((void *)TRUE)
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
#ifndef UNSET
|
|
Packit |
90a5c9 |
#define UNSET (-1)
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
#ifndef NUL
|
|
Packit |
90a5c9 |
#define NUL '\0'
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
#ifndef RAND_MAX
|
|
Packit |
90a5c9 |
#include <limits.h>
|
|
Packit |
90a5c9 |
#define RAND_MAX INT_MAX
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/**
|
|
Packit |
90a5c9 |
* Provide reasonable defines for some types
|
|
Packit |
90a5c9 |
*/
|
|
Packit |
90a5c9 |
#ifndef UCHAR
|
|
Packit |
90a5c9 |
#define UCHAR unsigned char
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/**
|
|
Packit |
90a5c9 |
* Provide useful shorthands
|
|
Packit |
90a5c9 |
*/
|
|
Packit |
90a5c9 |
#define strEQ(s1,s2) (strcmp(s1,s2) == 0)
|
|
Packit |
90a5c9 |
#define strNE(s1,s2) (strcmp(s1,s2) != 0)
|
|
Packit |
90a5c9 |
#define strEQn(s1,s2,n) (strncmp(s1,s2,n) == 0)
|
|
Packit |
90a5c9 |
#define strNEn(s1,s2,n) (strncmp(s1,s2,n) != 0)
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#define strcEQ(s1,s2) (strcasecmp(s1,s2) == 0)
|
|
Packit |
90a5c9 |
#define strcNE(s1,s2) (strcasecmp(s1,s2) != 0)
|
|
Packit |
90a5c9 |
#define strcEQn(s1,s2,n) (strncasecmp(s1,s2,n) == 0)
|
|
Packit |
90a5c9 |
#define strcNEn(s1,s2,n) (strncasecmp(s1,s2,n) != 0)
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#define strIsEmpty(s) (s == NULL || s[0] == NUL)
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#define myConnConfig(c) \
|
|
Packit |
90a5c9 |
((SSLConnRec *)ap_get_module_config(c->conn_config, &ssl_module))
|
|
Packit |
90a5c9 |
#define myConnConfigSet(c, val) \
|
|
Packit |
90a5c9 |
ap_set_module_config(c->conn_config, &ssl_module, val)
|
|
Packit |
90a5c9 |
#define mySrvConfig(srv) \
|
|
Packit |
90a5c9 |
((SSLSrvConfigRec *)ap_get_module_config(srv->module_config, &ssl_module))
|
|
Packit |
90a5c9 |
#define myDirConfig(req) \
|
|
Packit |
90a5c9 |
((SSLDirConfigRec *)ap_get_module_config(req->per_dir_config, &ssl_module))
|
|
Packit |
90a5c9 |
#define myCtxConfig(sslconn, sc) \
|
|
Packit |
90a5c9 |
(sslconn->is_proxy ? sslconn->dc->proxy : sc->server)
|
|
Packit |
90a5c9 |
#define myModConfig(srv) mySrvConfig((srv))->mc
|
|
Packit |
90a5c9 |
#define mySrvFromConn(c) myConnConfig(c)->server
|
|
Packit |
90a5c9 |
#define myDirConfigFromConn(c) myConnConfig(c)->dc
|
|
Packit |
90a5c9 |
#define mySrvConfigFromConn(c) mySrvConfig(mySrvFromConn(c))
|
|
Packit |
90a5c9 |
#define myModConfigFromConn(c) myModConfig(mySrvFromConn(c))
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/**
|
|
Packit |
90a5c9 |
* Defaults for the configuration
|
|
Packit |
90a5c9 |
*/
|
|
Packit |
90a5c9 |
#ifndef SSL_SESSION_CACHE_TIMEOUT
|
|
Packit |
90a5c9 |
#define SSL_SESSION_CACHE_TIMEOUT 300
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/* Default setting for per-dir reneg buffer. */
|
|
Packit |
90a5c9 |
#ifndef DEFAULT_RENEG_BUFFER_SIZE
|
|
Packit |
90a5c9 |
#define DEFAULT_RENEG_BUFFER_SIZE (128 * 1024)
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/* Default for OCSP response validity */
|
|
Packit |
90a5c9 |
#ifndef DEFAULT_OCSP_MAX_SKEW
|
|
Packit |
90a5c9 |
#define DEFAULT_OCSP_MAX_SKEW (60 * 5)
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/* Default timeout for OCSP queries */
|
|
Packit |
90a5c9 |
#ifndef DEFAULT_OCSP_TIMEOUT
|
|
Packit |
90a5c9 |
#define DEFAULT_OCSP_TIMEOUT 10
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/*
|
|
Packit |
90a5c9 |
* For better backwards compatibility with the SSLCertificate[Key]File
|
|
Packit |
90a5c9 |
* and SSLPassPhraseDialog ("exec" type) directives in 2.4.7 and earlier
|
|
Packit |
90a5c9 |
*/
|
|
Packit |
90a5c9 |
#ifdef HAVE_ECC
|
|
Packit |
90a5c9 |
#define CERTKEYS_IDX_MAX 2
|
|
Packit |
90a5c9 |
#else
|
|
Packit |
90a5c9 |
#define CERTKEYS_IDX_MAX 1
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/**
|
|
Packit |
90a5c9 |
* Define the SSL options
|
|
Packit |
90a5c9 |
*/
|
|
Packit |
90a5c9 |
#define SSL_OPT_NONE (0)
|
|
Packit |
90a5c9 |
#define SSL_OPT_RELSET (1<<0)
|
|
Packit |
90a5c9 |
#define SSL_OPT_STDENVVARS (1<<1)
|
|
Packit |
90a5c9 |
#define SSL_OPT_EXPORTCERTDATA (1<<3)
|
|
Packit |
90a5c9 |
#define SSL_OPT_FAKEBASICAUTH (1<<4)
|
|
Packit |
90a5c9 |
#define SSL_OPT_STRICTREQUIRE (1<<5)
|
|
Packit |
90a5c9 |
#define SSL_OPT_OPTRENEGOTIATE (1<<6)
|
|
Packit |
90a5c9 |
#define SSL_OPT_LEGACYDNFORMAT (1<<7)
|
|
Packit |
90a5c9 |
typedef int ssl_opt_t;
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/**
|
|
Packit |
90a5c9 |
* Define the SSL Protocol options
|
|
Packit |
90a5c9 |
*/
|
|
Packit |
90a5c9 |
#define SSL_PROTOCOL_NONE (0)
|
|
Packit |
90a5c9 |
#ifndef OPENSSL_NO_SSL3
|
|
Packit |
90a5c9 |
#define SSL_PROTOCOL_SSLV3 (1<<1)
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
#define SSL_PROTOCOL_TLSV1 (1<<2)
|
|
Packit |
90a5c9 |
#ifndef OPENSSL_NO_SSL3
|
|
Packit |
90a5c9 |
#define SSL_PROTOCOL_BASIC (SSL_PROTOCOL_SSLV3|SSL_PROTOCOL_TLSV1)
|
|
Packit |
90a5c9 |
#else
|
|
Packit |
90a5c9 |
#define SSL_PROTOCOL_BASIC (SSL_PROTOCOL_TLSV1)
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
#ifdef HAVE_TLSV1_X
|
|
Packit |
90a5c9 |
#define SSL_PROTOCOL_TLSV1_1 (1<<3)
|
|
Packit |
90a5c9 |
#define SSL_PROTOCOL_TLSV1_2 (1<<4)
|
|
Packit |
90a5c9 |
#define SSL_PROTOCOL_TLSV1_3 (1<<5)
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#ifdef SSL_OP_NO_TLSv1_3
|
|
Packit |
90a5c9 |
#define SSL_HAVE_PROTOCOL_TLSV1_3 (1)
|
|
Packit |
90a5c9 |
#define SSL_PROTOCOL_ALL (SSL_PROTOCOL_BASIC| \
|
|
Packit |
90a5c9 |
SSL_PROTOCOL_TLSV1_1|SSL_PROTOCOL_TLSV1_2|SSL_PROTOCOL_TLSV1_3)
|
|
Packit |
90a5c9 |
#else
|
|
Packit |
90a5c9 |
#define SSL_HAVE_PROTOCOL_TLSV1_3 (0)
|
|
Packit |
90a5c9 |
#define SSL_PROTOCOL_ALL (SSL_PROTOCOL_BASIC| \
|
|
Packit |
90a5c9 |
SSL_PROTOCOL_TLSV1_1|SSL_PROTOCOL_TLSV1_2)
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
#else
|
|
Packit |
90a5c9 |
#define SSL_PROTOCOL_ALL (SSL_PROTOCOL_BASIC)
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
#ifndef OPENSSL_NO_SSL3
|
|
Packit |
90a5c9 |
#define SSL_PROTOCOL_DEFAULT (SSL_PROTOCOL_ALL & ~SSL_PROTOCOL_SSLV3)
|
|
Packit |
90a5c9 |
#else
|
|
Packit |
90a5c9 |
#define SSL_PROTOCOL_DEFAULT (SSL_PROTOCOL_ALL)
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
typedef int ssl_proto_t;
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/**
|
|
Packit |
90a5c9 |
* Define the SSL verify levels
|
|
Packit |
90a5c9 |
*/
|
|
Packit |
90a5c9 |
typedef enum {
|
|
Packit |
90a5c9 |
SSL_CVERIFY_UNSET = UNSET,
|
|
Packit |
90a5c9 |
SSL_CVERIFY_NONE = 0,
|
|
Packit |
90a5c9 |
SSL_CVERIFY_OPTIONAL = 1,
|
|
Packit |
90a5c9 |
SSL_CVERIFY_REQUIRE = 2,
|
|
Packit |
90a5c9 |
SSL_CVERIFY_OPTIONAL_NO_CA = 3
|
|
Packit |
90a5c9 |
} ssl_verify_t;
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#define SSL_VERIFY_PEER_STRICT \
|
|
Packit |
90a5c9 |
(SSL_VERIFY_PEER|SSL_VERIFY_FAIL_IF_NO_PEER_CERT)
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#define ssl_verify_error_is_optional(errnum) \
|
|
Packit |
90a5c9 |
((errnum == X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT) \
|
|
Packit |
90a5c9 |
|| (errnum == X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN) \
|
|
Packit |
90a5c9 |
|| (errnum == X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY) \
|
|
Packit |
90a5c9 |
|| (errnum == X509_V_ERR_CERT_UNTRUSTED) \
|
|
Packit |
90a5c9 |
|| (errnum == X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE))
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/**
|
|
Packit |
90a5c9 |
* CRL checking mask (mode | flags)
|
|
Packit |
90a5c9 |
*/
|
|
Packit |
90a5c9 |
typedef enum {
|
|
Packit |
90a5c9 |
SSL_CRLCHECK_NONE = (0),
|
|
Packit |
90a5c9 |
SSL_CRLCHECK_LEAF = (1 << 0),
|
|
Packit |
90a5c9 |
SSL_CRLCHECK_CHAIN = (1 << 1),
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#define SSL_CRLCHECK_FLAGS (~0x3)
|
|
Packit |
90a5c9 |
SSL_CRLCHECK_NO_CRL_FOR_CERT_OK = (1 << 2)
|
|
Packit |
90a5c9 |
} ssl_crlcheck_t;
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/**
|
|
Packit |
90a5c9 |
* OCSP checking mask (mode | flags)
|
|
Packit |
90a5c9 |
*/
|
|
Packit |
90a5c9 |
typedef enum {
|
|
Packit |
90a5c9 |
SSL_OCSPCHECK_NONE = (0),
|
|
Packit |
90a5c9 |
SSL_OCSPCHECK_LEAF = (1 << 0),
|
|
Packit |
90a5c9 |
SSL_OCSPCHECK_CHAIN = (1 << 1),
|
|
Packit |
90a5c9 |
SSL_OCSPCHECK_NO_OCSP_FOR_CERT_OK = (1 << 2)
|
|
Packit |
90a5c9 |
} ssl_ocspcheck_t;
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/**
|
|
Packit |
90a5c9 |
* Define the SSL pass phrase dialog types
|
|
Packit |
90a5c9 |
*/
|
|
Packit |
90a5c9 |
typedef enum {
|
|
Packit |
90a5c9 |
SSL_PPTYPE_UNSET = UNSET,
|
|
Packit |
90a5c9 |
SSL_PPTYPE_BUILTIN = 0,
|
|
Packit |
90a5c9 |
SSL_PPTYPE_FILTER = 1,
|
|
Packit |
90a5c9 |
SSL_PPTYPE_PIPE = 2
|
|
Packit |
90a5c9 |
} ssl_pphrase_t;
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/**
|
|
Packit |
90a5c9 |
* Define the Path Checking modes
|
|
Packit |
90a5c9 |
*/
|
|
Packit |
90a5c9 |
#define SSL_PCM_EXISTS 1
|
|
Packit |
90a5c9 |
#define SSL_PCM_ISREG 2
|
|
Packit |
90a5c9 |
#define SSL_PCM_ISDIR 4
|
|
Packit |
90a5c9 |
#define SSL_PCM_ISNONZERO 8
|
|
Packit |
90a5c9 |
typedef unsigned int ssl_pathcheck_t;
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/**
|
|
Packit |
90a5c9 |
* Define the SSL enabled state
|
|
Packit |
90a5c9 |
*/
|
|
Packit |
90a5c9 |
typedef enum {
|
|
Packit |
90a5c9 |
SSL_ENABLED_UNSET = UNSET,
|
|
Packit |
90a5c9 |
SSL_ENABLED_FALSE = 0,
|
|
Packit |
90a5c9 |
SSL_ENABLED_TRUE = 1,
|
|
Packit |
90a5c9 |
SSL_ENABLED_OPTIONAL = 3
|
|
Packit |
90a5c9 |
} ssl_enabled_t;
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/**
|
|
Packit |
90a5c9 |
* Define the SSL requirement structure
|
|
Packit |
90a5c9 |
*/
|
|
Packit |
90a5c9 |
typedef struct {
|
|
Packit |
90a5c9 |
const char *cpExpr;
|
|
Packit |
90a5c9 |
ap_expr_info_t *mpExpr;
|
|
Packit |
90a5c9 |
} ssl_require_t;
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/**
|
|
Packit |
90a5c9 |
* Define the SSL random number generator seeding source
|
|
Packit |
90a5c9 |
*/
|
|
Packit |
90a5c9 |
typedef enum {
|
|
Packit |
90a5c9 |
SSL_RSCTX_STARTUP = 1,
|
|
Packit |
90a5c9 |
SSL_RSCTX_CONNECT = 2
|
|
Packit |
90a5c9 |
} ssl_rsctx_t;
|
|
Packit |
90a5c9 |
typedef enum {
|
|
Packit |
90a5c9 |
SSL_RSSRC_BUILTIN = 1,
|
|
Packit |
90a5c9 |
SSL_RSSRC_FILE = 2,
|
|
Packit |
90a5c9 |
SSL_RSSRC_EXEC = 3,
|
|
Packit |
90a5c9 |
SSL_RSSRC_EGD = 4
|
|
Packit |
90a5c9 |
} ssl_rssrc_t;
|
|
Packit |
90a5c9 |
typedef struct {
|
|
Packit |
90a5c9 |
ssl_rsctx_t nCtx;
|
|
Packit |
90a5c9 |
ssl_rssrc_t nSrc;
|
|
Packit |
90a5c9 |
char *cpPath;
|
|
Packit |
90a5c9 |
int nBytes;
|
|
Packit |
90a5c9 |
} ssl_randseed_t;
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/**
|
|
Packit |
90a5c9 |
* Define the structure of an ASN.1 anything
|
|
Packit |
90a5c9 |
*/
|
|
Packit |
90a5c9 |
typedef struct {
|
|
Packit |
90a5c9 |
long int nData;
|
|
Packit |
90a5c9 |
unsigned char *cpData;
|
|
Packit |
90a5c9 |
apr_time_t source_mtime;
|
|
Packit |
90a5c9 |
} ssl_asn1_t;
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/**
|
|
Packit |
90a5c9 |
* Define the mod_ssl per-module configuration structure
|
|
Packit |
90a5c9 |
* (i.e. the global configuration for each httpd process)
|
|
Packit |
90a5c9 |
*/
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
typedef struct SSLSrvConfigRec SSLSrvConfigRec;
|
|
Packit |
90a5c9 |
typedef struct SSLDirConfigRec SSLDirConfigRec;
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
typedef enum {
|
|
Packit |
90a5c9 |
SSL_SHUTDOWN_TYPE_UNSET,
|
|
Packit |
90a5c9 |
SSL_SHUTDOWN_TYPE_STANDARD,
|
|
Packit |
90a5c9 |
SSL_SHUTDOWN_TYPE_UNCLEAN,
|
|
Packit |
90a5c9 |
SSL_SHUTDOWN_TYPE_ACCURATE
|
|
Packit |
90a5c9 |
} ssl_shutdown_type_e;
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
typedef struct {
|
|
Packit |
90a5c9 |
SSL *ssl;
|
|
Packit |
90a5c9 |
const char *client_dn;
|
|
Packit |
90a5c9 |
X509 *client_cert;
|
|
Packit |
90a5c9 |
ssl_shutdown_type_e shutdown_type;
|
|
Packit |
90a5c9 |
const char *verify_info;
|
|
Packit |
90a5c9 |
const char *verify_error;
|
|
Packit |
90a5c9 |
int verify_depth;
|
|
Packit |
90a5c9 |
int is_proxy;
|
|
Packit |
90a5c9 |
int disabled;
|
|
Packit |
90a5c9 |
enum {
|
|
Packit |
90a5c9 |
NON_SSL_OK = 0, /* is SSL request, or error handling completed */
|
|
Packit |
90a5c9 |
NON_SSL_SEND_REQLINE, /* Need to send the fake request line */
|
|
Packit |
90a5c9 |
NON_SSL_SEND_HDR_SEP, /* Need to send the header separator */
|
|
Packit |
90a5c9 |
NON_SSL_SET_ERROR_MSG /* Need to set the error message */
|
|
Packit |
90a5c9 |
} non_ssl_request;
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/* Track the handshake/renegotiation state for the connection so
|
|
Packit |
90a5c9 |
* that all client-initiated renegotiations can be rejected, as a
|
|
Packit |
90a5c9 |
* partial fix for CVE-2009-3555. */
|
|
Packit |
90a5c9 |
enum {
|
|
Packit |
90a5c9 |
RENEG_INIT = 0, /* Before initial handshake */
|
|
Packit |
90a5c9 |
RENEG_REJECT, /* After initial handshake; any client-initiated
|
|
Packit |
90a5c9 |
* renegotiation should be rejected */
|
|
Packit |
90a5c9 |
RENEG_ALLOW, /* A server-initiated renegotiation is taking
|
|
Packit |
90a5c9 |
* place (as dictated by configuration) */
|
|
Packit |
90a5c9 |
RENEG_ABORT /* Renegotiation initiated by client, abort the
|
|
Packit |
90a5c9 |
* connection */
|
|
Packit |
90a5c9 |
} reneg_state;
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
server_rec *server;
|
|
Packit |
90a5c9 |
SSLDirConfigRec *dc;
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
const char *cipher_suite; /* cipher suite used in last reneg */
|
|
Packit |
90a5c9 |
int service_unavailable; /* thouugh we negotiate SSL, no requests will be served */
|
|
Packit |
90a5c9 |
} SSLConnRec;
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/* BIG FAT WARNING: SSLModConfigRec has unusual memory lifetime: it is
|
|
Packit |
90a5c9 |
* allocated out of the "process" pool and only a single such
|
|
Packit |
90a5c9 |
* structure is created and used for the lifetime of the process.
|
|
Packit |
90a5c9 |
* (The process pool is s->process->pool and is stored in the .pPool
|
|
Packit |
90a5c9 |
* field.) Most members of this structure are likewise allocated out
|
|
Packit |
90a5c9 |
* of the process pool, but notably sesscache and sesscache_context
|
|
Packit |
90a5c9 |
* are not.
|
|
Packit |
90a5c9 |
*
|
|
Packit |
90a5c9 |
* The structure is treated as mostly immutable after a single config
|
|
Packit |
90a5c9 |
* parse has completed; the post_config hook (ssl_init_Module) flips
|
|
Packit |
90a5c9 |
* the bFixed flag to true and subsequent invocations of the config
|
|
Packit |
90a5c9 |
* callbacks hence do nothing.
|
|
Packit |
90a5c9 |
*
|
|
Packit |
90a5c9 |
* This odd lifetime strategy is used so that encrypted private keys
|
|
Packit |
90a5c9 |
* can be decrypted once at startup and continue to be used across
|
|
Packit |
90a5c9 |
* subsequent server reloads where the interactive password prompt is
|
|
Packit |
90a5c9 |
* not possible.
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
* It is really an ABI nightmare waiting to happen since DSOs are
|
|
Packit |
90a5c9 |
* reloaded across restarts, and nothing prevents the struct type
|
|
Packit |
90a5c9 |
* changing across such reloads, yet the cached structure will be
|
|
Packit |
90a5c9 |
* assumed to match regardless.
|
|
Packit |
90a5c9 |
*
|
|
Packit |
90a5c9 |
* This should really be fixed using a smaller structure which only
|
|
Packit |
90a5c9 |
* stores that which is absolutely necessary (the private keys, maybe
|
|
Packit |
90a5c9 |
* the random seed), and have that structure be strictly ABI-versioned
|
|
Packit |
90a5c9 |
* for safety.
|
|
Packit |
90a5c9 |
*/
|
|
Packit |
90a5c9 |
typedef struct {
|
|
Packit |
90a5c9 |
pid_t pid;
|
|
Packit |
90a5c9 |
apr_pool_t *pPool;
|
|
Packit |
90a5c9 |
BOOL bFixed;
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/* OpenSSL SSL_SESS_CACHE_* flags: */
|
|
Packit |
90a5c9 |
long sesscache_mode;
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/* The configured provider, and associated private data
|
|
Packit |
90a5c9 |
* structure. */
|
|
Packit |
90a5c9 |
const ap_socache_provider_t *sesscache;
|
|
Packit |
90a5c9 |
ap_socache_instance_t *sesscache_context;
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
apr_global_mutex_t *pMutex;
|
|
Packit |
90a5c9 |
apr_array_header_t *aRandSeed;
|
|
Packit |
90a5c9 |
apr_hash_t *tVHostKeys;
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/* A hash table of pointers to ssl_asn1_t structures. The structures
|
|
Packit |
90a5c9 |
* are used to store private keys in raw DER format (serialized OpenSSL
|
|
Packit |
90a5c9 |
* PrivateKey structures). The table is indexed by (vhost-id,
|
|
Packit |
90a5c9 |
* index), for example the string "vhost.example.com:443:0". */
|
|
Packit |
90a5c9 |
apr_hash_t *tPrivateKey;
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#if defined(HAVE_OPENSSL_ENGINE_H) && defined(HAVE_ENGINE_INIT)
|
|
Packit |
90a5c9 |
const char *szCryptoDevice;
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#ifdef HAVE_OCSP_STAPLING
|
|
Packit |
90a5c9 |
const ap_socache_provider_t *stapling_cache;
|
|
Packit |
90a5c9 |
ap_socache_instance_t *stapling_cache_context;
|
|
Packit |
90a5c9 |
apr_global_mutex_t *stapling_cache_mutex;
|
|
Packit |
90a5c9 |
apr_global_mutex_t *stapling_refresh_mutex;
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
003d89 |
|
|
Packit |
003d89 |
#ifdef HAVE_OPENSSL_KEYLOG
|
|
Packit |
003d89 |
/* Used for logging if SSLKEYLOGFILE is set at startup. */
|
|
Packit |
003d89 |
apr_file_t *keylog_file;
|
|
Packit |
003d89 |
#endif
|
|
Packit |
003d89 |
|
|
Packit |
90a5c9 |
} SSLModConfigRec;
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/** Structure representing configured filenames for certs and keys for
|
|
Packit |
90a5c9 |
* a given vhost */
|
|
Packit |
90a5c9 |
typedef struct {
|
|
Packit |
90a5c9 |
/* Lists of configured certs and keys for this server */
|
|
Packit |
90a5c9 |
apr_array_header_t *cert_files;
|
|
Packit |
90a5c9 |
apr_array_header_t *key_files;
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/** Certificates which specify the set of CA names which should be
|
|
Packit |
90a5c9 |
* sent in the CertificateRequest message: */
|
|
Packit |
90a5c9 |
const char *ca_name_path;
|
|
Packit |
90a5c9 |
const char *ca_name_file;
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/* TLS service for this server is suspended */
|
|
Packit |
90a5c9 |
int service_unavailable;
|
|
Packit |
90a5c9 |
} modssl_pk_server_t;
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
typedef struct {
|
|
Packit |
90a5c9 |
/** proxy can have any number of cert/key pairs */
|
|
Packit |
90a5c9 |
const char *cert_file;
|
|
Packit |
90a5c9 |
const char *cert_path;
|
|
Packit |
90a5c9 |
const char *ca_cert_file;
|
|
Packit |
90a5c9 |
STACK_OF(X509_INFO) *certs; /* Contains End Entity certs */
|
|
Packit |
90a5c9 |
STACK_OF(X509) **ca_certs; /* Contains ONLY chain certs for
|
|
Packit |
90a5c9 |
* each item in certs.
|
|
Packit |
90a5c9 |
* (ptr to array of ptrs) */
|
|
Packit |
90a5c9 |
} modssl_pk_proxy_t;
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/** stuff related to authentication that can also be per-dir */
|
|
Packit |
90a5c9 |
typedef struct {
|
|
Packit |
90a5c9 |
/** known/trusted CAs */
|
|
Packit |
90a5c9 |
const char *ca_cert_path;
|
|
Packit |
90a5c9 |
const char *ca_cert_file;
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
const char *cipher_suite;
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/** for client or downstream server authentication */
|
|
Packit |
90a5c9 |
int verify_depth;
|
|
Packit |
90a5c9 |
ssl_verify_t verify_mode;
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/** TLSv1.3 has its separate cipher list, separate from the
|
|
Packit |
90a5c9 |
settings for older TLS protocol versions. Since which one takes
|
|
Packit |
90a5c9 |
effect is a matter of negotiation, we need separate settings */
|
|
Packit |
90a5c9 |
const char *tls13_ciphers;
|
|
Packit |
90a5c9 |
} modssl_auth_ctx_t;
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#ifdef HAVE_TLS_SESSION_TICKETS
|
|
Packit |
90a5c9 |
typedef struct {
|
|
Packit |
90a5c9 |
const char *file_path;
|
|
Packit |
90a5c9 |
unsigned char key_name[16];
|
|
Packit |
90a5c9 |
unsigned char hmac_secret[16];
|
|
Packit |
90a5c9 |
unsigned char aes_key[16];
|
|
Packit |
90a5c9 |
} modssl_ticket_key_t;
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#ifdef HAVE_SSL_CONF_CMD
|
|
Packit |
90a5c9 |
typedef struct {
|
|
Packit |
90a5c9 |
const char *name;
|
|
Packit |
90a5c9 |
const char *value;
|
|
Packit |
90a5c9 |
} ssl_ctx_param_t;
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
typedef struct {
|
|
Packit |
90a5c9 |
SSLSrvConfigRec *sc; /** pointer back to server config */
|
|
Packit |
90a5c9 |
SSL_CTX *ssl_ctx;
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/** we are one or the other */
|
|
Packit |
90a5c9 |
modssl_pk_server_t *pks;
|
|
Packit |
90a5c9 |
modssl_pk_proxy_t *pkp;
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#ifdef HAVE_TLS_SESSION_TICKETS
|
|
Packit |
90a5c9 |
modssl_ticket_key_t *ticket_key;
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
ssl_proto_t protocol;
|
|
Packit |
90a5c9 |
int protocol_set;
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/** config for handling encrypted keys */
|
|
Packit |
90a5c9 |
ssl_pphrase_t pphrase_dialog_type;
|
|
Packit |
90a5c9 |
const char *pphrase_dialog_path;
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
const char *cert_chain;
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/** certificate revocation list */
|
|
Packit |
90a5c9 |
const char *crl_path;
|
|
Packit |
90a5c9 |
const char *crl_file;
|
|
Packit |
90a5c9 |
int crl_check_mask;
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#ifdef HAVE_OCSP_STAPLING
|
|
Packit |
90a5c9 |
/** OCSP stapling options */
|
|
Packit |
90a5c9 |
BOOL stapling_enabled;
|
|
Packit |
90a5c9 |
long stapling_resptime_skew;
|
|
Packit |
90a5c9 |
long stapling_resp_maxage;
|
|
Packit |
90a5c9 |
int stapling_cache_timeout;
|
|
Packit |
90a5c9 |
BOOL stapling_return_errors;
|
|
Packit |
90a5c9 |
BOOL stapling_fake_trylater;
|
|
Packit |
90a5c9 |
int stapling_errcache_timeout;
|
|
Packit |
90a5c9 |
apr_interval_time_t stapling_responder_timeout;
|
|
Packit |
90a5c9 |
const char *stapling_force_url;
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#ifdef HAVE_SRP
|
|
Packit |
90a5c9 |
char *srp_vfile;
|
|
Packit |
90a5c9 |
char *srp_unknown_user_seed;
|
|
Packit |
90a5c9 |
SRP_VBASE *srp_vbase;
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
modssl_auth_ctx_t auth;
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
int ocsp_mask;
|
|
Packit |
90a5c9 |
BOOL ocsp_force_default; /* true if the default responder URL is
|
|
Packit |
90a5c9 |
* used regardless of per-cert URL */
|
|
Packit |
90a5c9 |
const char *ocsp_responder; /* default responder URL */
|
|
Packit |
90a5c9 |
long ocsp_resptime_skew;
|
|
Packit |
90a5c9 |
long ocsp_resp_maxage;
|
|
Packit |
90a5c9 |
apr_interval_time_t ocsp_responder_timeout;
|
|
Packit |
90a5c9 |
BOOL ocsp_use_request_nonce;
|
|
Packit |
90a5c9 |
apr_uri_t *proxy_uri;
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
BOOL ocsp_noverify; /* true if skipping OCSP certification verification like openssl -noverify */
|
|
Packit |
90a5c9 |
/* Declare variables for using OCSP Responder Certs for OCSP verification */
|
|
Packit |
90a5c9 |
int ocsp_verify_flags; /* Flags to use when verifying OCSP response */
|
|
Packit |
90a5c9 |
const char *ocsp_certs_file; /* OCSP other certificates filename */
|
|
Packit |
90a5c9 |
STACK_OF(X509) *ocsp_certs; /* OCSP other certificates */
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#ifdef HAVE_SSL_CONF_CMD
|
|
Packit |
90a5c9 |
SSL_CONF_CTX *ssl_ctx_config; /* Configuration context */
|
|
Packit |
90a5c9 |
apr_array_header_t *ssl_ctx_param; /* parameters to pass to SSL_CTX */
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
BOOL ssl_check_peer_cn;
|
|
Packit |
90a5c9 |
BOOL ssl_check_peer_name;
|
|
Packit |
90a5c9 |
BOOL ssl_check_peer_expire;
|
|
Packit |
90a5c9 |
} modssl_ctx_t;
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
struct SSLSrvConfigRec {
|
|
Packit |
90a5c9 |
SSLModConfigRec *mc;
|
|
Packit |
90a5c9 |
ssl_enabled_t enabled;
|
|
Packit |
90a5c9 |
const char *vhost_id;
|
|
Packit |
90a5c9 |
int vhost_id_len;
|
|
Packit |
90a5c9 |
int session_cache_timeout;
|
|
Packit |
90a5c9 |
BOOL cipher_server_pref;
|
|
Packit |
90a5c9 |
BOOL insecure_reneg;
|
|
Packit |
90a5c9 |
modssl_ctx_t *server;
|
|
Packit |
90a5c9 |
#ifdef HAVE_TLSEXT
|
|
Packit |
90a5c9 |
ssl_enabled_t strict_sni_vhost_check;
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
#ifdef HAVE_FIPS
|
|
Packit |
90a5c9 |
BOOL fips;
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
#ifndef OPENSSL_NO_COMP
|
|
Packit |
90a5c9 |
BOOL compression;
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
BOOL session_tickets;
|
|
Packit |
90a5c9 |
};
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/**
|
|
Packit |
90a5c9 |
* Define the mod_ssl per-directory configuration structure
|
|
Packit |
90a5c9 |
* (i.e. the local configuration for all <Directory>
|
|
Packit |
90a5c9 |
* and .htaccess contexts)
|
|
Packit |
90a5c9 |
*/
|
|
Packit |
90a5c9 |
struct SSLDirConfigRec {
|
|
Packit |
90a5c9 |
BOOL bSSLRequired;
|
|
Packit |
90a5c9 |
apr_array_header_t *aRequirement;
|
|
Packit |
90a5c9 |
ssl_opt_t nOptions;
|
|
Packit |
90a5c9 |
ssl_opt_t nOptionsAdd;
|
|
Packit |
90a5c9 |
ssl_opt_t nOptionsDel;
|
|
Packit |
90a5c9 |
const char *szCipherSuite;
|
|
Packit |
90a5c9 |
ssl_verify_t nVerifyClient;
|
|
Packit |
90a5c9 |
int nVerifyDepth;
|
|
Packit |
90a5c9 |
const char *szUserName;
|
|
Packit |
90a5c9 |
apr_size_t nRenegBufferSize;
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
modssl_ctx_t *proxy;
|
|
Packit |
90a5c9 |
BOOL proxy_enabled;
|
|
Packit |
90a5c9 |
BOOL proxy_post_config;
|
|
Packit |
90a5c9 |
};
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/**
|
|
Packit |
90a5c9 |
* function prototypes
|
|
Packit |
90a5c9 |
*/
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/** API glue structures */
|
|
Packit |
90a5c9 |
extern module AP_MODULE_DECLARE_DATA ssl_module;
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/** configuration handling */
|
|
Packit |
90a5c9 |
SSLModConfigRec *ssl_config_global_create(server_rec *);
|
|
Packit |
90a5c9 |
void ssl_config_global_fix(SSLModConfigRec *);
|
|
Packit |
90a5c9 |
BOOL ssl_config_global_isfixed(SSLModConfigRec *);
|
|
Packit |
90a5c9 |
void *ssl_config_server_create(apr_pool_t *, server_rec *);
|
|
Packit |
90a5c9 |
void *ssl_config_server_merge(apr_pool_t *, void *, void *);
|
|
Packit |
90a5c9 |
void *ssl_config_perdir_create(apr_pool_t *, char *);
|
|
Packit |
90a5c9 |
void *ssl_config_perdir_merge(apr_pool_t *, void *, void *);
|
|
Packit |
90a5c9 |
void ssl_config_proxy_merge(apr_pool_t *,
|
|
Packit |
90a5c9 |
SSLDirConfigRec *, SSLDirConfigRec *);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLPassPhraseDialog(cmd_parms *, void *, const char *);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLCryptoDevice(cmd_parms *, void *, const char *);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLRandomSeed(cmd_parms *, void *, const char *, const char *, const char *);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLEngine(cmd_parms *, void *, const char *);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLCipherSuite(cmd_parms *, void *, const char *, const char *);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLCertificateFile(cmd_parms *, void *, const char *);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLCertificateKeyFile(cmd_parms *, void *, const char *);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLCertificateChainFile(cmd_parms *, void *, const char *);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLCACertificatePath(cmd_parms *, void *, const char *);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLCACertificateFile(cmd_parms *, void *, const char *);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLCADNRequestPath(cmd_parms *, void *, const char *);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLCADNRequestFile(cmd_parms *, void *, const char *);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLCARevocationPath(cmd_parms *, void *, const char *);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLCARevocationFile(cmd_parms *, void *, const char *);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLCARevocationCheck(cmd_parms *, void *, const char *);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLHonorCipherOrder(cmd_parms *cmd, void *dcfg, int flag);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLCompression(cmd_parms *, void *, int flag);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLSessionTickets(cmd_parms *, void *, int flag);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLVerifyClient(cmd_parms *, void *, const char *);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLVerifyDepth(cmd_parms *, void *, const char *);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLSessionCache(cmd_parms *, void *, const char *);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLSessionCacheTimeout(cmd_parms *, void *, const char *);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLProtocol(cmd_parms *, void *, const char *);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLOptions(cmd_parms *, void *, const char *);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLRequireSSL(cmd_parms *, void *);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLRequire(cmd_parms *, void *, const char *);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLUserName(cmd_parms *, void *, const char *);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLRenegBufferSize(cmd_parms *cmd, void *dcfg, const char *arg);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLStrictSNIVHostCheck(cmd_parms *cmd, void *dcfg, int flag);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLInsecureRenegotiation(cmd_parms *cmd, void *dcfg, int flag);
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLProxyEngine(cmd_parms *cmd, void *dcfg, int flag);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLProxyProtocol(cmd_parms *, void *, const char *);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLProxyCipherSuite(cmd_parms *, void *, const char *, const char *);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLProxyVerify(cmd_parms *, void *, const char *);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLProxyVerifyDepth(cmd_parms *, void *, const char *);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLProxyCACertificatePath(cmd_parms *, void *, const char *);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLProxyCACertificateFile(cmd_parms *, void *, const char *);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLProxyCARevocationPath(cmd_parms *, void *, const char *);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLProxyCARevocationFile(cmd_parms *, void *, const char *);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLProxyCARevocationCheck(cmd_parms *, void *, const char *);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLProxyMachineCertificatePath(cmd_parms *, void *, const char *);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLProxyMachineCertificateFile(cmd_parms *, void *, const char *);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLProxyMachineCertificateChainFile(cmd_parms *, void *, const char *);
|
|
Packit |
90a5c9 |
#ifdef HAVE_TLS_SESSION_TICKETS
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLSessionTicketKeyFile(cmd_parms *cmd, void *dcfg, const char *arg);
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLProxyCheckPeerExpire(cmd_parms *cmd, void *dcfg, int flag);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLProxyCheckPeerCN(cmd_parms *cmd, void *dcfg, int flag);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLProxyCheckPeerName(cmd_parms *cmd, void *dcfg, int flag);
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLOCSPOverrideResponder(cmd_parms *cmd, void *dcfg, int flag);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLOCSPDefaultResponder(cmd_parms *cmd, void *dcfg, const char *arg);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLOCSPResponseTimeSkew(cmd_parms *cmd, void *dcfg, const char *arg);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLOCSPResponseMaxAge(cmd_parms *cmd, void *dcfg, const char *arg);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLOCSPResponderTimeout(cmd_parms *cmd, void *dcfg, const char *arg);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLOCSPUseRequestNonce(cmd_parms *cmd, void *dcfg, int flag);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLOCSPEnable(cmd_parms *cmd, void *dcfg, const char *arg);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLOCSPProxyURL(cmd_parms *cmd, void *dcfg, const char *arg);
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/* Declare OCSP Responder Certificate Verification Directive */
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLOCSPNoVerify(cmd_parms *cmd, void *dcfg, int flag);
|
|
Packit |
90a5c9 |
/* Declare OCSP Responder Certificate File Directive */
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLOCSPResponderCertificateFile(cmd_parms *cmd, void *dcfg, const char *arg);
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#ifdef HAVE_SSL_CONF_CMD
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLOpenSSLConfCmd(cmd_parms *cmd, void *dcfg, const char *arg1, const char *arg2);
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#ifdef HAVE_SRP
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLSRPVerifierFile(cmd_parms *cmd, void *dcfg, const char *arg);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLSRPUnknownUserSeed(cmd_parms *cmd, void *dcfg, const char *arg);
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLFIPS(cmd_parms *cmd, void *dcfg, int flag);
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/** module initialization */
|
|
Packit |
90a5c9 |
apr_status_t ssl_init_Module(apr_pool_t *, apr_pool_t *, apr_pool_t *, server_rec *);
|
|
Packit |
90a5c9 |
apr_status_t ssl_init_Engine(server_rec *, apr_pool_t *);
|
|
Packit |
90a5c9 |
apr_status_t ssl_init_ConfigureServer(server_rec *, apr_pool_t *, apr_pool_t *, SSLSrvConfigRec *,
|
|
Packit |
90a5c9 |
apr_array_header_t *);
|
|
Packit |
90a5c9 |
apr_status_t ssl_init_CheckServers(server_rec *, apr_pool_t *);
|
|
Packit |
90a5c9 |
int ssl_proxy_section_post_config(apr_pool_t *p, apr_pool_t *plog,
|
|
Packit |
90a5c9 |
apr_pool_t *ptemp, server_rec *s,
|
|
Packit |
90a5c9 |
ap_conf_vector_t *section_config);
|
|
Packit |
90a5c9 |
STACK_OF(X509_NAME)
|
|
Packit |
90a5c9 |
*ssl_init_FindCAList(server_rec *, apr_pool_t *, const char *, const char *);
|
|
Packit |
90a5c9 |
void ssl_init_Child(apr_pool_t *, server_rec *);
|
|
Packit |
90a5c9 |
apr_status_t ssl_init_ModuleKill(void *data);
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/** Apache API hooks */
|
|
Packit |
90a5c9 |
int ssl_hook_Auth(request_rec *);
|
|
Packit |
90a5c9 |
int ssl_hook_UserCheck(request_rec *);
|
|
Packit |
90a5c9 |
int ssl_hook_Access(request_rec *);
|
|
Packit |
90a5c9 |
int ssl_hook_Fixup(request_rec *);
|
|
Packit |
90a5c9 |
int ssl_hook_ReadReq(request_rec *);
|
|
Packit |
90a5c9 |
int ssl_hook_Upgrade(request_rec *);
|
|
Packit |
90a5c9 |
void ssl_hook_ConfigTest(apr_pool_t *pconf, server_rec *s);
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/** Apache authz provisders */
|
|
Packit |
90a5c9 |
extern const authz_provider ssl_authz_provider_require_ssl;
|
|
Packit |
90a5c9 |
extern const authz_provider ssl_authz_provider_verify_client;
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/** OpenSSL callbacks */
|
|
Packit |
90a5c9 |
DH *ssl_callback_TmpDH(SSL *, int, int);
|
|
Packit |
90a5c9 |
int ssl_callback_SSLVerify(int, X509_STORE_CTX *);
|
|
Packit |
90a5c9 |
int ssl_callback_SSLVerify_CRL(int, X509_STORE_CTX *, conn_rec *);
|
|
Packit |
90a5c9 |
int ssl_callback_proxy_cert(SSL *ssl, X509 **x509, EVP_PKEY **pkey);
|
|
Packit |
90a5c9 |
int ssl_callback_NewSessionCacheEntry(SSL *, SSL_SESSION *);
|
|
Packit |
90a5c9 |
SSL_SESSION *ssl_callback_GetSessionCacheEntry(SSL *, IDCONST unsigned char *, int, int *);
|
|
Packit |
90a5c9 |
void ssl_callback_DelSessionCacheEntry(SSL_CTX *, SSL_SESSION *);
|
|
Packit |
90a5c9 |
void ssl_callback_Info(const SSL *, int, int);
|
|
Packit |
90a5c9 |
#ifdef HAVE_TLSEXT
|
|
Packit |
90a5c9 |
int ssl_callback_ServerNameIndication(SSL *, int *, modssl_ctx_t *);
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
#ifdef HAVE_TLS_SESSION_TICKETS
|
|
Packit |
90a5c9 |
int ssl_callback_SessionTicket(SSL *, unsigned char *, unsigned char *,
|
|
Packit |
90a5c9 |
EVP_CIPHER_CTX *, HMAC_CTX *, int);
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#ifdef HAVE_TLS_ALPN
|
|
Packit |
90a5c9 |
int ssl_callback_alpn_select(SSL *ssl, const unsigned char **out,
|
|
Packit |
90a5c9 |
unsigned char *outlen, const unsigned char *in,
|
|
Packit |
90a5c9 |
unsigned int inlen, void *arg);
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/** Session Cache Support */
|
|
Packit |
90a5c9 |
apr_status_t ssl_scache_init(server_rec *, apr_pool_t *);
|
|
Packit |
90a5c9 |
void ssl_scache_status_register(apr_pool_t *p);
|
|
Packit |
90a5c9 |
void ssl_scache_kill(server_rec *);
|
|
Packit |
90a5c9 |
BOOL ssl_scache_store(server_rec *, IDCONST UCHAR *, int,
|
|
Packit |
90a5c9 |
apr_time_t, SSL_SESSION *, apr_pool_t *);
|
|
Packit |
90a5c9 |
SSL_SESSION *ssl_scache_retrieve(server_rec *, IDCONST UCHAR *, int, apr_pool_t *);
|
|
Packit |
90a5c9 |
void ssl_scache_remove(server_rec *, IDCONST UCHAR *, int,
|
|
Packit |
90a5c9 |
apr_pool_t *);
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/** OCSP Stapling Support */
|
|
Packit |
90a5c9 |
#ifdef HAVE_OCSP_STAPLING
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLStaplingCache(cmd_parms *, void *, const char *);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLUseStapling(cmd_parms *, void *, int);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLStaplingResponseTimeSkew(cmd_parms *, void *, const char *);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLStaplingResponseMaxAge(cmd_parms *, void *, const char *);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLStaplingStandardCacheTimeout(cmd_parms *, void *, const char *);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLStaplingErrorCacheTimeout(cmd_parms *, void *, const char *);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLStaplingReturnResponderErrors(cmd_parms *, void *, int);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLStaplingFakeTryLater(cmd_parms *, void *, int);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLStaplingResponderTimeout(cmd_parms *, void *, const char *);
|
|
Packit |
90a5c9 |
const char *ssl_cmd_SSLStaplingForceURL(cmd_parms *, void *, const char *);
|
|
Packit |
90a5c9 |
apr_status_t modssl_init_stapling(server_rec *, apr_pool_t *, apr_pool_t *, modssl_ctx_t *);
|
|
Packit |
90a5c9 |
void ssl_stapling_certinfo_hash_init(apr_pool_t *);
|
|
Packit |
90a5c9 |
int ssl_stapling_init_cert(server_rec *, apr_pool_t *, apr_pool_t *,
|
|
Packit |
90a5c9 |
modssl_ctx_t *, X509 *);
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
#ifdef HAVE_SRP
|
|
Packit |
90a5c9 |
int ssl_callback_SRPServerParams(SSL *, int *, void *);
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
|
|
Packit |
003d89 |
#ifdef HAVE_OPENSSL_KEYLOG
|
|
Packit |
003d89 |
/* Callback used with SSL_CTX_set_keylog_callback. */
|
|
Packit |
003d89 |
void modssl_callback_keylog(const SSL *ssl, const char *line);
|
|
Packit |
003d89 |
#endif
|
|
Packit |
003d89 |
|
|
Packit |
90a5c9 |
/** I/O */
|
|
Packit |
90a5c9 |
void ssl_io_filter_init(conn_rec *, request_rec *r, SSL *);
|
|
Packit |
90a5c9 |
void ssl_io_filter_register(apr_pool_t *);
|
|
Packit |
90a5c9 |
long ssl_io_data_cb(BIO *, int, const char *, int, long, long);
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/* ssl_io_buffer_fill fills the setaside buffering of the HTTP request
|
|
Packit |
90a5c9 |
* to allow an SSL renegotiation to take place. */
|
|
Packit |
90a5c9 |
int ssl_io_buffer_fill(request_rec *r, apr_size_t maxlen);
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/** PRNG */
|
|
Packit |
90a5c9 |
int ssl_rand_seed(server_rec *, apr_pool_t *, ssl_rsctx_t, char *);
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/** Utility Functions */
|
|
Packit |
90a5c9 |
char *ssl_util_vhostid(apr_pool_t *, server_rec *);
|
|
Packit |
90a5c9 |
apr_file_t *ssl_util_ppopen(server_rec *, apr_pool_t *, const char *,
|
|
Packit |
90a5c9 |
const char * const *);
|
|
Packit |
90a5c9 |
void ssl_util_ppclose(server_rec *, apr_pool_t *, apr_file_t *);
|
|
Packit |
90a5c9 |
char *ssl_util_readfilter(server_rec *, apr_pool_t *, const char *,
|
|
Packit |
90a5c9 |
const char * const *);
|
|
Packit |
90a5c9 |
BOOL ssl_util_path_check(ssl_pathcheck_t, const char *, apr_pool_t *);
|
|
Packit |
90a5c9 |
#if APR_HAS_THREADS && MODSSL_USE_OPENSSL_PRE_1_1_API
|
|
Packit |
90a5c9 |
void ssl_util_thread_setup(apr_pool_t *);
|
|
Packit |
90a5c9 |
void ssl_util_thread_id_setup(apr_pool_t *);
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
int ssl_init_ssl_connection(conn_rec *c, request_rec *r);
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
BOOL ssl_util_vhost_matches(const char *servername, server_rec *s);
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/** Pass Phrase Support */
|
|
Packit |
90a5c9 |
apr_status_t ssl_load_encrypted_pkey(server_rec *, apr_pool_t *, int,
|
|
Packit |
90a5c9 |
const char *, apr_array_header_t **);
|
|
Packit |
90a5c9 |
|
|
Packit |
70c855 |
/* Load public and/or private key from the configured ENGINE. Private
|
|
Packit |
70c855 |
* key returned as *pkey. certid can be NULL, in which case *pubkey
|
|
Packit |
70c855 |
* is not altered. Errors logged on failure. */
|
|
Packit |
70c855 |
apr_status_t modssl_load_engine_keypair(server_rec *s, apr_pool_t *p,
|
|
Packit |
70c855 |
const char *vhostid,
|
|
Packit |
70c855 |
const char *certid, const char *keyid,
|
|
Packit |
70c855 |
X509 **pubkey, EVP_PKEY **privkey);
|
|
Packit |
70c855 |
|
|
Packit |
90a5c9 |
/** Diffie-Hellman Parameter Support */
|
|
Packit |
90a5c9 |
DH *ssl_dh_GetParamFromFile(const char *);
|
|
Packit |
90a5c9 |
#ifdef HAVE_ECC
|
|
Packit |
90a5c9 |
EC_GROUP *ssl_ec_GetParamFromFile(const char *);
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
|
|
Packit |
70c855 |
/* Store the EVP_PKEY key (serialized into DER) in the hash table with
|
|
Packit |
70c855 |
* key, returning the ssl_asn1_t structure pointer. */
|
|
Packit |
70c855 |
ssl_asn1_t *ssl_asn1_table_set(apr_hash_t *table, const char *key,
|
|
Packit |
70c855 |
EVP_PKEY *pkey);
|
|
Packit |
70c855 |
/* Retrieve the ssl_asn1_t structure with given key from the hash. */
|
|
Packit |
70c855 |
ssl_asn1_t *ssl_asn1_table_get(apr_hash_t *table, const char *key);
|
|
Packit |
70c855 |
/* Remove and free the ssl_asn1_t structure with given key. */
|
|
Packit |
70c855 |
void ssl_asn1_table_unset(apr_hash_t *table, const char *key);
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/** Mutex Support */
|
|
Packit |
90a5c9 |
int ssl_mutex_init(server_rec *, apr_pool_t *);
|
|
Packit |
90a5c9 |
int ssl_mutex_reinit(server_rec *, apr_pool_t *);
|
|
Packit |
90a5c9 |
int ssl_mutex_on(server_rec *);
|
|
Packit |
90a5c9 |
int ssl_mutex_off(server_rec *);
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
int ssl_stapling_mutex_reinit(server_rec *, apr_pool_t *);
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/* mutex type names for Mutex directive */
|
|
Packit |
90a5c9 |
#define SSL_CACHE_MUTEX_TYPE "ssl-cache"
|
|
Packit |
90a5c9 |
#define SSL_STAPLING_CACHE_MUTEX_TYPE "ssl-stapling"
|
|
Packit |
90a5c9 |
#define SSL_STAPLING_REFRESH_MUTEX_TYPE "ssl-stapling-refresh"
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
apr_status_t ssl_die(server_rec *);
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/** Logfile Support */
|
|
Packit |
90a5c9 |
void ssl_log_ssl_error(const char *, int, int, server_rec *);
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/* ssl_log_xerror, ssl_log_cxerror and ssl_log_rxerror are wrappers for the
|
|
Packit |
90a5c9 |
* respective ap_log_*error functions and take a certificate as an
|
|
Packit |
90a5c9 |
* additional argument (whose details are appended to the log message).
|
|
Packit |
90a5c9 |
* The other arguments are interpreted exactly as with their ap_log_*error
|
|
Packit |
90a5c9 |
* counterparts. */
|
|
Packit |
90a5c9 |
void ssl_log_xerror(const char *file, int line, int level,
|
|
Packit |
90a5c9 |
apr_status_t rv, apr_pool_t *p, server_rec *s,
|
|
Packit |
90a5c9 |
X509 *cert, const char *format, ...)
|
|
Packit |
90a5c9 |
__attribute__((format(printf,8,9)));
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
void ssl_log_cxerror(const char *file, int line, int level,
|
|
Packit |
90a5c9 |
apr_status_t rv, conn_rec *c, X509 *cert,
|
|
Packit |
90a5c9 |
const char *format, ...)
|
|
Packit |
90a5c9 |
__attribute__((format(printf,7,8)));
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
void ssl_log_rxerror(const char *file, int line, int level,
|
|
Packit |
90a5c9 |
apr_status_t rv, request_rec *r, X509 *cert,
|
|
Packit |
90a5c9 |
const char *format, ...)
|
|
Packit |
90a5c9 |
__attribute__((format(printf,7,8)));
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#define SSLLOG_MARK __FILE__,__LINE__
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/** Variables */
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/* Register variables for the lifetime of the process pool 'p'. */
|
|
Packit |
90a5c9 |
void ssl_var_register(apr_pool_t *p);
|
|
Packit |
90a5c9 |
char *ssl_var_lookup(apr_pool_t *, server_rec *, conn_rec *, request_rec *, char *);
|
|
Packit |
90a5c9 |
apr_array_header_t *ssl_ext_list(apr_pool_t *p, conn_rec *c, int peer, const char *extension);
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
void ssl_var_log_config_register(apr_pool_t *p);
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/* Extract SSL_*_DN_* variables into table 't' from SSL object 'ssl',
|
|
Packit |
90a5c9 |
* allocating from 'p': */
|
|
Packit |
90a5c9 |
void modssl_var_extract_dns(apr_table_t *t, SSL *ssl, apr_pool_t *p);
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/* Extract SSL_*_SAN_* variables (subjectAltName entries) into table 't'
|
|
Packit |
90a5c9 |
* from SSL object 'ssl', allocating from 'p'. */
|
|
Packit |
90a5c9 |
void modssl_var_extract_san_entries(apr_table_t *t, SSL *ssl, apr_pool_t *p);
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#ifndef OPENSSL_NO_OCSP
|
|
Packit |
90a5c9 |
/* Perform OCSP validation of the current cert in the given context.
|
|
Packit |
90a5c9 |
* Returns non-zero on success or zero on failure. On failure, the
|
|
Packit |
90a5c9 |
* context error code is set. */
|
|
Packit |
90a5c9 |
int modssl_verify_ocsp(X509_STORE_CTX *ctx, SSLSrvConfigRec *sc,
|
|
Packit |
90a5c9 |
server_rec *s, conn_rec *c, apr_pool_t *pool);
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/* OCSP helper interface; dispatches the given OCSP request to the
|
|
Packit |
90a5c9 |
* responder at the given URI. Returns the decoded OCSP response
|
|
Packit |
90a5c9 |
* object, or NULL on error (in which case, errors will have been
|
|
Packit |
90a5c9 |
* logged). Pool 'p' is used for temporary allocations. */
|
|
Packit |
90a5c9 |
OCSP_RESPONSE *modssl_dispatch_ocsp_request(const apr_uri_t *uri,
|
|
Packit |
90a5c9 |
apr_interval_time_t timeout,
|
|
Packit |
90a5c9 |
OCSP_REQUEST *request,
|
|
Packit |
90a5c9 |
conn_rec *c, apr_pool_t *p);
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/* Initialize OCSP trusted certificate list */
|
|
Packit |
90a5c9 |
void ssl_init_ocsp_certificates(server_rec *s, modssl_ctx_t *mctx);
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/* Retrieve DH parameters for given key length. Return value should
|
|
Packit |
90a5c9 |
* be treated as unmutable, since it is stored in process-global
|
|
Packit |
90a5c9 |
* memory. */
|
|
Packit |
90a5c9 |
DH *modssl_get_dh_params(unsigned keylen);
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
int ssl_is_challenge(conn_rec *c, const char *servername,
|
|
Packit |
90a5c9 |
X509 **pcert, EVP_PKEY **pkey);
|
|
Packit |
90a5c9 |
|
|
Packit |
70c855 |
/* Returns non-zero if the cert/key filename should be handled through
|
|
Packit |
70c855 |
* the configured ENGINE. */
|
|
Packit |
70c855 |
int modssl_is_engine_id(const char *name);
|
|
Packit |
70c855 |
|
|
Packit |
90a5c9 |
#endif /* SSL_PRIVATE_H */
|
|
Packit |
90a5c9 |
/** @} */
|
|
Packit |
90a5c9 |
|