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 | static void gnutls_hooks(apr_pool_t * p) |
---|
21 | { |
---|
22 | ap_hook_pre_connection(mgs_hook_pre_connection, NULL, NULL, |
---|
23 | APR_HOOK_MIDDLE); |
---|
24 | ap_hook_post_config(mgs_hook_post_config, NULL, NULL, |
---|
25 | APR_HOOK_MIDDLE); |
---|
26 | ap_hook_child_init(mgs_hook_child_init, NULL, NULL, |
---|
27 | APR_HOOK_MIDDLE); |
---|
28 | #if USING_2_1_RECENT |
---|
29 | ap_hook_http_scheme(mgs_hook_http_scheme, NULL, NULL, |
---|
30 | APR_HOOK_MIDDLE); |
---|
31 | #else |
---|
32 | ap_hook_http_method(mgs_hook_http_scheme, NULL, NULL, |
---|
33 | APR_HOOK_MIDDLE); |
---|
34 | #endif |
---|
35 | ap_hook_default_port(mgs_hook_default_port, NULL, NULL, |
---|
36 | APR_HOOK_MIDDLE); |
---|
37 | ap_hook_pre_config(mgs_hook_pre_config, NULL, NULL, |
---|
38 | APR_HOOK_MIDDLE); |
---|
39 | |
---|
40 | ap_hook_access_checker(mgs_hook_authz, NULL, NULL, |
---|
41 | 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 | |
---|
58 | static 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("GnuTLSX509CAFile", mgs_set_client_ca_file, |
---|
68 | NULL, |
---|
69 | RSRC_CONF, |
---|
70 | "Set the CA File to verify Client Certificates"), |
---|
71 | AP_INIT_TAKE1("GnuTLSPGPKeyringFile", mgs_set_keyring_file, |
---|
72 | NULL, |
---|
73 | RSRC_CONF, |
---|
74 | "Set the Keyring File to verify Client Certificates"), |
---|
75 | AP_INIT_TAKE1("GnuTLSDHFile", mgs_set_dh_file, |
---|
76 | NULL, |
---|
77 | RSRC_CONF, |
---|
78 | "Set the file to read Diffie Hellman parameters from"), |
---|
79 | AP_INIT_TAKE1("GnuTLSRSAFile", mgs_set_rsa_export_file, |
---|
80 | NULL, |
---|
81 | RSRC_CONF, |
---|
82 | "Set the file to read RSA-EXPORT parameters from"), |
---|
83 | AP_INIT_TAKE1("GnuTLSCertificateFile", mgs_set_cert_file, |
---|
84 | NULL, |
---|
85 | RSRC_CONF, |
---|
86 | "SSL Server X509 Certificate file"), |
---|
87 | AP_INIT_TAKE1("GnuTLSKeyFile", mgs_set_key_file, |
---|
88 | NULL, |
---|
89 | RSRC_CONF, |
---|
90 | "SSL Server X509 Private Key file"), |
---|
91 | AP_INIT_TAKE1("GnuTLSX509CertificateFile", mgs_set_cert_file, |
---|
92 | NULL, |
---|
93 | RSRC_CONF, |
---|
94 | "SSL Server X509 Certificate file"), |
---|
95 | AP_INIT_TAKE1("GnuTLSX509KeyFile", mgs_set_key_file, |
---|
96 | NULL, |
---|
97 | RSRC_CONF, |
---|
98 | "SSL Server X509 Private Key file"), |
---|
99 | AP_INIT_TAKE1("GnuTLSPGPCertificateFile", mgs_set_pgpcert_file, |
---|
100 | NULL, |
---|
101 | RSRC_CONF, |
---|
102 | "SSL Server PGP Certificate file"), |
---|
103 | AP_INIT_TAKE1("GnuTLSPGPKeyFile", mgs_set_pgpkey_file, |
---|
104 | NULL, |
---|
105 | RSRC_CONF, |
---|
106 | "SSL Server PGP Private key file"), |
---|
107 | #ifdef ENABLE_SRP |
---|
108 | AP_INIT_TAKE1("GnuTLSSRPPasswdFile", mgs_set_srp_tpasswd_file, |
---|
109 | NULL, |
---|
110 | RSRC_CONF, |
---|
111 | "SSL Server SRP Password Conf file"), |
---|
112 | AP_INIT_TAKE1("GnuTLSSRPPasswdConfFile", |
---|
113 | mgs_set_srp_tpasswd_conf_file, |
---|
114 | NULL, |
---|
115 | RSRC_CONF, |
---|
116 | "SSL Server SRP Parameters file"), |
---|
117 | #endif |
---|
118 | AP_INIT_TAKE1("GnuTLSCacheTimeout", mgs_set_cache_timeout, |
---|
119 | NULL, |
---|
120 | RSRC_CONF, |
---|
121 | "Cache Timeout"), |
---|
122 | AP_INIT_TAKE12("GnuTLSCache", mgs_set_cache, |
---|
123 | NULL, |
---|
124 | RSRC_CONF, |
---|
125 | "Cache Configuration"), |
---|
126 | AP_INIT_TAKE1("GnuTLSSessionTickets", mgs_set_tickets, |
---|
127 | NULL, |
---|
128 | RSRC_CONF, |
---|
129 | "Session Tickets Configuration"), |
---|
130 | AP_INIT_RAW_ARGS("GnuTLSPriorities", mgs_set_priorities, |
---|
131 | NULL, |
---|
132 | RSRC_CONF, |
---|
133 | "The priorities to enable (ciphers, Key exchange, macs, compression)."), |
---|
134 | AP_INIT_TAKE1("GnuTLSEnable", mgs_set_enabled, |
---|
135 | NULL, |
---|
136 | RSRC_CONF, |
---|
137 | "Whether this server has GnuTLS Enabled. Default: Off"), |
---|
138 | AP_INIT_TAKE1("GnuTLSExportCertificates", |
---|
139 | mgs_set_export_certificates_enabled, |
---|
140 | NULL, |
---|
141 | RSRC_CONF, |
---|
142 | "Whether to export PEM encoded certificates to CGIs. Default: Off"), |
---|
143 | #if 0 |
---|
144 | AP_INIT_RAW_ARGS("<GnuTLSRequire", mgs_set_require_section, |
---|
145 | NULL, |
---|
146 | EXEC_ON_READ | OR_ALL, |
---|
147 | "Whether this server has GnuTLS Enabled. Default: Off"), |
---|
148 | AP_INIT_RAW_ARGS("GnuTLSRequireByteCode", mgs_set_require_bytecode, |
---|
149 | NULL, |
---|
150 | OR_ALL, |
---|
151 | "Internal Command for reading Lua Bytecode."), |
---|
152 | #endif |
---|
153 | {NULL} |
---|
154 | }; |
---|
155 | |
---|
156 | module AP_MODULE_DECLARE_DATA gnutls_module = { |
---|
157 | STANDARD20_MODULE_STUFF, |
---|
158 | mgs_config_dir_create, |
---|
159 | mgs_config_dir_merge, |
---|
160 | mgs_config_server_create, |
---|
161 | NULL, |
---|
162 | mgs_config_cmds, |
---|
163 | gnutls_hooks |
---|
164 | }; |
---|