Automatic mutual TLS
This tasks shows a simplified workflow for mutual TLS adoption.
With Istio auto mutual TLS feature, you can adopt mutual TLS by only configuring authentication policy without worrying about destination rule.
Istio tracks the server workloads migrated to Istio sidecar, and configures client sidecar to send mutual TLS traffic to those workloads automatically, and send plain text traffic to workloads without sidecars. This allows you to adopt Istio mutual TLS incrementally with minimal manual configuration.
Before you begin
Understand Istio authentication policy and related mutual TLS authentication concepts.
Install Istio with the
global.mtls.enabled
option set to false andglobal.mtls.auto
set to true. For example, using thedemo
configuration profile:
Instructions
Setup
Our examples deploy httpbin
service into three namespaces, full
, partial
, and legacy
.
Each represents different phase of Istio migration.
full
namespace contains all server workloads finishing the Istio migration. All deployments have
sidecar injected.
partial
namespace contains server workloads partially migrated to Istio. Only migrated one has
sidecar injected, able to serve mutual TLS traffic.
legacy
namespace contains the workloads and none of them have Envoy sidecar.
Last we deploy two sleep
workloads, one has sidecar and one does not.
You can confirm the deployments in all namespaces.
You should also verify that there is a default mesh authentication policy in the system, which you can do as follows:
Last but not least, verify that there are no destination rules that apply on the example services. You can do this by checking the host:
value of
existing destination rules and make sure they do not match. For example:
You can verify setup by sending an HTTP request with curl
from any sleep
pod in the namespace full
, partial
or legacy
to either httpbin.full
, httpbin.partial
or httpbin.legacy
. All requests should succeed with HTTP code 200.
For example, here is a command to check sleep.full
to httpbin.full
reachability:
The SPIFFE URI shows the client identity from X509 certificate, which indicates the traffic is sent in mutual TLS. If the traffic is in plain text, no client certificate will be displayed.
Start from PERMISSIVE mode
In the setup, we start with PERMISSIVE
for all services in the mesh.
- All
httpbin.full
workloads and the workload with sidecar forhttpbin.partial
are able to serve both mutual TLS traffic and plain text traffic. - The workload without sidecar for
httpbin.partial
and workloads ofhttpbin.legacy
can only serve plain text traffic.
Automatic mutual TLS configures the client, sleep.full
, to send mutual TLS to the first type of
workloads and plain text to the second type.
You can verify the reachability as:
Working with Sidecar Migration
The request to httpbin.partial
can reach to server workloads with or without sidecar. Istio
automatically configures the sleep.full
client to initiates mutual TLS connection to workload
with sidecar.
Without automatic mutual TLS feature, you have to track the sidecar migration finishes, and then
explicitly configure the destination rule to make client send mutual TLS traffic to httpbin.full
.
Lock down mutual TLS to STRICT
Imagine now you need to lock down the httpbin.full
service to only accept mutual TLS traffic. You
can configure authentication policy to STRICT
.
All httpbin.full
workloads and the workload with sidecar for httpbin.partial
can only serve
mutual TLS traffic.
Now the requests from the sleep.legacy
starts to fail, since it can’t send mutual TLS traffic.
But the client sleep.full
is automatically configured with auto mutual TLS, to send mutual TLS
request, returning 200.
Disable mutual TLS to plain text
If for some reason, you want service to be in plain text mode explicitly, we can configure authentication policy as plain text.
In this case, since the service is in plain text mode. Istio automatically configures client sidecars to send plain text traffic to avoid breakage.
All traffic are now in plain text.
Destination rule overrides
For backward compatibility, you can still use destination rule to override the TLS configuration as before. When destination rule has an explicit TLS configuration, that overrides the client sidecars’ TLS configuration.
For example, you can explicitly configure destination rule for httpbin.full
to enable or
disable mutual TLS explicitly.
Since in previous steps, we already disable the authentication policy for httpbin.full
to disable
mutual TLS, we should see the traffic from sleep.full
starting to fail.
Cleanup
Summary
Automatic mutual TLS configures the client sidecar to send TLS traffic by default between sidecars. You only need to configure authentication policy.
As aforementioned, automatic mutual TLS is a mesh wide Helm installation option. You have to
re-deploy Istio to enable or disable the feature. When disabling the feature, if you already rely
on it to automatically encrypt the traffic, then traffic can fall back to plain text, which
can affect your security posture or break the traffic, if the service is already configured as
STRICT
to only accept mutual TLS traffic.
Currently, automatic mutual TLS is an Alpha stage feature, please be aware of the risk, and the additional CPU cost for TLS encryption.
We’re considering to make this feature the default enabled. Please consider to send your feedback or encountered issues when trying auto mutual TLS via Git Hub3.