diff options
author | Omar Polo <op@omarpolo.com> | 2021-01-15 18:55:05 +0000 |
---|---|---|
committer | Omar Polo <op@omarpolo.com> | 2021-01-15 18:55:05 +0000 |
commit | 5bc3c98ed4e25bc68a72dd6cd6676b25d2cdf9cd (patch) | |
tree | 2f07a9d7e8345965cb50eb65d464c79c0a85753c | |
parent | 8696c5ea2484893ba0422d9bd4732d15d24eb1fc (diff) |
add protocols to the config
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | gmid.c | 4 | ||||
-rw-r--r-- | gmid.h | 1 | ||||
-rw-r--r-- | lex.l | 1 | ||||
-rw-r--r-- | parse.y | 6 | ||||
-rw-r--r-- | sample.conf | 3 |
6 files changed, 14 insertions, 3 deletions
@@ -1,5 +1,7 @@ 2021-01-15 Omar Polo <op@omarpolo.com> + * parse.y (option): add ability to specify the tls versions with "protocols" + * gmid.c (handle_open_conn): ensure the port number of the request matches * sandbox.c (sandbox): sandbox on OpenBSD (pledge/unveil, as before) and on FreeBSD (capsicum) too @@ -979,6 +979,7 @@ main(int argc, char **argv) conf.foreground = 1; conf.port = 1965; conf.ipv6 = 0; + conf.protos = TLS_PROTOCOL_TLSv1_2 | TLS_PROTOCOL_TLSv1_3; connected_clients = 0; @@ -1067,8 +1068,7 @@ main(int argc, char **argv) tls_config_verify_client_optional(tlsconf); tls_config_insecure_noverifycert(tlsconf); - if (tls_config_set_protocols(tlsconf, - TLS_PROTOCOL_TLSv1_2 | TLS_PROTOCOL_TLSv1_3) == -1) + if (tls_config_set_protocols(tlsconf, conf.protos) == -1) err(1, "tls_config_set_protocols"); load_vhosts(tlsconf); @@ -68,6 +68,7 @@ struct conf { int foreground; int port; int ipv6; + uint32_t protos; }; extern struct conf conf; @@ -54,6 +54,7 @@ off yylval.num = 0; return TBOOL; daemon return TDAEMON; ipv6 return TIPV6; port return TPORT; +protocols return TPROTOCOLS; server return TSERVER; cert return TCERT; @@ -43,7 +43,7 @@ extern void yyerror(const char*); } %token TBOOL TSTRING TNUM -%token TDAEMON TIPV6 TPORT TSERVER +%token TDAEMON TIPV6 TPORT TPROTOCOLS TSERVER %token TCERT TKEY TROOT TCGI %token TERR @@ -62,6 +62,10 @@ options : /* empty */ option : TDAEMON TBOOL { conf.foreground = !$2; } | TIPV6 TBOOL { conf.ipv6 = $2; } | TPORT TNUM { conf.port = $2; } + | TPROTOCOLS TSTRING { + if (tls_config_parse_protocols(&conf.protos, $2) == -1) + errx(1, "invalid protocols string \"%s\"", $2); + } ; vhosts : /* empty */ diff --git a/sample.conf b/sample.conf index 86252da..646b930 100644 --- a/sample.conf +++ b/sample.conf @@ -1,6 +1,9 @@ ipv6 on # enable ipv6 daemon on # enable daemon mode +# decomment to allow only TLSv1.3 +#protocols "tlsv1.3" + # server block example server "example.com" { cert "/path/to/cert.pem" |