Configure default TLS contexts in a Configuration resource. Both inbound and outbound are optional:
apiVersion: gateway.mulesoft.com/v1alpha1
kind: Configuration
metadata:
name: default-tls
spec:
defaultTLS:
inbound:
certificate:
key: <string>
crt: <string>
keyPassphrase: <string>
requireClientCertificate: <boolean>
trustedCA: <string>
alpn: <array>
minVersion: <string>
maxVersion: <string>
ciphers: <array>
outbound:
skipValidation: <boolean>
trustedCA: <string>
certificate:
key: <string>
crt: <string>
keyPassphrase: <string>
alpn: <array>
minVersion: <string>
maxVersion: <string>
ciphers: <array>
Omni Gateway validates each default TLS context when you apply the resource. If a default TLS context is invalid, for example, because the certificate and key don’t match or a cipher isn’t supported, Omni Gateway rejects the resource and logs an error.
Parameters for inbound and outbound:
| Parameter |
Required or Optional |
Default Value |
Description |
certificate.crt and certificate.key
|
Required for inbound. Optional for outbound.
|
|
The certificate and private key that Omni Gateway presents. For outbound, the certificate enables mTLS.
|
certificate.keyPassphrase
|
Optional, unless the private key is encrypted
|
|
The passphrase that decrypts the private key.
|
|
|
inbound: N/A
outbound: The operating system CAs
|
For inbound, the CA that validates client certificates. Required if requireClientCertificate is true.
For outbound, the CA that validates upstream server certificates.
|
|
|
|
If true, clients must present a certificate signed by trustedCA (inbound mTLS).
|
|
|
|
If true, Omni Gateway doesn’t validate upstream server certificates and logs a warning.
|
|
|
|
A prioritized list of application-level protocols. Supported values are http/1.1 and h2.
|
minVersion and maxVersion
|
|
|
The minimum and maximum TLS versions. Supported values are 1.2 and 1.3.
|
|
|
|
A list of TLS 1.2 ciphers, in IANA format.
|
|
|
In the Configuration resource, the TLS version parameters are minVersion and maxVersion. In the tls and tls-outbound policies, the same parameters are lowercase: minversion and maxversion.
|
This example configures a default inbound TLS context and a default outbound TLS context that trusts a private CA:
apiVersion: gateway.mulesoft.com/v1alpha1
kind: Configuration
metadata:
name: default-tls
spec:
defaultTLS:
inbound:
certificate:
key: |
-----BEGIN PRIVATE KEY-----
# insert private key
-----END PRIVATE KEY-----
crt: |
-----BEGIN CERTIFICATE-----
# insert certificate
-----END CERTIFICATE-----
outbound:
trustedCA: |
-----BEGIN CERTIFICATE-----
# insert the CA that signs the upstream server certificates
-----END CERTIFICATE-----
Add the Configuration Files to Omni Gateway
Add the YAML file to Omni Gateway:
-
Linux service: Save the YAML file in /usr/local/share/mulesoft/flex-gateway/conf.d/.
-
Docker container: Save the YAML file in the directory that you mount to /usr/local/share/mulesoft/flex-gateway/conf.d in the container, for example, with -v "$(pwd)":/usr/local/share/mulesoft/flex-gateway/conf.d.
-
Kubernetes cluster: Apply the YAML file with kubectl apply -f <file-name>.yaml.
Verify Inbound TLS
Send a request to an HTTPS API instance:
curl https://<SERVER_DOMAIN>:<SERVER_PORT>/get --cacert <SERVER_CERT_FILE> -v
The output shows the TLS handshake and an HTTP 200 response. For inbound mTLS, also pass the client certificate and key:
curl https://<SERVER_DOMAIN>:<SERVER_PORT>/get \
--cert <CLIENTAPP_CERT_FILE> \
--key <CLIENTAPP_KEY_FILE> \
--cacert <SERVER_CERT_FILE> -v
If curl returns error:1408F10B:SSL routines:ssl3_get_record:wrong version number, check the indentation of the key and crt values in your YAML file.