Apache HTTPD
tls_conf.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#ifndef tls_conf_h
17#define tls_conf_h
18
19/* Configuration flags */
20#define TLS_FLAG_UNSET (-1)
21#define TLS_FLAG_FALSE (0)
22#define TLS_FLAG_TRUE (1)
23
24struct tls_proto_conf_t;
25struct tls_cert_reg_t;
31
32
33/* disabled, since rustls support is lacking
34 * - x.509 retrieval of certificate fields and extensions
35 * - certificate revocation lists (CRL)
36 * - x.509 access to issuer of trust chain in x.509 CA store:
37 * server CA has ca1, ca2, ca3
38 * client present certA
39 * rustls verifies that it is signed by *one of* ca* certs
40 * OCSP check needs (certA, issuing cert) for query
41 */
42#define TLS_CLIENT_CERTS 0
43
44/* support for this exists as PR <https://github.com/rustls/rustls-ffi/pull/128>
45 */
46#define TLS_MACHINE_CERTS 1
47
48
55
62
63/* The global module configuration, created after post-config
64 * and then readonly.
65 */
66typedef struct {
67 server_rec *ap_server; /* the global server we initialized on */
68 const char *module_version;
69 const char *crustls_version;
70
72 int mod_proxy_post_config_done; /* if mod_proxy did its post-config things */
73
74 server_addr_rec *tls_addresses; /* the addresses/ports our engine is enabled on */
75 apr_array_header_t *proxy_configs; /* tls_conf_proxy_t* collected from everywhere */
76
77 struct tls_proto_conf_t *proto; /* TLS protocol/rustls specific globals */
78 apr_hash_t *var_lookups; /* variable lookup functions by var name */
79 struct tls_cert_reg_t *cert_reg; /* all certified keys loaded */
80 struct tls_cert_root_stores_t *stores; /* loaded certificate stores */
81 struct tls_cert_verifiers_t *verifiers; /* registry of certificate verifiers */
82
83 const char *session_cache_spec; /* how the session cache was specified */
84 const struct ap_socache_provider_t *session_cache_provider; /* provider used for session cache */
85 struct ap_socache_instance_t *session_cache; /* session cache instance */
86 struct apr_global_mutex_t *session_cache_mutex; /* global mutex for access to session cache */
87
88 const rustls_server_config *rustls_hello_config; /* used for initial client hello parsing */
90
91/* The module configuration for a server (vhost).
92 * Populated during config parsing, merged and completed
93 * in the post config phase. Readonly after that.
94 */
95typedef struct {
96 server_rec *server; /* server this config belongs to */
97 tls_conf_global_t *global; /* global module config, singleton */
98
99 int enabled; /* TLS_FLAG_TRUE if mod_tls is active on this server */
100 apr_array_header_t *cert_specs; /* array of (tls_cert_spec_t*) of configured certificates */
101 int tls_protocol_min; /* the minimum TLS protocol version to use */
102 apr_array_header_t *tls_pref_ciphers; /* List of apr_uint16_t cipher ids to prefer */
103 apr_array_header_t *tls_supp_ciphers; /* List of apr_uint16_t cipher ids to suppress */
104 const apr_array_header_t *ciphersuites; /* Computed post-config, ordered list of rustls cipher suites */
105 int honor_client_order; /* honor client cipher ordering */
107
108 const char *client_ca; /* PEM file with trust anchors for client certs */
109 tls_client_auth_t client_auth; /* how client authentication with certificates is used */
110 const char *var_user_name; /* which SSL variable to use as user name */
111
112 apr_array_header_t *certified_keys; /* rustls_certified_key list configured */
113 int base_server; /* != 0 iff this is the base server */
114 int service_unavailable; /* TLS not trustworthy configured, return 503s */
116
117typedef struct {
118 server_rec *defined_in; /* the server/host defining this dir_conf */
119 tls_conf_global_t *global; /* global module config, singleton */
120 const char *proxy_ca; /* PEM file with trust anchors for proxied remote server certs */
121 int proxy_protocol_min; /* the minimum TLS protocol version to use for proxy connections */
122 apr_array_header_t *proxy_pref_ciphers; /* List of apr_uint16_t cipher ids to prefer */
123 apr_array_header_t *proxy_supp_ciphers; /* List of apr_uint16_t cipher ids to suppress */
124 apr_array_header_t *machine_cert_specs; /* configured machine certificates specs */
125 apr_array_header_t *machine_certified_keys; /* rustls_certified_key list */
126 const rustls_client_config *rustls_config;
128
129typedef struct {
132 int proxy_enabled; /* TLS_FLAG_TRUE if mod_tls is active on outgoing connections */
133 const char *proxy_ca; /* PEM file with trust anchors for proxied remote server certs */
134 int proxy_protocol_min; /* the minimum TLS protocol version to use for proxy connections */
135 apr_array_header_t *proxy_pref_ciphers; /* List of apr_uint16_t cipher ids to prefer */
136 apr_array_header_t *proxy_supp_ciphers; /* List of apr_uint16_t cipher ids to suppress */
137 apr_array_header_t *proxy_machine_cert_specs; /* configured machine certificates specs */
138
141
142/* our static registry of configuration directives. */
143extern const command_rec tls_conf_cmds[];
144
145/* create the modules configuration for a server_rec. */
147
148/* merge (inherit) server configurations for the module.
149 * Settings in 'add' overwrite the ones in 'base' and unspecified
150 * settings shine through. */
151void *tls_conf_merge_svr(apr_pool_t *pool, void *basev, void *addv);
152
153/* create the modules configuration for a directory. */
155
156/* merge (inherit) directory configurations for the module.
157 * Settings in 'add' overwrite the ones in 'base' and unspecified
158 * settings shine through. */
159void *tls_conf_merge_dir(apr_pool_t *pool, void *basev, void *addv);
160
161
162/* Get the server specific module configuration. */
164
165/* Get the directory specific module configuration for the request. */
167
168/* Get the directory specific module configuration for the server. */
170
171/* If any configuration values are unset, supply the global server defaults. */
173
174/* If any configuration values are unset, supply the global dir defaults. */
176
177/* create a new proxy configuration from directory config in server */
180
183 ap_conf_vector_t *section_config);
184
185#endif /* tls_conf_h */
struct ap_conf_vector_t ap_conf_vector_t
request_rec * r
apr_size_t size
const char int apr_pool_t * pool
Definition apr_cstr.h:84
int apr_status_t
Definition apr_errno.h:44
apr_dir_t * dir
const char * s
Definition apr_strings.h:95
apr_pool_t * p
Definition md_event.c:32
static long gc(server_rec *s)
A structure that represents the current request.
Definition httpd.h:845
A structure to be used for Per-vhost config.
Definition httpd.h:1301
A structure to store information for each virtual server.
Definition httpd.h:1322
apr_array_header_t * proxy_machine_cert_specs
Definition tls_conf.h:137
const char * proxy_ca
Definition tls_conf.h:133
apr_array_header_t * proxy_supp_ciphers
Definition tls_conf.h:136
apr_array_header_t * proxy_pref_ciphers
Definition tls_conf.h:135
int proxy_protocol_min
Definition tls_conf.h:134
tls_conf_proxy_t * proxy_config
Definition tls_conf.h:139
int export_cert_vars
Definition tls_conf.h:131
const struct ap_socache_provider_t * session_cache_provider
Definition tls_conf.h:84
const char * session_cache_spec
Definition tls_conf.h:83
const char * module_version
Definition tls_conf.h:68
int mod_proxy_post_config_done
Definition tls_conf.h:72
apr_array_header_t * proxy_configs
Definition tls_conf.h:75
tls_conf_status_t status
Definition tls_conf.h:71
server_addr_rec * tls_addresses
Definition tls_conf.h:74
struct tls_cert_reg_t * cert_reg
Definition tls_conf.h:79
struct tls_cert_root_stores_t * stores
Definition tls_conf.h:80
struct tls_cert_verifiers_t * verifiers
Definition tls_conf.h:81
struct apr_global_mutex_t * session_cache_mutex
Definition tls_conf.h:86
struct ap_socache_instance_t * session_cache
Definition tls_conf.h:85
struct tls_proto_conf_t * proto
Definition tls_conf.h:77
apr_hash_t * var_lookups
Definition tls_conf.h:78
const char * crustls_version
Definition tls_conf.h:69
server_rec * ap_server
Definition tls_conf.h:67
const rustls_server_config * rustls_hello_config
Definition tls_conf.h:88
const rustls_client_config * rustls_config
Definition tls_conf.h:126
apr_array_header_t * proxy_supp_ciphers
Definition tls_conf.h:123
apr_array_header_t * proxy_pref_ciphers
Definition tls_conf.h:122
apr_array_header_t * machine_certified_keys
Definition tls_conf.h:125
server_rec * defined_in
Definition tls_conf.h:118
apr_array_header_t * machine_cert_specs
Definition tls_conf.h:124
const char * proxy_ca
Definition tls_conf.h:120
tls_conf_global_t * global
Definition tls_conf.h:119
apr_array_header_t * certified_keys
Definition tls_conf.h:112
const char * client_ca
Definition tls_conf.h:108
tls_client_auth_t client_auth
Definition tls_conf.h:109
apr_array_header_t * tls_supp_ciphers
Definition tls_conf.h:103
apr_array_header_t * tls_pref_ciphers
Definition tls_conf.h:102
server_rec * server
Definition tls_conf.h:96
apr_array_header_t * cert_specs
Definition tls_conf.h:100
const char * var_user_name
Definition tls_conf.h:110
const apr_array_header_t * ciphersuites
Definition tls_conf.h:104
tls_conf_global_t * global
Definition tls_conf.h:97
tls_conf_status_t
Definition tls_conf.h:56
@ TLS_CONF_ST_DONE
Definition tls_conf.h:60
@ TLS_CONF_ST_INIT
Definition tls_conf.h:57
@ TLS_CONF_ST_OUTGOING_DONE
Definition tls_conf.h:59
@ TLS_CONF_ST_INCOMING_DONE
Definition tls_conf.h:58
void * tls_conf_merge_svr(apr_pool_t *pool, void *basev, void *addv)
Definition tls_conf.c:99
void * tls_conf_create_dir(apr_pool_t *pool, char *dir)
Definition tls_conf.c:138
const command_rec tls_conf_cmds[]
Definition tls_conf.c:736
tls_client_auth_t
Definition tls_conf.h:49
@ TLS_CLIENT_AUTH_REQUIRED
Definition tls_conf.h:52
@ TLS_CLIENT_AUTH_OPTIONAL
Definition tls_conf.h:53
@ TLS_CLIENT_AUTH_NONE
Definition tls_conf.h:51
@ TLS_CLIENT_AUTH_UNSET
Definition tls_conf.h:50
apr_status_t tls_conf_dir_apply_defaults(tls_conf_dir_t *dc, apr_pool_t *p)
Definition tls_conf.c:214
int tls_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)
Definition tls_conf.c:238
void * tls_conf_merge_dir(apr_pool_t *pool, void *basev, void *addv)
Definition tls_conf.c:187
void * tls_conf_create_svr(apr_pool_t *pool, server_rec *s)
Definition tls_conf.c:78
tls_conf_proxy_t * tls_conf_proxy_make(apr_pool_t *p, tls_conf_dir_t *dc, tls_conf_global_t *gc, server_rec *s)
Definition tls_conf.c:223
tls_conf_server_t * tls_conf_server_get(server_rec *s)
Definition tls_conf.c:68
apr_status_t tls_conf_server_apply_defaults(tls_conf_server_t *sc, apr_pool_t *p)
Definition tls_conf.c:203
tls_conf_dir_t * tls_conf_dir_get(request_rec *r)
Definition tls_conf.c:124
tls_conf_dir_t * tls_conf_dir_server_get(server_rec *s)
Definition tls_conf.c:131