⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mod_ssl.c

📁 apache服务器源代码(版本号:2.2.2)
💻 C
📖 第 1 页 / 共 2 页
字号:
/* Copyright 2001-2005 The Apache Software Foundation or its licensors, as * applicable. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * *     http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *//*                      _             _ *  _ __ ___   ___   __| |    ___ ___| |  mod_ssl * | '_ ` _ \ / _ \ / _` |   / __/ __| |  Apache Interface to OpenSSL * | | | | | | (_) | (_| |   \__ \__ \ | * |_| |_| |_|\___/ \__,_|___|___/___/_| *                      |_____| *  mod_ssl.c *  Apache API interface structures */#include "ssl_private.h"#include "mod_ssl.h"#include "util_md5.h"#include <assert.h>/* *  the table of configuration directives we provide */#define SSL_CMD_ALL(name, args, desc) \        AP_INIT_##args("SSL"#name, ssl_cmd_SSL##name, \                       NULL, RSRC_CONF|OR_AUTHCFG, desc),#define SSL_CMD_SRV(name, args, desc) \        AP_INIT_##args("SSL"#name, ssl_cmd_SSL##name, \                       NULL, RSRC_CONF, desc),#define SSL_CMD_DIR(name, type, args, desc) \        AP_INIT_##args("SSL"#name, ssl_cmd_SSL##name, \                       NULL, OR_##type, desc),#define AP_END_CMD { NULL }const char ssl_valid_ssl_mutex_string[] =    "Valid SSLMutex mechanisms are: `none', `default'"#if APR_HAS_FLOCK_SERIALIZE    ", `flock:/path/to/file'"#endif#if APR_HAS_FCNTL_SERIALIZE    ", `fcntl:/path/to/file'"#endif#if APR_HAS_SYSVSEM_SERIALIZE && !defined(PERCHILD_MPM)    ", `sysvsem'"#endif#if APR_HAS_POSIXSEM_SERIALIZE    ", `posixsem'"#endif#if APR_HAS_PROC_PTHREAD_SERIALIZE    ", `pthread'"#endif#if APR_HAS_FLOCK_SERIALIZE || APR_HAS_FCNTL_SERIALIZE    ", `file:/path/to/file'"#endif#if (APR_HAS_SYSVSEM_SERIALIZE && !defined(PERCHILD_MPM)) || APR_HAS_POSIXSEM_SERIALIZE    ", `sem'"#endif    " ";static const command_rec ssl_config_cmds[] = {    /*     * Global (main-server) context configuration directives     */    SSL_CMD_SRV(Mutex, TAKE1, ssl_valid_ssl_mutex_string)    SSL_CMD_SRV(PassPhraseDialog, TAKE1,                "SSL dialog mechanism for the pass phrase query "                "(`builtin', `|/path/to/pipe_program`, "                "or `exec:/path/to/cgi_program')")    SSL_CMD_SRV(SessionCache, TAKE1,                "SSL Session Cache storage "                "(`none', `nonenotnull', `dbm:/path/to/file')")#if defined(HAVE_OPENSSL_ENGINE_H) && defined(HAVE_ENGINE_INIT)    SSL_CMD_SRV(CryptoDevice, TAKE1,                "SSL external Crypto Device usage "                "(`builtin', `...')")#endif    SSL_CMD_SRV(RandomSeed, TAKE23,                "SSL Pseudo Random Number Generator (PRNG) seeding source "                "(`startup|connect builtin|file:/path|exec:/path [bytes]')")    /*     * Per-server context configuration directives     */    SSL_CMD_SRV(Engine, TAKE1,                "SSL switch for the protocol engine "                "(`on', `off')")    SSL_CMD_ALL(CipherSuite, TAKE1,                "Colon-delimited list of permitted SSL Ciphers "                "(`XXX:...:XXX' - see manual)")    SSL_CMD_SRV(CertificateFile, TAKE1,                "SSL Server Certificate file "                "(`/path/to/file' - PEM or DER encoded)")    SSL_CMD_SRV(CertificateKeyFile, TAKE1,                "SSL Server Private Key file "                "(`/path/to/file' - PEM or DER encoded)")    SSL_CMD_SRV(CertificateChainFile, TAKE1,                "SSL Server CA Certificate Chain file "                "(`/path/to/file' - PEM encoded)")    SSL_CMD_ALL(CACertificatePath, TAKE1,                "SSL CA Certificate path "                "(`/path/to/dir' - contains PEM encoded files)")    SSL_CMD_ALL(CACertificateFile, TAKE1,                "SSL CA Certificate file "                "(`/path/to/file' - PEM encoded)")    SSL_CMD_SRV(CADNRequestPath, TAKE1,                "SSL CA Distinguished Name path "                "(`/path/to/dir' - symlink hashes to PEM of acceptable CA names to request)")    SSL_CMD_SRV(CADNRequestFile, TAKE1,                "SSL CA Distinguished Name file "                "(`/path/to/file' - PEM encoded to derive acceptable CA names to request)")    SSL_CMD_SRV(CARevocationPath, TAKE1,                "SSL CA Certificate Revocation List (CRL) path "                "(`/path/to/dir' - contains PEM encoded files)")    SSL_CMD_SRV(CARevocationFile, TAKE1,                "SSL CA Certificate Revocation List (CRL) file "                "(`/path/to/file' - PEM encoded)")    SSL_CMD_ALL(VerifyClient, TAKE1,                "SSL Client verify type "                "(`none', `optional', `require', `optional_no_ca')")    SSL_CMD_ALL(VerifyDepth, TAKE1,                "SSL Client verify depth "                "(`N' - number of intermediate certificates)")    SSL_CMD_SRV(SessionCacheTimeout, TAKE1,                "SSL Session Cache object lifetime "                "(`N' - number of seconds)")    SSL_CMD_SRV(Protocol, RAW_ARGS,                "Enable or disable various SSL protocols"                "(`[+-][SSLv2|SSLv3|TLSv1] ...' - see manual)")    SSL_CMD_SRV(HonorCipherOrder, FLAG,                "Use the server's cipher ordering preference")    SSL_CMD_ALL(UserName, TAKE1,                "Set user name to SSL variable value")    /*     * Proxy configuration for remote SSL connections     */    SSL_CMD_SRV(ProxyEngine, FLAG,                "SSL switch for the proxy protocol engine "                "(`on', `off')")    SSL_CMD_SRV(ProxyProtocol, RAW_ARGS,               "SSL Proxy: enable or disable SSL protocol flavors "               "(`[+-][SSLv2|SSLv3|TLSv1] ...' - see manual)")    SSL_CMD_SRV(ProxyCipherSuite, TAKE1,               "SSL Proxy: colon-delimited list of permitted SSL ciphers "               "(`XXX:...:XXX' - see manual)")    SSL_CMD_SRV(ProxyVerify, TAKE1,               "SSL Proxy: whether to verify the remote certificate "               "(`on' or `off')")    SSL_CMD_SRV(ProxyVerifyDepth, TAKE1,               "SSL Proxy: maximum certificate verification depth "               "(`N' - number of intermediate certificates)")    SSL_CMD_SRV(ProxyCACertificateFile, TAKE1,               "SSL Proxy: file containing server certificates "               "(`/path/to/file' - PEM encoded certificates)")    SSL_CMD_SRV(ProxyCACertificatePath, TAKE1,               "SSL Proxy: directory containing server certificates "               "(`/path/to/dir' - contains PEM encoded certificates)")    SSL_CMD_SRV(ProxyCARevocationPath, TAKE1,                "SSL Proxy: CA Certificate Revocation List (CRL) path "                "(`/path/to/dir' - contains PEM encoded files)")    SSL_CMD_SRV(ProxyCARevocationFile, TAKE1,                "SSL Proxy: CA Certificate Revocation List (CRL) file "                "(`/path/to/file' - PEM encoded)")    SSL_CMD_SRV(ProxyMachineCertificateFile, TAKE1,               "SSL Proxy: file containing client certificates "               "(`/path/to/file' - PEM encoded certificates)")    SSL_CMD_SRV(ProxyMachineCertificatePath, TAKE1,               "SSL Proxy: directory containing client certificates "               "(`/path/to/dir' - contains PEM encoded certificates)")    /*     * Per-directory context configuration directives     */    SSL_CMD_DIR(Options, OPTIONS, RAW_ARGS,               "Set one or more options to configure the SSL engine"               "(`[+-]option[=value] ...' - see manual)")    SSL_CMD_DIR(RequireSSL, AUTHCFG, NO_ARGS,               "Require the SSL protocol for the per-directory context "               "(no arguments)")    SSL_CMD_DIR(Require, AUTHCFG, RAW_ARGS,               "Require a boolean expression to evaluate to true for granting access"               "(arbitrary complex boolean expression - see manual)")    /* Deprecated directives. */    AP_INIT_RAW_ARGS("SSLLog", ap_set_deprecated, NULL, OR_ALL,      "SSLLog directive is no longer supported - use ErrorLog."),    AP_INIT_RAW_ARGS("SSLLogLevel", ap_set_deprecated, NULL, OR_ALL,      "SSLLogLevel directive is no longer supported - use LogLevel."),    AP_END_CMD};/* *  the various processing hooks */static apr_status_t ssl_cleanup_pre_config(void *data){    /*     * Try to kill the internals of the SSL library.     */#ifdef HAVE_OPENSSL#if OPENSSL_VERSION_NUMBER >= 0x00907001    /* Corresponds to OPENSSL_load_builtin_modules():     * XXX: borrowed from apps.h, but why not CONF_modules_free()     * which also invokes CONF_modules_finish()?     */    CONF_modules_unload(1);#endif#endif    /* Corresponds to SSL_library_init: */    EVP_cleanup();#if HAVE_ENGINE_LOAD_BUILTIN_ENGINES    ENGINE_cleanup();#endif#ifdef HAVE_OPENSSL#if OPENSSL_VERSION_NUMBER >= 0x00907001    CRYPTO_cleanup_all_ex_data();#endif#endif    ERR_remove_state(0);    /* Don't call ERR_free_strings here; ERR_load_*_strings only     * actually load the error strings once per process due to static     * variable abuse in OpenSSL. */    /*     * TODO: determine somewhere we can safely shove out diagnostics     *       (when enabled) at this late stage in the game:     * CRYPTO_mem_leaks_fp(stderr);     */    return APR_SUCCESS;}static int ssl_hook_pre_config(apr_pool_t *pconf,                               apr_pool_t *plog,                               apr_pool_t *ptemp){    /* We must register the library in full, to ensure our configuration     * code can successfully test the SSL environment.     */    CRYPTO_malloc_init();#ifdef HAVE_OPENSSL    ERR_load_crypto_strings();#endif    SSL_load_error_strings();

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -