2020-05-13 21:29:40 +00:00
|
|
|
---
|
|
|
|
layout: docs
|
|
|
|
page_title: 'Configuration Entry Kind: Terminating Gateway'
|
2020-06-18 21:27:06 +00:00
|
|
|
sidebar_title: terminating-gateway
|
2020-05-13 21:29:40 +00:00
|
|
|
description: >-
|
|
|
|
The `terminating-gateway` config entry kind allows for configuring terminating gateways
|
|
|
|
to proxy traffic from services in the Consul service mesh to services outside the mesh.
|
|
|
|
---
|
|
|
|
|
2020-06-18 21:27:06 +00:00
|
|
|
# Terminating Gateway
|
2020-05-13 21:29:40 +00:00
|
|
|
|
|
|
|
-> **1.8.0+:** This config entry is available in Consul versions 1.8.0 and newer.
|
|
|
|
|
2020-07-08 23:09:00 +00:00
|
|
|
The `terminating-gateway` config entry kind you to configure terminating gateways
|
|
|
|
to proxy traffic from services in the Consul service mesh to services registered with Consul that do not have a
|
|
|
|
[Connect service sidecar proxy](/docs/connect/proxies). The configuration is associated with the name of a gateway service
|
|
|
|
and will apply to all instances of the gateway with that name.
|
2020-05-13 21:29:40 +00:00
|
|
|
|
|
|
|
~> [Configuration entries](/docs/agent/config-entries) are global in scope. A configuration entry for a gateway name applies
|
2020-07-08 23:09:00 +00:00
|
|
|
across all federated Consul datacenters. If terminating gateways in different Consul datacenters need to route to different
|
|
|
|
sets of services within their datacenter then the terminating gateways **must** be registered with different names.
|
2020-05-13 21:29:40 +00:00
|
|
|
|
2020-07-08 23:09:00 +00:00
|
|
|
See [Terminating Gateway](/docs/connect/terminating-gateway) for more information.
|
2020-05-13 21:29:40 +00:00
|
|
|
|
|
|
|
## TLS Origination
|
|
|
|
|
2020-07-08 23:09:00 +00:00
|
|
|
By specifying a path to a [CA file](/docs/agent/config-entries/terminating-gateway#cafile) connections
|
|
|
|
from the terminating gateway will be encrypted using one-way TLS authentication. If a path to a
|
|
|
|
[client certificate](/docs/agent/config-entries/terminating-gateway#certfile)
|
|
|
|
and [private key](/docs/agent/config-entries/terminating-gateway#keyfile) are also specified connections
|
|
|
|
from the terminating gateway will be encrypted using mutual TLS authentication.
|
|
|
|
|
|
|
|
If none of these are provided, Consul will **only** encrypt connections to the gateway and not
|
|
|
|
from the gateway to the destination service.
|
2020-05-13 21:29:40 +00:00
|
|
|
|
|
|
|
## Wildcard service specification
|
|
|
|
|
2020-07-08 23:09:00 +00:00
|
|
|
Terminating gateways can optionally target all services within a Consul namespace by specifying a wildcard "\*"
|
|
|
|
as the service name. Configuration options set on the wildcard act as defaults that can be overridden
|
|
|
|
by options set on a specific service name.
|
2020-05-13 21:29:40 +00:00
|
|
|
|
2020-07-08 23:09:00 +00:00
|
|
|
Note that if the wildcard specifier is used, and some services in that namespace have a Connect sidecar proxy,
|
|
|
|
traffic from the mesh to those services will be evenly load-balanced between the gateway and their sidecars.
|
2020-05-13 21:29:40 +00:00
|
|
|
|
|
|
|
## Sample Config Entries
|
|
|
|
|
2020-06-24 22:10:46 +00:00
|
|
|
<Tabs>
|
|
|
|
<Tab heading="HCL">
|
|
|
|
|
|
|
|
Link gateway named "us-west-gateway" with the billing service:
|
2020-05-13 21:29:40 +00:00
|
|
|
|
|
|
|
```hcl
|
|
|
|
Kind = "terminating-gateway"
|
|
|
|
Name = "us-west-gateway"
|
2020-06-24 22:10:46 +00:00
|
|
|
|
2020-05-13 21:29:40 +00:00
|
|
|
Services = [
|
|
|
|
{
|
|
|
|
Name = "billing"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
```
|
|
|
|
|
2020-06-24 22:10:46 +00:00
|
|
|
</Tab>
|
|
|
|
<Tab heading="HCL (Consul Enterprise)">
|
|
|
|
|
|
|
|
Link gateway named "us-west-gateway" in the default namespace with the billing service in the finance namespace:
|
|
|
|
|
|
|
|
```hcl
|
|
|
|
Kind = "terminating-gateway"
|
|
|
|
Name = "us-west-gateway"
|
|
|
|
Namespace = "default"
|
|
|
|
|
|
|
|
Services = [
|
|
|
|
{
|
|
|
|
Namespace = "finance"
|
|
|
|
Name = "billing"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
```
|
|
|
|
|
|
|
|
</Tab>
|
|
|
|
<Tab heading="JSON">
|
|
|
|
|
|
|
|
Link gateway named "us-west-gateway" with the billing service:
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"Kind": "terminating-gateway",
|
|
|
|
"Name": "us-west-gateway",
|
|
|
|
"Services": [
|
|
|
|
{
|
|
|
|
"Name": "billing"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
</Tab>
|
|
|
|
<Tab heading="JSON (Consul Enterprise)">
|
|
|
|
|
|
|
|
Link gateway named "us-west-gateway" in the default namespace with the billing service in the finance namespace:
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"Kind": "terminating-gateway",
|
|
|
|
"Name": "us-west-gateway",
|
|
|
|
"Namespace": "default",
|
|
|
|
"Services": [
|
|
|
|
{
|
|
|
|
"Namespace": "finance",
|
|
|
|
"Name": "billing"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
</Tab>
|
|
|
|
</Tabs>
|
|
|
|
|
|
|
|
<Tabs>
|
|
|
|
<Tab heading="HCL">
|
|
|
|
|
|
|
|
Link gateway named "us-west-gateway" with the billing service and specify a CA file for one-way TLS authentication:
|
2020-05-13 21:29:40 +00:00
|
|
|
|
|
|
|
```hcl
|
|
|
|
Kind = "terminating-gateway"
|
|
|
|
Name = "us-west-gateway"
|
2020-06-24 22:10:46 +00:00
|
|
|
|
2020-05-13 21:29:40 +00:00
|
|
|
Services = [
|
|
|
|
{
|
2020-06-24 22:10:46 +00:00
|
|
|
Name = "billing"
|
|
|
|
CAFile = "/etc/certs/ca-chain.cert.pem"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
```
|
|
|
|
|
|
|
|
</Tab>
|
|
|
|
<Tab heading="HCL (Consul Enterprise)">
|
|
|
|
|
|
|
|
Link gateway named "us-west-gateway" in the default namespace with the billing service in the finance namespace,
|
|
|
|
and specify a CA file for one-way TLS authentication:
|
|
|
|
|
|
|
|
```hcl
|
|
|
|
Kind = "terminating-gateway"
|
|
|
|
Name = "us-west-gateway"
|
|
|
|
Namespace = "default"
|
|
|
|
|
|
|
|
Services = [
|
|
|
|
{
|
|
|
|
Namespace = "finance"
|
|
|
|
Name = "billing"
|
2020-05-13 21:29:40 +00:00
|
|
|
CAFile = "/etc/certs/ca-chain.cert.pem"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
```
|
|
|
|
|
2020-06-24 22:10:46 +00:00
|
|
|
</Tab>
|
|
|
|
<Tab heading="JSON">
|
|
|
|
|
|
|
|
Link gateway named "us-west-gateway" with the billing service and specify a CA file for one-way TLS authentication:
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"Kind": "terminating-gateway",
|
|
|
|
"Name": "us-west-gateway",
|
|
|
|
"Services": [
|
|
|
|
{
|
|
|
|
"Name": "billing",
|
|
|
|
"CAFile": "/etc/certs/ca-chain.cert.pem"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
</Tab>
|
|
|
|
<Tab heading="JSON (Consul Enterprise)">
|
|
|
|
|
|
|
|
Link gateway named "us-west-gateway" in the default namespace with the billing service in the finance namespace,
|
|
|
|
and specify a CA file for one-way TLS authentication:
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"Kind": "terminating-gateway",
|
|
|
|
"Name": "us-west-gateway",
|
|
|
|
"Namespace": "default",
|
|
|
|
"Services": [
|
|
|
|
{
|
|
|
|
"Namespace": "finance",
|
|
|
|
"Name": "billing",
|
|
|
|
"CAFile": "/etc/certs/ca-chain.cert.pem"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
</Tab>
|
|
|
|
</Tabs>
|
|
|
|
|
|
|
|
<Tabs>
|
|
|
|
<Tab heading="HCL">
|
|
|
|
|
|
|
|
Link gateway named "us-west-gateway" with the payments service and specify a CA file, key file, and cert file for mutual TLS authentication:
|
2020-05-13 21:29:40 +00:00
|
|
|
|
|
|
|
```hcl
|
|
|
|
Kind = "terminating-gateway"
|
|
|
|
Name = "us-west-gateway"
|
2020-06-24 22:10:46 +00:00
|
|
|
|
2020-05-13 21:29:40 +00:00
|
|
|
Services = [
|
|
|
|
{
|
2020-06-24 22:10:46 +00:00
|
|
|
Name = "billing"
|
|
|
|
CAFile = "/etc/certs/ca-chain.cert.pem"
|
|
|
|
KeyFile = "/etc/certs/gateway.key.pem"
|
|
|
|
CertFile = "/etc/certs/gateway.cert.pem"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
```
|
|
|
|
|
|
|
|
</Tab>
|
|
|
|
<Tab heading="HCL (Consul Enterprise)">
|
|
|
|
|
|
|
|
Link gateway named "us-west-gateway" in the default namespace with the payments service in the finance namespace.
|
|
|
|
Also specify a CA file, key file, and cert file for mutual TLS authentication:
|
|
|
|
|
|
|
|
```hcl
|
|
|
|
Kind = "terminating-gateway"
|
|
|
|
Name = "us-west-gateway"
|
|
|
|
Namespace = "default"
|
|
|
|
|
|
|
|
Services = [
|
|
|
|
{
|
|
|
|
Namespace = "finance"
|
|
|
|
Name = "billing"
|
2020-05-13 21:29:40 +00:00
|
|
|
CAFile = "/etc/certs/ca-chain.cert.pem"
|
|
|
|
KeyFile = "/etc/certs/gateway.key.pem"
|
|
|
|
CertFile = "/etc/certs/gateway.cert.pem"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
```
|
|
|
|
|
2020-06-24 22:10:46 +00:00
|
|
|
</Tab>
|
|
|
|
<Tab heading="JSON">
|
|
|
|
|
|
|
|
Link gateway named "us-west-gateway" with the payments service and specify a CA file, key file, and cert file for mutual TLS authentication:
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"Kind": "terminating-gateway",
|
|
|
|
"Name": "us-west-gateway",
|
|
|
|
"Services": [
|
|
|
|
{
|
|
|
|
"Name": "billing",
|
|
|
|
"CAFile": "/etc/certs/ca-chain.cert.pem",
|
|
|
|
"KeyFile": "/etc/certs/gateway.key.pem",
|
|
|
|
"CertFile": "/etc/certs/gateway.cert.pem"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
</Tab>
|
|
|
|
<Tab heading="JSON (Consul Enterprise)">
|
|
|
|
|
|
|
|
Link gateway named "us-west-gateway" in the default namespace with the payments service in the finance namespace.
|
|
|
|
Also specify a CA file, key file, and cert file for mutual TLS authentication:
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"Kind": "terminating-gateway",
|
|
|
|
"Name": "us-west-gateway",
|
|
|
|
"Namespace": "default",
|
|
|
|
"Services": [
|
|
|
|
{
|
|
|
|
"Namespace": "finance",
|
|
|
|
"Name": "billing",
|
|
|
|
"CAFile": "/etc/certs/ca-chain.cert.pem",
|
|
|
|
"KeyFile": "/etc/certs/gateway.key.pem",
|
|
|
|
"CertFile": "/etc/certs/gateway.cert.pem"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
</Tab>
|
|
|
|
</Tabs>
|
|
|
|
|
|
|
|
<Tabs>
|
|
|
|
<Tab heading="HCL">
|
|
|
|
|
|
|
|
Link gateway named "us-west-gateway" with all services in the datacenter, and configure default certificates for mutual TLS.
|
2020-05-13 21:29:40 +00:00
|
|
|
Also override the SNI and CA file used for connections to the billing service:
|
|
|
|
|
2020-06-24 22:10:46 +00:00
|
|
|
```hcl
|
|
|
|
Kind = "terminating-gateway"
|
|
|
|
Name = "us-west-gateway"
|
|
|
|
|
|
|
|
Services = [
|
|
|
|
{
|
|
|
|
Name = "*"
|
|
|
|
CAFile = "/etc/common-certs/ca-chain.cert.pem"
|
|
|
|
KeyFile = "/etc/common-certs/gateway.key.pem"
|
|
|
|
CertFile = "/etc/common-certs/gateway.cert.pem"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name = "billing"
|
|
|
|
CAFile = "/etc/billing-ca/ca-chain.cert.pem",
|
|
|
|
SNI = "billing.service.com"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
```
|
|
|
|
|
|
|
|
</Tab>
|
|
|
|
<Tab heading="HCL (Consul Enterprise)">
|
|
|
|
|
2020-07-08 23:09:00 +00:00
|
|
|
Link gateway named "us-west-gateway" in the default namespace with all services in the finance namespace,
|
2020-06-24 22:10:46 +00:00
|
|
|
and configure default certificates for mutual TLS. Also override the SNI and CA file used for connections to the billing service:
|
|
|
|
|
2020-05-13 21:29:40 +00:00
|
|
|
```hcl
|
|
|
|
Kind = "terminating-gateway"
|
|
|
|
Name = "us-west-gateway"
|
|
|
|
Namespace = "default"
|
2020-06-24 22:10:46 +00:00
|
|
|
|
2020-05-13 21:29:40 +00:00
|
|
|
Services = [
|
|
|
|
{
|
|
|
|
Namespace = "finance"
|
|
|
|
Name = "*"
|
|
|
|
CAFile = "/etc/common-certs/ca-chain.cert.pem"
|
|
|
|
KeyFile = "/etc/common-certs/gateway.key.pem"
|
|
|
|
CertFile = "/etc/common-certs/gateway.cert.pem"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Namespace = "finance"
|
|
|
|
Name = "billing"
|
2020-06-24 22:10:46 +00:00
|
|
|
CAFile = "/etc/billing-ca/ca-chain.cert.pem",
|
|
|
|
SNI = "billing.service.com"
|
2020-05-13 21:29:40 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
```
|
|
|
|
|
2020-06-24 22:10:46 +00:00
|
|
|
</Tab>
|
2020-07-08 23:09:00 +00:00
|
|
|
<Tab heading="JSON">
|
2020-06-24 22:10:46 +00:00
|
|
|
|
|
|
|
Link gateway named "us-west-gateway" with all services in the datacenter, and configure default certificates for mutual TLS.
|
|
|
|
Also override the SNI and CA file used for connections to the billing service:
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"Kind": "terminating-gateway",
|
|
|
|
"Name": "us-west-gateway",
|
|
|
|
"Services": [
|
|
|
|
{
|
|
|
|
"Name": "*",
|
|
|
|
"CAFile": "/etc/billing-ca/ca-chain.cert.pem",
|
|
|
|
"KeyFile": "/etc/certs/gateway.key.pem",
|
|
|
|
"CertFile": "/etc/certs/gateway.cert.pem",
|
2020-07-08 23:09:00 +00:00
|
|
|
"SNI": "billing.service.com"
|
2020-06-24 22:10:46 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"Name": "billing",
|
|
|
|
"CAFile": "/etc/billing-ca/ca-chain.cert.pem",
|
2020-07-08 23:09:00 +00:00
|
|
|
"SNI": "billing.service.com"
|
2020-06-24 22:10:46 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
</Tab>
|
2020-07-08 23:09:00 +00:00
|
|
|
<Tab heading="JSON (Consul Enterprise)">
|
2020-06-24 22:10:46 +00:00
|
|
|
|
2020-07-08 23:09:00 +00:00
|
|
|
Link gateway named "us-west-gateway" in the default namespace with all services in the finance namespace,
|
2020-06-24 22:10:46 +00:00
|
|
|
and configure default certificates for mutual TLS. Also override the SNI and CA file used for connections to the billing service:
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"Kind": "terminating-gateway",
|
|
|
|
"Name": "us-west-gateway",
|
|
|
|
"Namespace": "default",
|
|
|
|
"Services": [
|
2020-07-08 23:09:00 +00:00
|
|
|
{
|
2020-06-24 22:10:46 +00:00
|
|
|
"Namespace": "finance",
|
|
|
|
"Name": "*",
|
|
|
|
"CAFile": "/etc/billing-ca/ca-chain.cert.pem",
|
|
|
|
"KeyFile": "/etc/certs/gateway.key.pem",
|
|
|
|
"CertFile": "/etc/certs/gateway.cert.pem",
|
2020-07-08 23:09:00 +00:00
|
|
|
"SNI": "billing.service.com"
|
2020-06-24 22:10:46 +00:00
|
|
|
},
|
2020-07-08 23:09:00 +00:00
|
|
|
{
|
2020-06-24 22:10:46 +00:00
|
|
|
"Namespace": "finance",
|
|
|
|
"Name": "billing",
|
|
|
|
"CAFile": "/etc/billing-ca/ca-chain.cert.pem",
|
2020-07-08 23:09:00 +00:00
|
|
|
"SNI": "billing.service.com"
|
2020-06-24 22:10:46 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
</Tab>
|
|
|
|
</Tabs>
|
|
|
|
|
2020-05-13 21:29:40 +00:00
|
|
|
## Available Fields
|
|
|
|
|
|
|
|
- `Kind` - Must be set to `terminating-gateway`
|
|
|
|
|
|
|
|
- `Name` `(string: <required>)` - Set to the name of the gateway being configured.
|
|
|
|
|
|
|
|
- `Namespace` `(string: "default")` - <EnterpriseAlert inline /> Specifies the namespace
|
2020-07-08 23:09:00 +00:00
|
|
|
the config entry will apply to. This must be the namespace the gateway is registered in.
|
|
|
|
If omitted, the namespace will be inherited from [the request](/api/config#ns)
|
|
|
|
or will default to the `default` namespace.
|
2020-05-13 21:29:40 +00:00
|
|
|
|
|
|
|
- `Services` `(array<LinkedService>: <optional>)` - A list of services to link
|
2020-07-08 23:09:00 +00:00
|
|
|
with the gateway. The gateway will proxy traffic to these services. These linked services
|
|
|
|
must be registered with Consul for the gateway to discover their addresses. They must also
|
|
|
|
be registered in the same Consul datacenter as the terminating gateway.
|
2020-05-13 21:29:40 +00:00
|
|
|
|
2020-07-08 23:09:00 +00:00
|
|
|
- `Name` `(string: "")` - The name of the service to link with the gateway.
|
2020-05-13 21:29:40 +00:00
|
|
|
If the wildcard specifier, `*`, is provided, then ALL services within the namespace
|
|
|
|
will be linked with the gateway.
|
|
|
|
|
2020-07-08 23:09:00 +00:00
|
|
|
- `Namespace` `(string: "")` - <EnterpriseAlert inline /> The namespace of the service.
|
2020-05-13 21:29:40 +00:00
|
|
|
If omitted, the namespace will be inherited from the config entry.
|
|
|
|
|
2020-07-08 23:09:00 +00:00
|
|
|
- `CAFile` `(string: "")` - A file path to a PEM-encoded certificate authority.
|
2020-05-13 21:29:40 +00:00
|
|
|
The file must be present on the proxy's filesystem.
|
|
|
|
The certificate authority is used to verify the authenticity of the service linked with the gateway.
|
|
|
|
It can be provided along with a CertFile and KeyFile for mutual TLS authentication, or on its own
|
|
|
|
for one-way TLS authentication. If none is provided the gateway **will not** encrypt the traffic to the destination.
|
|
|
|
|
2020-07-08 23:09:00 +00:00
|
|
|
- `CertFile` `(string: "")` - A file path to a PEM-encoded certificate.
|
2020-05-13 21:29:40 +00:00
|
|
|
The file must be present on the proxy's filesystem.
|
|
|
|
The certificate is provided servers to verify the gateway's authenticity. It must be provided if a KeyFile was specified.
|
|
|
|
|
2020-07-08 23:09:00 +00:00
|
|
|
- `KeyFile` `(string: "")` - A file path to a PEM-encoded private key.
|
|
|
|
The file must be present on the proxy's filesystem.
|
|
|
|
The key is used with the certificate to verify the gateway's authenticity. It must be provided along if a CertFile was specified.
|
2020-05-13 21:29:40 +00:00
|
|
|
|
2020-07-08 23:09:00 +00:00
|
|
|
- `SNI` `(string: "")` - An optional hostname or domain name to specify during the TLS handshake.
|
2020-05-13 21:29:40 +00:00
|
|
|
|
|
|
|
## ACLs
|
|
|
|
|
|
|
|
Configuration entries may be protected by
|
2020-08-17 16:17:51 +00:00
|
|
|
[ACLs](https://learn.hashicorp.com/tutorials/consul/access-control-setup-production).
|
2020-05-13 21:29:40 +00:00
|
|
|
|
|
|
|
Reading a `terminating-gateway` config entry requires `service:read` on the `Name`
|
|
|
|
field of the config entry.
|
|
|
|
|
|
|
|
Creating, updating, or deleting a `terminating-gateway` config entry requires
|
|
|
|
`operator:write`.
|