Consul
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. 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.
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.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.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.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.