TLS configuration parameters for Consul agent configuration files
This page provides reference information for TLS configuration parameters in a Consul agent configuration file.
TLS configuration parameters
This section documents all of the configuration settings that apply to Agent TLS. Agent TLS is used by the HTTP API, internal RPC, and gRPC/xDS interfaces. Some of these settings may also be applied automatically by auto_config or auto_encrypt.
Security Note: The Certificate Authority (CA) configured on the internal RPC interface
(either explicitly by tls.internal_rpc or implicitly by tls.defaults) should be a private
CA, not a public one. We recommend using a dedicated CA which should not be used with any other
systems. Any certificate signed by the CA will be allowed to communicate with the cluster and a
specially crafted certificate signed by the CA can be used to gain full access to Consul.
tlsAdded in Consul 1.12, for previous versions see Deprecated Options.defaultsProvides default settings that will be applied to every interface unless explicitly overridden bytls.grpc,tls.https, ortls.internal_rpc.ca_fileThis provides a file path to a PEM-encoded certificate authority. The certificate authority is used to check the authenticity of client and server connections with the appropriateverify_incomingorverify_outgoingflags.ca_pathThis provides a path to a directory of PEM-encoded certificate authority files. These certificate authorities are used to check the authenticity of client and server connections with the appropriateverify_incomingorverify_outgoingflags.cert_fileThis provides a file path to a PEM-encoded certificate. The certificate is provided to clients or servers to verify the agent's authenticity. It must be provided along withkey_file.key_fileThis provides a the file path to a PEM-encoded private key. The key is used with the certificate to verify the agent's authenticity. This must be provided along withcert_file.tls_min_versionThis specifies the minimum supported version of TLS. The following values are accepted:verify_server_hostnameWhen set to true, Consul verifies the TLS certificate presented by the servers match the hostnameserver.<datacenter>.<domain>. By default this is false, and Consul does not verify the hostname of the certificate, only that it is signed by a trusted CA.WARNING: TLS 1.1 and lower are generally considered less secure and should not be used if possible.
The following values are also valid, but only when using the deprecated top-level
tls_min_versionconfig, and will be removed in a future release:A warning message will appear if a deprecated value is specified.
tls_cipher_suitesThis specifies the list of supported ciphersuites as a comma-separated-list. Applicable to TLS 1.2 and below only. Consul rejects an explicittls_cipher_suitessetting, including an empty string, when the same stanza has a TLS 1.3 minimum. Remove the setting before raising that stanza's minimum to TLS 1.3. Protocol stanzas with a TLS 1.3 minimum do not inherit cipher suites fromtls.defaults. The list of all ciphersuites supported by Consul is available in the TLS configuration source code.Note: The ordering of cipher suites will not be guaranteed from Consul 1.11 onwards. See this post for details.
tls_ecdh_curvesSpecifies TLS key-exchange groups as a comma-separated string, not an array. Names are case-sensitive. Consul trims whitespace around each name. The supported values are:The Go-based agent TLS implementation supports all five groups.
X25519MLKEM768combines X25519 with ML-KEM-768 for hybrid post-quantum key exchange, which requires a TLS 1.3 handshake. Configuring groups accepts a minimum ofTLSv1_2,TLSv1_3,TLS_AUTO, or an unspecified minimum, but notTLSv1_0orTLSv1_1. An accepted configuration does not prove that a connection negotiates hybrid key exchange.Each protocol uses its explicit
tls_ecdh_curvesstring when present. Otherwise, a protocol with a compatible minimum TLS version inherits a nonempty list fromtls.defaults. Without an explicit or inherited list, an effective minimum ofTLSv1_3selectsX25519MLKEM768,X25519. Otherwise, Go TLS defaults apply. An empty string intls.defaultsdoes not prevent this automatic selection.An explicitly empty per-protocol string overrides inheritance and skips Consul's automatic selection, leaving Go TLS defaults in effect. Those defaults can include hybrid groups. Do not use an empty string or remove this setting to disable post-quantum key exchange. Use an explicit classical list, such as
"X25519", as described in Roll back post-quantum TLS.This setting does not enable TLS, replace certificate signatures with post-quantum signatures, or change certificate verification. Refer to Configure post-quantum TLS for component requirements and negotiated-group verification.
verify_incoming- If set to true, Consul requires that all incoming connections make use of TLS and that the client provides a certificate signed by a Certificate Authority from theca_fileorca_path. By default, this is false, and Consul will not enforce the use of TLS or verify a client's authenticity.verify_outgoing- If set to true, Consul requires that all outgoing connections from this agent make use of TLS and that the server provides a certificate that is signed by a Certificate Authority from theca_fileorca_path. By default, this is false, and Consul will not make use of TLS for outgoing connections. This applies to clients and servers as both will make outgoing connections. This setting does not apply to the gRPC interface as Consul makes no outgoing connections on this interface. When set to true for the HTTPS interface, this parameter applies to watches, which operate by making HTTPS requests to the local agent.
grpcProvides settings for the gRPC/xDS interface. To enable the gRPC interface you must define a port viaports.grpc_tls.ca_fileOverridestls.defaults.ca_file.ca_pathOverridestls.defaults.ca_path.cert_fileOverridestls.defaults.cert_file.key_fileOverridestls.defaults.key_file.tls_min_versionOverridestls.defaults.tls_min_version.tls_cipher_suitesOverridestls.defaults.tls_cipher_suites.tls_ecdh_curvesOverridestls.defaults.tls_ecdh_curvesfor the gRPC/xDS interface. Accepts a comma-separated string with the same supported values. An explicitly empty string uses Go TLS defaults, not an explicit classical-only policy.verify_incoming- Overridestls.defaults.verify_incoming.use_auto_cert- (Defaults tofalse) Enables or disables TLS on gRPC servers. Set totrueto allowauto_encryptTLS settings to apply to gRPC listeners. We recommend disabling TLS on gRPC servers if you are usingauto_encryptfor other TLS purposes, such as enabling HTTPS.
httpsProvides settings for the HTTPS interface. To enable the HTTPS interface you must define a port viaports.https.ca_fileOverridestls.defaults.ca_file.ca_pathOverridestls.defaults.ca_path.cert_fileOverridestls.defaults.cert_file.key_fileOverridestls.defaults.key_file.tls_min_versionOverridestls.defaults.tls_min_version.tls_cipher_suitesOverridestls.defaults.tls_cipher_suites.tls_ecdh_curvesOverridestls.defaults.tls_ecdh_curvesfor the HTTPS interface. Accepts a comma-separated string with the same supported values. An explicitly empty string uses Go TLS defaults, not an explicit classical-only policy.verify_incoming- Overridestls.defaults.verify_incoming.verify_outgoing- Overridestls.defaults.verify_outgoing.
internal_rpcProvides settings for the internal "server" RPC interface configured byports.server.ca_fileOverridestls.defaults.ca_file.ca_pathOverridestls.defaults.ca_path.cert_fileOverridestls.defaults.cert_file.key_fileOverridestls.defaults.key_file.tls_min_versionOverridestls.defaults.tls_min_version.tls_cipher_suitesOverridestls.defaults.tls_cipher_suites.tls_ecdh_curvesOverridestls.defaults.tls_ecdh_curvesfor the internal RPC interface. Accepts a comma-separated string with the same supported values. An explicitly empty string uses Go TLS defaults, not an explicit classical-only policy.verify_incoming- Overridestls.defaults.verify_incoming.Security Note:
verify_incomingmust be set to true to prevent anyone with access to the internal RPC port from gaining full access to the Consul cluster.verify_outgoingOverridestls.defaults.verify_outgoing.Security Note: Servers that specify
verify_outgoing = truewill always talk to other servers over TLS, but they still accept non-TLS connections to allow for a transition of all clients to TLS. Currently the only way to enforce that no client can communicate with a server unencrypted is to also enableverify_incomingwhich requires client certificates too.verify_server_hostnameOverrides tls.defaults.verify_server_hostname. When set to true, Consul verifies the TLS certificate presented by the servers match the hostnameserver.<datacenter>.<domain>. By default this is false, and Consul does not verify the hostname of the certificate, only that it is signed by a trusted CA.Security Note:
verify_server_hostnamemust be set to true to prevent a compromised client from gaining full read and write access to all cluster data including all ACL tokens and service mesh CA root keys.
server_nameWhen provided, this overrides thenode_namefor the TLS certificate. It can be used to ensure that the certificate name matches the hostname we declare.
Deprecated Options
The following options were deprecated in Consul 1.12, please use the
tls stanza instead.
ca_fileSee:tls.defaults.ca_file.ca_pathSee:tls.defaults.ca_path.tls_min_versionAdded in Consul 0.7.4. See:tls.defaults.tls_min_version.tls_cipher_suitesAdded in Consul 0.8.2. See:tls.defaults.tls_cipher_suites.tls_prefer_server_cipher_suitesAdded in Consul 0.8.2. This setting will be ignored (see this post for details).verify_server_hostnameSee:tls.internal_rpc.verify_server_hostname.
Examples
The following examples demonstrate common agent TLS configuration patterns.
Secure mTLS configuration
All three verify options should be set as true to enable
secure mTLS communication, enabling both encryption and authentication. Failing
to set verify_incoming or
verify_outgoing either in the
interface-specific stanza (e.g. tls.internal_rpc, tls.https) or in
tls.defaults results in TLS not being enabled at all, even when specifying
a ca_file, cert_file,
and key_file.
Review, especially, the use of the ports setting in the highlighted code
lines.
datacenter = "east-aws"
data_dir = "/opt/consul"
log_level = "INFO"
node_name = "foobar"
server = true
addresses = {
https = "0.0.0.0"
}
ports {
https = 8501
}
tls {
defaults {
key_file = "/etc/pki/tls/private/my.key"
cert_file = "/etc/pki/tls/certs/my.crt"
ca_file = "/etc/pki/tls/certs/ca-bundle.crt"
verify_incoming = true
verify_outgoing = true
verify_server_hostname = true
}
}
Consul does not enable TLS for the HTTP or gRPC API unless the https port has
been assigned a port number > 0. We recommend using 8501 for https as this
default automatically works with some tooling.
Hybrid post-quantum key exchange
The following configuration fragments allow hybrid X25519MLKEM768 key
exchange with classical X25519 fallback. A connection that selects X25519
does not use post-quantum key exchange. Both choices use TLS 1.3 in this example.
Agent TLS exposes a minimum version setting, not a tls_max_version setting.
Merge these settings into your existing TLS configuration. Preserve your CA,
certificate, private key, port, and certificate-verification settings,
including verify_incoming, verify_outgoing, and verify_server_hostname.
Remove explicit tls_cipher_suites settings in any stanza whose minimum you
set to TLSv1_3: TLS 1.3 cipher suites are not configurable. Review protocol
overrides because they take precedence over tls.defaults.
tls {
defaults {
tls_min_version = "TLSv1_3"
tls_ecdh_curves = "X25519MLKEM768,X25519"
}
}
Use Consul binaries that support tls_ecdh_curves and TLS peers that support
the selected groups and TLS version. Refer to
Configure post-quantum TLS for
requirements and verification, or
Migrate to post-quantum TLS
for staged adoption in an existing deployment.