Skip to content

Commit 9dd8806

Browse files
authored
OSSM-8296: Add a mTLS configuration doc (openshift-service-mesh#166)
* Add a mTLS configuration doc Signed-off-by: Yuanlin Xu <[email protected]> * add 2-vs-3 paragraph Signed-off-by: Yuanlin Xu <[email protected]> * update 2-vs-3 doc change Signed-off-by: Yuanlin Xu <[email protected]> --------- Signed-off-by: Yuanlin Xu <[email protected]>
1 parent 88cb7bf commit 9dd8806

File tree

3 files changed

+118
-1
lines changed

3 files changed

+118
-1
lines changed

docs/ossm/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@ This documentation is specific to the OpenShift Service Mesh product and may dif
1212
- [Adding services to a service mesh](./create-mesh/README.md)
1313
- [Installing the Sidecar](./injection/README.md)
1414
- [Multiple Istio Control Planes in a Single Cluster](./multi-control-planes/README.md)
15+
- [Security Mutual TLS Configuration](./security/security-mTLS-configuration.md)
16+

docs/ossm/ossm2-vs-ossm3.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,15 @@ By default, OpenShift Service Mesh 2 created Kubernetes `NetworkPolicy` resource
9898
1. Ensured network applications and the control plane can communicate with each other.
9999
2. Restricts ingress for mesh applications to only member projects.
100100

101-
OpenShift Service Mesh 3 does not create these policies, leaving it to the user to configure the level of isolation required for their environment. Istio provides fine grained access control of service mesh workloads through [Authorization Policies](https://istio.io/latest/docs/reference/config/security/authorization-policy/).
101+
OpenShift Service Mesh 3 does not create these policies, leaving it to the user to configure the level of isolation required for their environment. Istio provides fine grained access control of service mesh workloads through [Authorization Policies](https://istio.io/latest/docs/reference/config/security/authorization-policy/).
102+
103+
## Service Mesh Security TLS Configuration
104+
105+
In OpenShift Service Mesh 2, users created the `ServiceMeshControlPlane` resource where you could enable mTLS strict mode by setting the `spec.security.dataPlane.mtls` to `true`.
106+
You could set the minimum and maximum TLS protocol versions by setting the `spec.security.controlPlane.tls.minProtocolVersion` or `spec.security.controlPlane.tls.maxProtocolVersion` in your `ServiceMeshControlPlane` resource.
107+
108+
In OpenShift Service Mesh 3, the `Istio` resource replaces the `ServiceMeshControlPlane` resource and does not include these settings. You can enable mTLS strict mode by applying the corresponding `PeerAuthentication` and `DestinationRule` resource(s). You can learn more about that in [Security mTLS Configuration](./security/security-mTLS-configuration.md).
109+
The TLS protocol version can be set through [Istio Workload Minimum TLS Version Configuration](https://istio.io/latest/docs/tasks/security/tls-configuration/workload-min-tls-version/).
110+
111+
`auto mTLS` is enabled by default in both OpenShift Service Mesh 2 and OpenShift Service Mesh 3.
112+
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
## About mutual Transport Layer Security (mTLS)
2+
3+
Mutual Transport Layer Security (mTLS) is a protocol that enables two parties to authenticate each other. However, configuring mTLS settings can be confusing and a common source of misconfiguration. First, you need to understand the following Istio resources and concepts[1].
4+
5+
- `PeerAuthentication` is used to configure what type of mTLS traffic the sidecar will **accept**.
6+
Its `PERMISSIVE` mode[2] means plaintext or mTLS traffic will all be accepted by the sidecar. Its `STRICT` mode means only mTLS traffic will be accepted by the sidecar.
7+
8+
- `DestinationRule` is used to configure what type of TLS traffic the sidecar will **send**.
9+
Its `DISABLE` mode will allow the sidecar to send plaintext, while its `SIMPLE`, `MUTUAL`, and `ISTIO_MUTUAL` mode will configure the sidecar to originate a TLS connection.
10+
11+
- `Auto mTLS` means: without any configuration, all inter-mesh traffic will be mTLS encrypted.
12+
This is configured by a global mesh config field `enableAutoMtls` and it is enabled by default.
13+
14+
## Default Settings
15+
16+
Because `auto mTLS` is enabled by default. Traffic **sent** through a sidecar is mTLS encrypted. It doesn't matter which `PeerAuthentication` mode is configured. You can use mTLS without changes to the application or service code. The mTLS is handled entirely between the two sidecar proxies.
17+
18+
On the other hand, `PeerAuthentication` is set to the `PERMISSIVE` mode by default, where the sidecars in Service Mesh **accept** both plain-text traffic and connections that are encrypted using mTLS. This mode provides greater flexibility for the mTLS on-boarding process.
19+
20+
## Enabling strict mTLS mode by namespace
21+
22+
If you need to lock down workloads to only **accept** mTLS traffic, you may apply the following change to enable the `STRICT` mode of `PeerAuthentication`.
23+
24+
- PeerAuthentication Policy example for a namespace
25+
26+
```
27+
$ oc apply -n <namespace> -f - <<EOF
28+
apiVersion: security.istio.io/v1beta1
29+
kind: PeerAuthentication
30+
metadata:
31+
name: default
32+
namespace: <namespace>
33+
spec:
34+
mtls:
35+
mode: STRICT
36+
EOF
37+
```
38+
39+
If you manually disabled the `auto mTLS` mesh config field and you are setting `PeerAuthentication` to `STRICT` mode, you also need to create a `DestinationRule` resource with `MUTUAL` or `ISTIO_MUTUAL` mode for your service. The following example enables mTLS to all destination hosts in the `<namespace>`.
40+
41+
- DestinationRule example
42+
43+
```
44+
$ oc apply -n <namespace> -f - <<EOF
45+
apiVersion: networking.istio.io/v1alpha3
46+
kind: DestinationRule
47+
metadata:
48+
name: enable-mtls
49+
namespace: <namespace>
50+
spec:
51+
host: "*.<namespace>.svc.cluster.local"
52+
trafficPolicy:
53+
tls:
54+
mode: ISTIO_MUTUAL
55+
EOF
56+
```
57+
a. Replace <namespace> with the namespace where the service is located.
58+
59+
60+
## Enabling strict mTLS across the whole service mesh
61+
62+
If you need to lock down mTLS for the whole mesh, you may apply the above PeerAuthentication Policy example for the istiod namespace, for example, `istio-system` namespace. Moreover, you also need to apply a `DestinationRule` to disable mTLS when talking to API server, as API server doesn't have sidecar. You should apply similar `DestinationRule` for other services that don't have sidecar in this mode.
63+
64+
- PeerAuthentication Policy example for the whole mesh
65+
66+
```
67+
$ oc apply -n istio-system -f - <<EOF
68+
apiVersion: security.istio.io/v1
69+
kind: PeerAuthentication
70+
metadata:
71+
name: default
72+
namespace: istio-system
73+
spec:
74+
mtls:
75+
mode: STRICT
76+
---
77+
apiVersion: networking.istio.io/v1beta1
78+
kind: DestinationRule
79+
metadata:
80+
name: api-server
81+
namespace: istio-system
82+
spec:
83+
host: kubernetes.default.svc.cluster.local
84+
trafficPolicy:
85+
tls:
86+
mode: DISABLE
87+
EOF
88+
```
89+
90+
## Setting the minimum and maximum protocol versions
91+
92+
See the Istio documentation ["Istio Workload Minimum TLS Version Configuration"](https://istio.io/latest/docs/tasks/security/tls-configuration/workload-min-tls-version/).
93+
94+
## Validating encryption with Kiali
95+
96+
The Kiali console offers several ways to validate whether or not your applications, services, and workloads have mTLS encryption enabled.
97+
98+
The `Services Detail Overview` page displays a Security icon on the graph edges where at least one request with mTLS enabled is present. Also note that Kiali displays a lock icon in the `Network` section next to ports that are configured for mTLS.
99+
100+
### Additional resources
101+
102+
References:
103+
- [1] https://istio.io/latest/docs/ops/configuration/traffic-management/tls-configuration/
104+
- [2] https://istio.io/latest/docs/concepts/security/#permissive-mode

0 commit comments

Comments
 (0)