source: mod_gnutls/src/mod_gnutls.c @ 70c2d86

debian/masterdebian/stretch-backportsjessie-backportsupstream upstream/0.3.4
Last change on this file since 70c2d86 was 70c2d86, checked in by Daniel Kahn Gillmor <dkg@…>, 7 years ago

Imported Upstream version 0.3.4

  • Property mode set to 100644
File size: 5.7 KB
Line 
1/**
2 *  Copyright 2004-2005 Paul Querna
3 *
4 *  Licensed under the Apache License, Version 2.0 (the "License");
5 *  you may not use this file except in compliance with the License.
6 *  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
18#include "mod_gnutls.h"
19
20
21static void gnutls_hooks(apr_pool_t * p)
22{
23    ap_hook_pre_connection(mgs_hook_pre_connection, NULL, NULL,
24                           APR_HOOK_MIDDLE);
25    ap_hook_post_config(mgs_hook_post_config, NULL, NULL,
26                        APR_HOOK_MIDDLE);
27    ap_hook_child_init(mgs_hook_child_init, NULL, NULL,
28                       APR_HOOK_MIDDLE);
29#if USING_2_1_RECENT
30    ap_hook_http_scheme(mgs_hook_http_scheme, NULL, NULL,
31                        APR_HOOK_MIDDLE);
32#else
33    ap_hook_http_method(mgs_hook_http_scheme, NULL, NULL,
34                        APR_HOOK_MIDDLE);
35#endif
36    ap_hook_default_port(mgs_hook_default_port, NULL, NULL,
37                         APR_HOOK_MIDDLE);
38    ap_hook_pre_config(mgs_hook_pre_config, NULL, NULL,
39                       APR_HOOK_MIDDLE);
40   
41    ap_hook_access_checker(mgs_hook_authz, NULL, NULL, APR_HOOK_REALLY_FIRST);
42   
43    ap_hook_fixups(mgs_hook_fixups, NULL, NULL, APR_HOOK_REALLY_FIRST);
44   
45    /* TODO: HTTP Upgrade Filter */
46    /* ap_register_output_filter ("UPGRADE_FILTER",
47     *          ssl_io_filter_Upgrade, NULL, AP_FTYPE_PROTOCOL + 5);
48     */
49
50    ap_register_input_filter(GNUTLS_INPUT_FILTER_NAME,
51                             mgs_filter_input, NULL,
52                             AP_FTYPE_CONNECTION + 5);
53    ap_register_output_filter(GNUTLS_OUTPUT_FILTER_NAME,
54                              mgs_filter_output, NULL,
55                              AP_FTYPE_CONNECTION + 5);
56}
57
58static const command_rec mgs_config_cmds[] = {
59    AP_INIT_TAKE1("GnuTLSClientVerify", mgs_set_client_verify,
60                  NULL,
61                  RSRC_CONF|OR_AUTHCFG,
62                  "Set Verification Requirements of the Client Certificate"),
63    AP_INIT_TAKE1("GnuTLSClientCAFile", mgs_set_client_ca_file,
64                  NULL,
65                  RSRC_CONF,
66                  "Set the CA File to verify Client Certificates"),
67    AP_INIT_TAKE1("GnuTLSDHFile", mgs_set_dh_file,
68                  NULL,
69                  RSRC_CONF,
70                  "Set the file to read Diffie Hellman parameters from"),
71    AP_INIT_TAKE1("GnuTLSRSAFile", mgs_set_rsa_export_file,
72                  NULL,
73                  RSRC_CONF,
74                  "Set the file to read RSA-EXPORT parameters from"),
75    AP_INIT_TAKE1("GnuTLSCertificateFile", mgs_set_cert_file,
76                  NULL,
77                  RSRC_CONF,
78                  "SSL Server Key file"),
79    AP_INIT_TAKE1("GnuTLSKeyFile", mgs_set_key_file,
80                  NULL,
81                  RSRC_CONF,
82                  "SSL Server SRP Password file"),
83    AP_INIT_TAKE1("GnuTLSSRPPasswdFile", mgs_set_srp_tpasswd_file,
84                  NULL,
85                  RSRC_CONF,
86                  "SSL Server SRP Password Conf file"),
87    AP_INIT_TAKE1("GnuTLSSRPPasswdConfFile", mgs_set_srp_tpasswd_conf_file,
88                  NULL,
89                  RSRC_CONF,
90                  "SSL Server SRP Parameters file"),
91    AP_INIT_TAKE1("GnuTLSCacheTimeout", mgs_set_cache_timeout,
92                  NULL,
93                  RSRC_CONF,
94                  "Cache Timeout"),
95    AP_INIT_TAKE2("GnuTLSCache", mgs_set_cache,
96                  NULL,
97                  RSRC_CONF,
98                  "Cache Configuration"),
99    AP_INIT_RAW_ARGS("GnuTLSCiphers", mgs_set_ciphers,
100                  NULL,
101                  RSRC_CONF,
102                  "The ciphers to enable (AES-128, 3DES, ARCFOUR-128, ARCFOUR-40)"),
103    AP_INIT_RAW_ARGS("GnuTLSKeyExchangeAlgorithms", mgs_set_kx,
104                  NULL,
105                  RSRC_CONF,
106                  "The key exchange algorithms to enable (RSA, DHE-RSA, DHE-DSS, RSA-EXPORT, SRP, SRP-RSA, SRP-DSS)"),
107    AP_INIT_RAW_ARGS("GnuTLSMACAlgorithms", mgs_set_mac,
108                  NULL,
109                  RSRC_CONF,
110                  "The MAC algorithms to utilize (SHA-1, MD5)"),
111    AP_INIT_RAW_ARGS("GnuTLSCompressionMethods", mgs_set_compression,
112                  NULL,
113                  RSRC_CONF,
114                  "The compression methods to utilize (NULL, ZLIB)"),
115    AP_INIT_RAW_ARGS("GnuTLSProtocols", mgs_set_protocols,
116                  NULL,
117                  RSRC_CONF,
118                  "The TLS protocol version to use (TLS1.1, TLS1.0, SSL3.0)"),
119    AP_INIT_TAKE1("GnuTLSEnable", mgs_set_enabled,
120                  NULL,
121                  RSRC_CONF,
122                  "Whether this server has GnuTLS Enabled. Default: Off"),
123    AP_INIT_TAKE1("GnuTLSExportCertificates", mgs_set_export_certificates_enabled,
124                  NULL,
125                  RSRC_CONF,
126                  "Whether to export PEM encoded certificates to CGIs. Default: Off"),
127#if 0
128    AP_INIT_RAW_ARGS("<GnuTLSRequire", mgs_set_require_section,
129                  NULL,
130                  EXEC_ON_READ|OR_ALL,
131                  "Whether this server has GnuTLS Enabled. Default: Off"),
132    AP_INIT_RAW_ARGS("GnuTLSRequireByteCode", mgs_set_require_bytecode,
133                     NULL,
134                     OR_ALL,
135                     "Internal Command for reading Lua Bytecode."),
136#endif
137    {NULL}
138};
139
140module AP_MODULE_DECLARE_DATA gnutls_module = {
141    STANDARD20_MODULE_STUFF,
142    mgs_config_dir_create,
143    mgs_config_dir_merge,
144    mgs_config_server_create,
145    NULL,
146    mgs_config_cmds,
147    gnutls_hooks
148};
Note: See TracBrowser for help on using the repository browser.