Skip to content

Commit f87e566

Browse files
author
Julien Pivotto
authored
tls: enable the selection of more TLS settings (prometheus#1695)
tls: enable the selection of more TLS settings * Rename `tls_config` to `tls_server_config`. * Add new http server config with HTTP/2 enabled by default. Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
1 parent 0c53298 commit f87e566

27 files changed

Lines changed: 433 additions & 40 deletions

https/README.md

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,48 @@ The config file should be written in YAML format, and is reloaded on each connec
1414
## Sample Config
1515

1616
```
17-
tls_config:
18-
# Certificate and key files for server to use to authenticate to client
17+
tls_server_config:
18+
# Certificate and key files for server to use to authenticate to client.
1919
cert_file: <filename>
2020
key_file: <filename>
2121
22-
# Server policy for client authentication. Maps to ClientAuth Policies
22+
# Server policy for client authentication. Maps to ClientAuth Policies.
2323
# For more detail on clientAuth options: [ClientAuthType](https://golang.org/pkg/crypto/tls/#ClientAuthType)
2424
[ client_auth_type: <string> | default = "NoClientCert" ]
2525
26-
# CA certificate for client certificate authentication to the server
26+
# CA certificate for client certificate authentication to the server.
2727
[ client_ca_file: <filename> ]
2828
29+
# Minimum TLS version that is acceptable.
30+
[ min_version: <string> | default = "TLS12" ]
31+
32+
# Maximum TLS version that is acceptable.
33+
[ max_version: <string> | default = "TLS13" ]
34+
35+
# List of supported cipher suites for TLS versions up to TLS 1.2. If empty,
36+
# Go default cipher suites are used. Available cipher suites are documented
37+
# in the go documentation:
38+
# https://golang.org/pkg/crypto/tls/#pkg-constants
39+
[ cipher_suites:
40+
[ - <string> ] ]
41+
42+
# prefer_server_cipher_suites controls whether the server selects the
43+
# client's most preferred ciphersuite, or the server's most preferred
44+
# ciphersuite. If true then the server's preference, as expressed in
45+
# the order of elements in cipher_suites, is used.
46+
[ prefer_server_cipher_suites: <bool> | default = true ]
47+
48+
# Elliptic curves that will be used in an ECDHE handshake, in preference
49+
# order. Available curves are documented in the go documentation:
50+
# https://golang.org/pkg/crypto/tls/#CurveID
51+
[ curve_preferences:
52+
[ - <string> ] ]
53+
54+
http_server_config:
55+
# Enable HTTP/2 support. Note that HTTP/2 is only supported with TLS.
56+
# This can not be changed on the fly.
57+
[ http2: <bool> | default = true ]
58+
2959
# List of usernames and hashed passwords that have full access to the web
3060
# server via basic authentication. If empty, no basic authentication is
3161
# required. Passwords are hashed with bcrypt.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
tls_config :
1+
tls_server_config :
22
cert_file : "testdata/server.crt"
33
key_file : "testdata/server.key"
44
client_ca_file : "somefile"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
tls_config :
1+
tls_server_config :
22
cert_file : "testdata/server.crt"
33
key_file : "testdata/server.key"
44
client_auth_type : "RequireAndVerifyClientCert"

https/testdata/tls_config_auth_user_list_invalid.bad.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
tls_config :
1+
tls_server_config :
22
cert_file : "testdata/server.crt"
33
key_file : "testdata/server.key"
44
basic_auth_users:
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
tls_config :
1+
tls_server_config :
22
cert_filse: "testdata/server.crt"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
tls_config :
1+
tls_server_config :
22
cert_file : "testdata/server.crt"
33
key_file : "testdata/server.key"
44
client_ca_file : "testdata/tls-ca-chain.pem"

https/testdata/tls_config_noAuth.good.blocking.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
tls_config :
1+
tls_server_config :
22
cert_file : "testdata/server.crt"
33
key_file : "testdata/server.key"
44
client_auth_type : "RequireAndVerifyClientCert"

https/testdata/tls_config_noAuth.good.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
tls_config :
1+
tls_server_config :
22
cert_file : "testdata/server.crt"
33
key_file : "testdata/server.key"
44
client_auth_type : "VerifyClientCertIfGiven"
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
tls_server_config :
2+
cert_file : "testdata/server.crt"
3+
key_file : "testdata/server.key"
4+
client_auth_type : "VerifyClientCertIfGiven"
5+
client_ca_file : "testdata/tls-ca-chain.pem"
6+
cipher_suites:
7+
- TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
8+
- TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
9+
- TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
10+
- TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
11+
- TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256
12+
- TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256
13+
- TLS_AES_128_GCM_SHA256
14+
- TLS_AES_256_GCM_SHA384
15+
- TLS_CHACHA20_POLY1305_SHA256
16+
- TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA
17+
- TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA
18+
- TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA
19+
- TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA
20+
- TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA
21+
- TLS_RSA_WITH_3DES_EDE_CBC_SHA
22+
- TLS_RSA_WITH_AES_128_CBC_SHA
23+
- TLS_RSA_WITH_AES_256_CBC_SHA
24+
- TLS_RSA_WITH_AES_128_GCM_SHA256
25+
- TLS_RSA_WITH_AES_256_GCM_SHA384
26+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
tls_server_config :
2+
cert_file : "testdata/server.crt"
3+
key_file : "testdata/server.key"
4+
client_auth_type : "VerifyClientCertIfGiven"
5+
client_ca_file : "testdata/tls-ca-chain.pem"
6+
curve_preferences:
7+
- CurveP256
8+
- CurveP384
9+
- CurveP521
10+
- X25519

0 commit comments

Comments
 (0)