|
4 | 4 | Configure TLS |
5 | 5 | ********************************************************************************* |
6 | 6 |
|
7 | | -:ref:`Collector receivers <otel-components-receivers>` leverage network configuration to set connection and transport information. |
| 7 | +Crypto TLS exposes a variety of settings you can adjust within individual receivers or exporters of the Collector. |
8 | 8 |
|
9 | | -Crypto TLS exposes a variety of settings. Several of these settings are available for configuration within individual receivers or exporters. |
| 9 | +.. note:: Mutual TLS (mTLS) is also supported. |
10 | 10 |
|
11 | | -Note that mutual TLS (mTLS) is also supported. |
| 11 | +Configure TLS / mTLS |
| 12 | +============================================================================================= |
12 | 13 |
|
13 | | -TLS / mTLS Configuration |
14 | | -By default, TLS is enabled: |
| 14 | +By default, TLS is enabled: |
15 | 15 |
|
16 | | -insecure (default = false): whether to enable client transport security for the exporter's HTTPs or gRPC connection. See grpc.WithInsecure() for gRPC. |
17 | | -As a result, the following parameters are also required: |
| 16 | +#. See the required and optional settings available |
| 17 | +#. To complete the TLS/mTLS configuration, proceed to :ref:`collector-common-config-tls-client` or :ref:`collector-common-config-tls-server` |
18 | 18 |
|
19 | | -cert_file: Path to the TLS cert to use for TLS required connections. Should only be used if insecure is set to false. |
| 19 | +Required settings |
| 20 | +--------------------------------- |
20 | 21 |
|
21 | | -cert_pem: Alternative to cert_file. Provide the certificate contents as a string instead of a filepath. |
22 | | -key_file: Path to the TLS key to use for TLS required connections. Should only be used if insecure is set to false. |
| 22 | +The following settings are required: |
23 | 23 |
|
24 | | -key_pem: Alternative to key_file. Provide the key contents as a string instead of a filepath. |
25 | | -A certificate authority may also need to be defined: |
| 24 | +* ``insecure``. ``false`` by default. Whether to enable client transport security for the exporter's HTTPs or gRPC connection. |
26 | 25 |
|
27 | | -ca_file: Path to the CA cert. For a client this verifies the server certificate. For a server this verifies client certificates. If empty uses system root CA. Should only be used if insecure is set to false. |
28 | | -ca_pem: Alternative to ca_file. Provide the CA cert contents as a string instead of a filepath. |
29 | | -You can also combine defining a certificate authority with the system certificate authorities. |
| 26 | + * For gRCP, see :new-page:`Golang's grpc.WithInsecure() <https://pkg.go.dev/google.golang.org/grpc#WithInsecure>`. |
30 | 27 |
|
31 | | -include_system_ca_certs_pool (default = false): whether to load the system certificate authorities pool alongside the certificate authority. |
32 | | -Additionally you can configure TLS to be enabled but skip verifying the server's certificate chain. This cannot be combined with insecure since insecure won't use TLS at all. |
| 28 | +* ``cert_file``. Use only if ``insecure`` is set to ``false``. Path to the TLS cert to use for TLS required connections. |
33 | 29 |
|
34 | | -insecure_skip_verify (default = false): whether to skip verifying the certificate or not. |
35 | | -Minimum and maximum TLS version can be set: |
| 30 | +* ``cert_pem``. Alternative to ``cert_file``. Provide the certificate contents as a string instead of a filepath. |
36 | 31 |
|
37 | | -IMPORTANT: TLS 1.0 and 1.1 are deprecated due to known vulnerabilities and should be avoided. |
| 32 | +* ``key_file``. Use only if ``insecure`` is set to ``false``. Path to the TLS key to use for TLS required connections. |
38 | 33 |
|
39 | | -min_version (default = "1.2"): Minimum acceptable TLS version. |
| 34 | +* ``key_pem``: Alternative to ``key_file``. Provide the key contents as a string instead of a filepath. |
40 | 35 |
|
41 | | -options: ["1.0", "1.1", "1.2", "1.3"] |
42 | | -max_version (default = "" handled by crypto/tls - currently TLS 1.3): Maximum acceptable TLS version. |
| 36 | +Additional settings |
| 37 | +--------------------------------- |
43 | 38 |
|
44 | | -options: ["1.0", "1.1", "1.2", "1.3"] |
45 | | -Explicit cipher suites can be set. If left blank, a safe default list is used. See https://go.dev/src/crypto/tls/cipher_suites.go for a list of supported cipher suites. |
| 39 | +Certificate authority |
| 40 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
46 | 41 |
|
47 | | -cipher_suites: (default = []): List of cipher suites to use. |
48 | | -Example: |
| 42 | +To define a certificate authority use: |
| 43 | + |
| 44 | +* ``ca_file``. Use only if ``insecure`` is set to ``false``. Path to the CA cert. |
| 45 | + |
| 46 | + * For a client this verifies the server certificate. |
| 47 | + |
| 48 | + * For a server this verifies client certificates. |
| 49 | + |
| 50 | + * If empty it uses the system root CA. |
| 51 | + |
| 52 | +* ``ca_pem``. Alternative to ``ca_file``. Provide the CA cert contents as a string instead of a filepath. |
| 53 | + |
| 54 | +To combine defining a certificate authority with the system certificate authorities use: |
| 55 | + |
| 56 | +* ``include_system_ca_certs_pool``. ``false`` by default. Whether to load the system certificate authorities pool alongside the certificate authority. |
| 57 | + |
| 58 | +Additionally you can configure TLS to be enabled but skip verifying the server's certificate chain. This cannot be combined with ``insecure`` since ``insecure`` won't use TLS at all. |
| 59 | + |
| 60 | +* ``insecure_skip_verify``. ``false`` by default. Whether to skip verifying the certificate or not. |
| 61 | + |
| 62 | +TLS version |
| 63 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 64 | + |
| 65 | +.. caution:: Avoid using TLS 1.0 and 1.1. Both are deprecated due to known vulnerabilities. |
| 66 | + |
| 67 | +You can set minimum and maximum TLS versions: |
| 68 | + |
| 69 | +* ``min_version``. "1.2" by default. Minimum acceptable TLS version. |
| 70 | + |
| 71 | + * Options: "1.0", "1.1", "1.2", "1.3" |
| 72 | + |
| 73 | +* ``max_version``. "" by default. Maximum acceptable TLS version. |
| 74 | + |
| 75 | + * Options: "1.0", "1.1", "1.2", "1.3" |
| 76 | + |
| 77 | +Cipher suites |
| 78 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 79 | + |
| 80 | +You can set explicit cipher suites using ``cipher_suites``. |
| 81 | + |
| 82 | +* ``[]`` by default. If left blank, a safe default list is used. |
| 83 | +* See the :new-page:`Cipher suites source files <https://go.dev/src/crypto/tls/cipher_suites.go>` for a list of supported cipher suites. |
| 84 | + |
| 85 | +For example: |
| 86 | + |
| 87 | +.. code-block:: yaml |
49 | 88 |
|
50 | 89 | cipher_suites: |
51 | 90 | - TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 |
52 | 91 | - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 |
53 | 92 | - TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 |
54 | | -Additionally certificates may be reloaded by setting the below configuration. |
55 | | - |
56 | | -reload_interval (optional) : ReloadInterval specifies the duration after which the certificate will be reloaded. If not set, it will never be reloaded. Accepts a duration string, valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". |
57 | | -How TLS/mTLS is configured depends on whether configuring the client or server. See below for examples. |
58 | | - |
59 | | -Client Configuration |
60 | | -Exporters leverage client configuration. The TLS configuration parameters are defined under tls, like server configuration. |
61 | | - |
62 | | -Beyond TLS configuration, the following setting can optionally be configured: |
63 | | - |
64 | | -server_name_override: If set to a non-empty string, it will override the virtual host name of authority (e.g. :authority header field) in requests (typically used for testing). |
65 | | -Example: |
66 | | - |
67 | | -exporters: |
68 | | - otlp: |
69 | | - endpoint: myserver.local:55690 |
70 | | - tls: |
71 | | - insecure: false |
72 | | - ca_file: server.crt |
73 | | - cert_file: client.crt |
74 | | - key_file: client.key |
75 | | - min_version: "1.1" |
76 | | - max_version: "1.2" |
77 | | - otlp/insecure: |
78 | | - endpoint: myserver.local:55690 |
79 | | - tls: |
80 | | - insecure: true |
81 | | - otlp/secure_no_verify: |
82 | | - endpoint: myserver.local:55690 |
83 | | - tls: |
84 | | - insecure: false |
85 | | - insecure_skip_verify: true |
86 | | -Server Configuration |
87 | | -Receivers leverage server configuration. |
88 | | - |
89 | | -Beyond TLS configuration, the following setting can optionally be configured (required for mTLS): |
90 | | - |
91 | | -client_ca_file: Path to the TLS cert to use by the server to verify a client certificate. (optional) This sets the ClientCAs and ClientAuth to RequireAndVerifyClientCert in the TLSConfig. Please refer to https://godoc.org/crypto/tls#Config for more information. |
92 | | -client_ca_file_reload (default = false): Reload the ClientCAs file when it is modified. |
93 | | -Example: |
94 | | - |
95 | | -receivers: |
96 | | - otlp: |
97 | | - protocols: |
98 | | - grpc: |
99 | | - endpoint: mysite.local:55690 |
100 | | - tls: |
101 | | - cert_file: server.crt |
102 | | - key_file: server.key |
103 | | - otlp/mtls: |
104 | | - protocols: |
105 | | - grpc: |
106 | | - endpoint: mysite.local:55690 |
107 | | - tls: |
108 | | - client_ca_file: client.pem |
109 | | - cert_file: server.crt |
110 | | - key_file: server.key |
111 | | - otlp/notls: |
112 | | - protocols: |
113 | | - grpc: |
114 | | - endpoint: mysite.local:55690 |
115 | 93 |
|
| 94 | +Reload certificates |
| 95 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 96 | + |
| 97 | +Optionally you can reload certificates with ``reload_interval``, which specifies the duration after which the certificate will be reloaded. |
| 98 | + |
| 99 | +* If not set, certificates are never reloaded. |
| 100 | +* Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". |
| 101 | + |
| 102 | +.. _collector-common-config-tls-client: |
| 103 | + |
| 104 | +Configure TLS clients |
| 105 | +============================================================================================= |
| 106 | + |
| 107 | +To configure TLS clients in :ref:`exporters <otel-components-exporters>` use the settings in the previous section. |
| 108 | + |
| 109 | +Optionally, you can also configure ``server_name_override``. |
| 110 | + |
| 111 | +* If set to a non-empty string, it will override the virtual host name of the authority in requests. |
| 112 | +* This is typically used for testing. |
| 113 | + |
| 114 | +For example: |
| 115 | + |
| 116 | +.. code-block:: yaml |
| 117 | +
|
| 118 | + exporters: |
| 119 | + otlp: |
| 120 | + endpoint: myserver.local:55690 |
| 121 | + tls: |
| 122 | + insecure: false |
| 123 | + ca_file: server.crt |
| 124 | + cert_file: client.crt |
| 125 | + key_file: client.key |
| 126 | + min_version: "1.1" |
| 127 | + max_version: "1.2" |
| 128 | + otlp/insecure: |
| 129 | + endpoint: myserver.local:55690 |
| 130 | + tls: |
| 131 | + insecure: true |
| 132 | + otlp/secure_no_verify: |
| 133 | + endpoint: myserver.local:55690 |
| 134 | + tls: |
| 135 | + insecure: false |
| 136 | + insecure_skip_verify: true |
| 137 | +
|
| 138 | +.. _collector-common-config-tls-server: |
| 139 | + |
| 140 | +Configure TLS servers |
| 141 | +============================================================================================= |
| 142 | + |
| 143 | +To configure TLS servers in :ref:`collector receivers <otel-components-receivers>` use the settings in the previous section. |
| 144 | + |
| 145 | +Optionally, you can also configure: |
| 146 | + |
| 147 | +* ``client_ca_file``. Path to the TLS cert to use by the server to verify a client certificate. This sets the ClientCAs and ClientAuth to ``RequireAndVerifyClientCert`` in the TLS configuration. Refer to :new-page:`https://godoc.org/crypto/tls#Config` for more information. |
| 148 | + |
| 149 | +* ``client_ca_file_reload``. ``false`` by default. Reloads the ClientCAs file when it is modified. |
| 150 | + |
| 151 | +.. note:: These are required for mTLS. |
| 152 | + |
| 153 | +For example: |
| 154 | + |
| 155 | +.. code-block:: yaml |
| 156 | +
|
| 157 | + receivers: |
| 158 | + otlp: |
| 159 | + protocols: |
| 160 | + grpc: |
| 161 | + endpoint: mysite.local:55690 |
| 162 | + tls: |
| 163 | + cert_file: server.crt |
| 164 | + key_file: server.key |
| 165 | + otlp/mtls: |
| 166 | + protocols: |
| 167 | + grpc: |
| 168 | + endpoint: mysite.local:55690 |
| 169 | + tls: |
| 170 | + client_ca_file: client.pem |
| 171 | + cert_file: server.crt |
| 172 | + key_file: server.key |
| 173 | + otlp/notls: |
| 174 | + protocols: |
| 175 | + grpc: |
| 176 | + endpoint: mysite.local:55690 |
116 | 177 |
|
| 178 | +Learn more |
| 179 | +============================================================================================= |
117 | 180 |
|
| 181 | +For more details on the available settings refer to :new-page:`TLS Configuration Settings <https://github.com/open-telemetry/opentelemetry-collector/tree/main/config/configtls>` in OTel's GitHub repo. |
0 commit comments