Mercurial > hg > nginx
annotate src/http/ngx_http_config.h @ 7732:59e1c73fe02b
SSL: ssl_reject_handshake directive (ticket #195).
In some cases it might be needed to reject SSL handshake based on SNI
server name provided, for example, to make sure an invalid certificate
is not returned to clients trying to contact a name-based virtual server
without SSL configured. Previously, a "ssl_ciphers aNULL;" was used for
this. This workaround, however, is not compatible with TLSv1.3, in
particular, when using BoringSSL, where it is not possible to configure
TLSv1.3 ciphers at all.
With this change, the ssl_reject_handshake directive is introduced,
which instructs nginx to reject SSL handshakes with an "unrecognized_name"
alert in a particular server block.
For example, to reject handshake with names other than example.com,
one can use the following configuration:
server {
listen 443 ssl;
ssl_reject_handshake on;
}
server {
listen 443 ssl;
server_name example.com;
ssl_certificate example.com.crt;
ssl_certificate_key example.com.key;
}
The following configuration can be used to reject all SSL handshakes
without SNI server name provided:
server {
listen 443 ssl;
ssl_reject_handshake on;
}
server {
listen 443 ssl;
server_name ~^;
ssl_certificate example.crt;
ssl_certificate_key example.key;
}
Additionally, the ssl_reject_handshake directive makes configuring
certificates for the default server block optional. If no certificates
are configured in the default server for a given listening socket,
certificates must be defined in all non-default server blocks with
the listening socket in question.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Thu, 22 Oct 2020 18:02:28 +0300 |
parents | d620f497c50f |
children |
rev | line source |
---|---|
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
424
diff
changeset
|
1 |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
424
diff
changeset
|
2 /* |
444
42d11f017717
nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents:
441
diff
changeset
|
3 * Copyright (C) Igor Sysoev |
4412 | 4 * Copyright (C) Nginx, Inc. |
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
424
diff
changeset
|
5 */ |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
424
diff
changeset
|
6 |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
424
diff
changeset
|
7 |
10
4f3879d9b6f6
nginx-0.0.1-2002-09-11-19:18:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
8 #ifndef _NGX_HTTP_CONFIG_H_INCLUDED_ |
4f3879d9b6f6
nginx-0.0.1-2002-09-11-19:18:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
9 #define _NGX_HTTP_CONFIG_H_INCLUDED_ |
4f3879d9b6f6
nginx-0.0.1-2002-09-11-19:18:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
10 |
4f3879d9b6f6
nginx-0.0.1-2002-09-11-19:18:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
11 |
521 | 12 #include <ngx_config.h> |
13 #include <ngx_core.h> | |
10
4f3879d9b6f6
nginx-0.0.1-2002-09-11-19:18:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
14 #include <ngx_http.h> |
4f3879d9b6f6
nginx-0.0.1-2002-09-11-19:18:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
15 |
41
59e7c7f30d49
nginx-0.0.1-2002-12-26-19:26:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
26
diff
changeset
|
16 |
59e7c7f30d49
nginx-0.0.1-2002-12-26-19:26:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
26
diff
changeset
|
17 typedef struct { |
591 | 18 void **main_conf; |
19 void **srv_conf; | |
20 void **loc_conf; | |
41
59e7c7f30d49
nginx-0.0.1-2002-12-26-19:26:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
26
diff
changeset
|
21 } ngx_http_conf_ctx_t; |
59e7c7f30d49
nginx-0.0.1-2002-12-26-19:26:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
26
diff
changeset
|
22 |
10
4f3879d9b6f6
nginx-0.0.1-2002-09-11-19:18:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
23 |
69
e43f406e4525
nginx-0.0.1-2003-03-20-19:09:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
59
diff
changeset
|
24 typedef struct { |
509 | 25 ngx_int_t (*preconfiguration)(ngx_conf_t *cf); |
26 ngx_int_t (*postconfiguration)(ngx_conf_t *cf); | |
69
e43f406e4525
nginx-0.0.1-2003-03-20-19:09:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
59
diff
changeset
|
27 |
356
2e3cbc1bbe3c
nginx-0.0.7-2004-06-16-19:32:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
311
diff
changeset
|
28 void *(*create_main_conf)(ngx_conf_t *cf); |
2e3cbc1bbe3c
nginx-0.0.7-2004-06-16-19:32:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
311
diff
changeset
|
29 char *(*init_main_conf)(ngx_conf_t *cf, void *conf); |
177
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
30 |
356
2e3cbc1bbe3c
nginx-0.0.7-2004-06-16-19:32:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
311
diff
changeset
|
31 void *(*create_srv_conf)(ngx_conf_t *cf); |
2e3cbc1bbe3c
nginx-0.0.7-2004-06-16-19:32:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
311
diff
changeset
|
32 char *(*merge_srv_conf)(ngx_conf_t *cf, void *prev, void *conf); |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
33 |
356
2e3cbc1bbe3c
nginx-0.0.7-2004-06-16-19:32:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
311
diff
changeset
|
34 void *(*create_loc_conf)(ngx_conf_t *cf); |
2e3cbc1bbe3c
nginx-0.0.7-2004-06-16-19:32:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
311
diff
changeset
|
35 char *(*merge_loc_conf)(ngx_conf_t *cf, void *prev, void *conf); |
69
e43f406e4525
nginx-0.0.1-2003-03-20-19:09:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
59
diff
changeset
|
36 } ngx_http_module_t; |
e43f406e4525
nginx-0.0.1-2003-03-20-19:09:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
59
diff
changeset
|
37 |
e43f406e4525
nginx-0.0.1-2003-03-20-19:09:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
59
diff
changeset
|
38 |
96
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
39 #define NGX_HTTP_MODULE 0x50545448 /* "HTTP" */ |
69
e43f406e4525
nginx-0.0.1-2003-03-20-19:09:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
59
diff
changeset
|
40 |
311
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
177
diff
changeset
|
41 #define NGX_HTTP_MAIN_CONF 0x02000000 |
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
177
diff
changeset
|
42 #define NGX_HTTP_SRV_CONF 0x04000000 |
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
177
diff
changeset
|
43 #define NGX_HTTP_LOC_CONF 0x08000000 |
485 | 44 #define NGX_HTTP_UPS_CONF 0x10000000 |
45 #define NGX_HTTP_SIF_CONF 0x20000000 | |
631 | 46 #define NGX_HTTP_LIF_CONF 0x40000000 |
47 #define NGX_HTTP_LMT_CONF 0x80000000 | |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
42
diff
changeset
|
48 |
69
e43f406e4525
nginx-0.0.1-2003-03-20-19:09:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
59
diff
changeset
|
49 |
90
37530da31268
nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
88
diff
changeset
|
50 #define NGX_HTTP_MAIN_CONF_OFFSET offsetof(ngx_http_conf_ctx_t, main_conf) |
37530da31268
nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
88
diff
changeset
|
51 #define NGX_HTTP_SRV_CONF_OFFSET offsetof(ngx_http_conf_ctx_t, srv_conf) |
37530da31268
nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
88
diff
changeset
|
52 #define NGX_HTTP_LOC_CONF_OFFSET offsetof(ngx_http_conf_ctx_t, loc_conf) |
41
59e7c7f30d49
nginx-0.0.1-2002-12-26-19:26:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
26
diff
changeset
|
53 |
59e7c7f30d49
nginx-0.0.1-2002-12-26-19:26:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
26
diff
changeset
|
54 |
499 | 55 #define ngx_http_get_module_main_conf(r, module) \ |
56 (r)->main_conf[module.ctx_index] | |
57 #define ngx_http_get_module_srv_conf(r, module) (r)->srv_conf[module.ctx_index] | |
58 #define ngx_http_get_module_loc_conf(r, module) (r)->loc_conf[module.ctx_index] | |
69
e43f406e4525
nginx-0.0.1-2003-03-20-19:09:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
59
diff
changeset
|
59 |
393
5659d773cfa8
nginx-0.0.7-2004-07-15-20:35:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
356
diff
changeset
|
60 |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
61 #define ngx_http_conf_get_module_main_conf(cf, module) \ |
501 | 62 ((ngx_http_conf_ctx_t *) cf->ctx)->main_conf[module.ctx_index] |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
63 #define ngx_http_conf_get_module_srv_conf(cf, module) \ |
501 | 64 ((ngx_http_conf_ctx_t *) cf->ctx)->srv_conf[module.ctx_index] |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
65 #define ngx_http_conf_get_module_loc_conf(cf, module) \ |
501 | 66 ((ngx_http_conf_ctx_t *) cf->ctx)->loc_conf[module.ctx_index] |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
67 |
393
5659d773cfa8
nginx-0.0.7-2004-07-15-20:35:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
356
diff
changeset
|
68 #define ngx_http_cycle_get_module_main_conf(cycle, module) \ |
2713
b4d8aef4a1ad
fix segfault if no http section is defined in confguraiton,
Igor Sysoev <igor@sysoev.ru>
parents:
631
diff
changeset
|
69 (cycle->conf_ctx[ngx_http_module.index] ? \ |
b4d8aef4a1ad
fix segfault if no http section is defined in confguraiton,
Igor Sysoev <igor@sysoev.ru>
parents:
631
diff
changeset
|
70 ((ngx_http_conf_ctx_t *) cycle->conf_ctx[ngx_http_module.index]) \ |
b4d8aef4a1ad
fix segfault if no http section is defined in confguraiton,
Igor Sysoev <igor@sysoev.ru>
parents:
631
diff
changeset
|
71 ->main_conf[module.ctx_index]: \ |
b4d8aef4a1ad
fix segfault if no http section is defined in confguraiton,
Igor Sysoev <igor@sysoev.ru>
parents:
631
diff
changeset
|
72 NULL) |
69
e43f406e4525
nginx-0.0.1-2003-03-20-19:09:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
59
diff
changeset
|
73 |
41
59e7c7f30d49
nginx-0.0.1-2002-12-26-19:26:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
26
diff
changeset
|
74 |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
44
diff
changeset
|
75 #endif /* _NGX_HTTP_CONFIG_H_INCLUDED_ */ |