| 1 |
# TLS Configuration Settings |
| 2 |
|
| 3 |
Crypto TLS exposes a [variety of settings](https://godoc.org/crypto/tls). |
| 4 |
Several of these settings are available for configuration within individual |
| 5 |
receivers or exporters. |
| 6 |
|
| 7 |
Note that mutual TLS (mTLS) is also supported. |
| 8 |
|
| 9 |
## TLS / mTLS Configuration |
| 10 |
|
| 11 |
By default, TLS is enabled: |
| 12 |
|
| 13 |
- `insecure` (default = false): whether to enable client transport security for |
| 14 |
the exporter's HTTPs or gRPC connection. See |
| 15 |
[grpc.WithInsecure()](https://godoc.org/google.golang.org/grpc#WithInsecure) |
| 16 |
for gRPC. |
| 17 |
- `curve_preferences` (default = []): specify your curve preferences that will |
| 18 |
be used in an ECDHE handshake, in preference order. Accepted values are: |
| 19 |
- X25519 |
| 20 |
- P521 |
| 21 |
- P256 |
| 22 |
- P384 |
| 23 |
|
| 24 |
As a result, the following parameters are also required: |
| 25 |
|
| 26 |
- `cert_file`: Path to the TLS cert to use for TLS required connections. Should |
| 27 |
only be used if `insecure` is set to false. |
| 28 |
- `cert_pem`: Alternative to `cert_file`. Provide the certificate contents as a string instead of a filepath. |
| 29 |
|
| 30 |
- `key_file`: Path to the TLS key to use for TLS required connections. Should |
| 31 |
only be used if `insecure` is set to false. |
| 32 |
- `key_pem`: Alternative to `key_file`. Provide the key contents as a string instead of a filepath. |
| 33 |
|
| 34 |
A certificate authority may also need to be defined: |
| 35 |
|
| 36 |
- `ca_file`: Path to the CA cert. For a client this verifies the server |
| 37 |
certificate. For a server this verifies client certificates. If empty uses |
| 38 |
system root CA. Should only be used if `insecure` is set to false. |
| 39 |
- `ca_pem`: Alternative to `ca_file`. Provide the CA cert contents as a string instead of a filepath. |
| 40 |
|
| 41 |
You can also combine defining a certificate authority with the system certificate authorities. |
| 42 |
|
| 43 |
- `include_system_ca_certs_pool` (default = false): whether to load the system certificate authorities pool |
| 44 |
alongside the certificate authority. |
| 45 |
|
| 46 |
Additionally you can configure TLS to be enabled but skip verifying the server's |
| 47 |
certificate chain. This cannot be combined with `insecure` since `insecure` |
| 48 |
won't use TLS at all. |
| 49 |
|
| 50 |
- `insecure_skip_verify` (default = false): whether to skip verifying the |
| 51 |
certificate or not. |
| 52 |
|
| 53 |
Minimum and maximum TLS version can be set: |
| 54 |
|
| 55 |
__IMPORTANT__: TLS 1.0 and 1.1 are deprecated due to known vulnerabilities and should be avoided. |
| 56 |
|
| 57 |
- `min_version` (default = "1.2"): Minimum acceptable TLS version. |
| 58 |
- options: ["1.0", "1.1", "1.2", "1.3"] |
| 59 |
|
| 60 |
- `max_version` (default = "" handled by [crypto/tls](https://github.com/golang/go/blob/ed9db1d36ad6ef61095d5941ad9ee6da7ab6d05a/src/crypto/tls/common.go#L700) - currently TLS 1.3): Maximum acceptable TLS version. |
| 61 |
- options: ["1.0", "1.1", "1.2", "1.3"] |
| 62 |
|
| 63 |
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. |
| 64 |
- `cipher_suites`: (default = []): List of cipher suites to use. |
| 65 |
|
| 66 |
Example: |
| 67 |
``` |
| 68 |
cipher_suites: |
| 69 |
- TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 |
| 70 |
- TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 |
| 71 |
- TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 |
| 72 |
``` |
| 73 |
|
| 74 |
Additionally certificates may be reloaded by setting the below configuration. |
| 75 |
|
| 76 |
- `reload_interval` (optional) : ReloadInterval specifies the duration after which the certificate will be reloaded. |
| 77 |
If not set, it will never be reloaded. |
| 78 |
Accepts a [duration string](https://pkg.go.dev/time#ParseDuration), |
| 79 |
valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". |
| 80 |
|
| 81 |
How TLS/mTLS is configured depends on whether configuring the client or server. |
| 82 |
See below for examples. |
| 83 |
|
| 84 |
- `tpm` (optional): Use the trusted platform module to retrieve the TLS key. |
| 85 |
|
| 86 |
## Client Configuration |
| 87 |
|
| 88 |
[Exporters](https://github.com/open-telemetry/opentelemetry-collector/blob/main/exporter/README.md) |
| 89 |
leverage client configuration. The TLS configuration parameters are defined |
| 90 |
under `tls`, like server configuration. |
| 91 |
|
| 92 |
Beyond TLS configuration, the following setting can optionally be configured: |
| 93 |
|
| 94 |
- `server_name_override`: If set to a non-empty string, it will override the |
| 95 |
virtual host name of authority (e.g. :authority header field) in requests |
| 96 |
(typically used for testing). |
| 97 |
|
| 98 |
Example: |
| 99 |
|
| 100 |
```yaml |
| 101 |
exporters: |
| 102 |
otlp: |
| 103 |
endpoint: myserver.local:55690 |
| 104 |
tls: |
| 105 |
insecure: false |
| 106 |
ca_file: server.crt |
| 107 |
cert_file: client.crt |
| 108 |
key_file: client.key |
| 109 |
min_version: "1.1" |
| 110 |
max_version: "1.2" |
| 111 |
otlp/insecure: |
| 112 |
endpoint: myserver.local:55690 |
| 113 |
tls: |
| 114 |
insecure: true |
| 115 |
otlp/secure_no_verify: |
| 116 |
endpoint: myserver.local:55690 |
| 117 |
tls: |
| 118 |
insecure: false |
| 119 |
insecure_skip_verify: true |
| 120 |
``` |
| 121 |
|
| 122 |
## Server Configuration |
| 123 |
|
| 124 |
[Receivers](https://github.com/open-telemetry/opentelemetry-collector/blob/main/receiver/README.md) |
| 125 |
leverage server configuration. |
| 126 |
|
| 127 |
Beyond TLS configuration, the following setting can optionally be configured |
| 128 |
(required for mTLS): |
| 129 |
|
| 130 |
- `client_ca_file`: Path to the TLS cert to use by the server to verify a |
| 131 |
client certificate. (optional) This sets the ClientCAs and ClientAuth to |
| 132 |
RequireAndVerifyClientCert in the TLSConfig. Please refer to |
| 133 |
https://godoc.org/crypto/tls#Config for more information. |
| 134 |
- `client_ca_file_reload` (default = false): Reload the ClientCAs file when it is modified. |
| 135 |
|
| 136 |
Example: |
| 137 |
|
| 138 |
```yaml |
| 139 |
receivers: |
| 140 |
otlp: |
| 141 |
protocols: |
| 142 |
grpc: |
| 143 |
endpoint: mysite.local:55690 |
| 144 |
tls: |
| 145 |
cert_file: server.crt |
| 146 |
key_file: server.key |
| 147 |
otlp/mtls: |
| 148 |
protocols: |
| 149 |
grpc: |
| 150 |
endpoint: mysite.local:55690 |
| 151 |
tls: |
| 152 |
client_ca_file: client.pem |
| 153 |
cert_file: server.crt |
| 154 |
key_file: server.key |
| 155 |
otlp/notls: |
| 156 |
protocols: |
| 157 |
grpc: |
| 158 |
endpoint: mysite.local:55690 |
| 159 |
``` |
| 160 |
|
| 161 |
## Trusted platform module (TPM) configuration |
| 162 |
|
| 163 |
The [trusted platform module](https://trustedcomputinggroup.org/resource/trusted-platform-module-tpm-summary/) (TPM) configuration can be used for loading TLS key from TPM. Currently only TSS2 format is supported. |
| 164 |
|
| 165 |
- `enabled` (default = false): Enables loading `tls.key_file` from TPM. |
| 166 |
|
| 167 |
- `path` (default = ""): The path to the TPM device or Unix domain socket. For instance `/dev/tpm0` or `/dev/tpmrm0`. This option is not supported on Windows. |
| 168 |
|
| 169 |
- `owner_auth` (default = ""): The owner authorization value. This is used to authenticate the TPM device. If not set, the default owner authorization will be used. |
| 170 |
|
| 171 |
- `auth` (default = ""): The authorization value. This is used to authenticate the TPM device. If not set, the default authorization will be used. |
| 172 |
|
| 173 |
Example: |
| 174 |
|
| 175 |
```yaml |
| 176 |
exporters: |
| 177 |
otlp: |
| 178 |
endpoint: myserver.local:55690 |
| 179 |
tls: |
| 180 |
ca_file: ca.crt |
| 181 |
cert_file: client.crt |
| 182 |
key_file: client-tss2.key |
| 183 |
tpm: |
| 184 |
enabled: true |
| 185 |
path: /dev/tpmrm0 |
| 186 |
``` |
| 187 |
|
| 188 |
The `client-tss2.key` private key with TSS2 format will be loaded from the TPM device `/dev/tpmrm0`. |