<p>I am trying to convert an Istio service mesh running on k8s from <code>http</code> to <code>https</code> but stumbled upon many problems. I don't really understand what are all the steps required to do that.</p>
<p>As I know, there are 2 kinds of traffic that requires TLS in a mesh:</p>
<ul>
<li><p><strong>between internal services</strong>: scramming through Istio docs let me know that Istio will somehow automatically configure mTLS between services so all of them will communicate securely without any extra configuration. However, I still don't understand deeply how they implement this mTLS. How does it differ from normal TLS and what is mTLS role in the other kind of traffic (client outside to service inside)?</p>
</li>
<li><p><strong>from client outside to a service inside</strong>: this is where I don't know what to do. I know that in order for a service to have TLS it needs TLS certificate by a trusted CA. However, as the outer client will not talk directly to the service inside but only through the Istio ingress gateway. Do I need to provide cert for every service or only the ingress gateway? All of my services are now exposing port 80 for <code>HTTP</code>. Do I need to convert all of them to port 443 and <code>HTTPS</code> or just the ingress gateway is enough?</p>
</li>
</ul>
<p>Regarding the certificates, if I just use self-signing certs for now, can I just create cert and key with openssl and create secrets from it (maybe sync between namespaces with <code>kubed</code>), then all services use the same cert and key? Everywhere suggests me to use <code>cert-manager</code>. However, I don't know if it is worth the effort?</p>
<p>I would be really thankful if anyone can explain with some illustrations.</p>

<p>In general, if you need a good explanation of the issues related to Istio (also with pictures), I recommend that you check the documentation. You can find around  <a href="https://istio.io/latest/search/?q=tls&amp;site=docs" rel="nofollow noreferrer">540 topics</a>  related to TLS in Istio.</p>
<p>Istio is a very well documented service. Here you can find more information about  <a href="https://istio.io/latest/docs/ops/configuration/traffic-management/tls-configuration/" rel="nofollow noreferrer">Understanding TLS Configuration</a>. You can also find good article about  <a href="https://istio.io/latest/docs/tasks/security/authentication/mtls-migration/" rel="nofollow noreferrer">Mutual TLS Migration</a>.</p>
<blockquote>
<p>However I still don't understand deeply how they implement this mTLS, how does it differ from normal TLS and what is mTLS role in the other kind of traffic (client outside to service inside).</p>
</blockquote>
<p>Mutual TLS, or mTLS for short, is a method for  <a href="https://www.cloudflare.com/learning/access-management/what-is-mutual-authentication/" rel="nofollow noreferrer">mutual authentication</a>. mTLS ensures that the parties at each end of a network connection are who they claim to be by verifying that they both have the correct private  <a href="https://www.cloudflare.com/learning/ssl/what-is-a-cryptographic-key/" rel="nofollow noreferrer">key</a>. The information within their respective  <a href="https://www.cloudflare.com/learning/ssl/what-is-an-ssl-certificate" rel="nofollow noreferrer">TLS certificates</a>  provides additional verification. You can read more about it  <a href="https://www.cloudflare.com/learning/access-management/what-is-mutual-tls/" rel="nofollow noreferrer">here</a>. Additionally yo can also see page about  <a href="https://istio.io/latest/docs/tasks/security/authorization/authz-http/" rel="nofollow noreferrer">HTTP Traffic</a>  (mTLS is required for this case).</p>
<blockquote>
<p>All of my services are now exposing port 80 for HTTP. Do I need to convert all of them to port 443 and HTTPS or just the ingress gateway is enough?</p>
</blockquote>
<p>It is possible to create  <a href="https://istio.io/latest/docs/tasks/traffic-management/ingress/ingress-sni-passthrough/" rel="nofollow noreferrer">Ingress Gateway without TLS Termination</a>:</p>
<blockquote>
<p>The  <a href="https://istio.io/latest/docs/tasks/traffic-management/ingress/secure-ingress/" rel="nofollow noreferrer">Securing Gateways with HTTPS</a>  task describes how to configure HTTPS ingress access to an HTTP service. This example describes how to configure HTTPS ingress access to an HTTPS service, i.e., configure an ingress gateway to perform SNI passthrough, instead of TLS termination on incoming requests.</p>
</blockquote>
<p><strong>EDIT (added more explanation and documentation links):</strong></p>
<blockquote>
<p><a href="https://istio.io/latest/about/service-mesh/" rel="nofollow noreferrer">Service mesh</a> uses a proxy to intercept all your network traffic, allowing a broad set of application-aware features based on configuration you set.</p>
</blockquote>
<blockquote>
<p>Istio securely provisions strong identities to every workload with X.509 certificates. Istio agents, running alongside each Envoy proxy, work together with istiod to automate key and certificate rotation at scale. The <a href="https://istio.io/latest/docs/concepts/security/#pki" rel="nofollow noreferrer">following diagram</a> shows the identity provisioning flow.</p>
</blockquote>
<blockquote>
<p>Peer <a href="https://istio.io/latest/docs/concepts/security/#authentication" rel="nofollow noreferrer">authentication</a>: used for service-to-service authentication to verify the client making the connection. Istio offers <a href="https://en.wikipedia.org/wiki/Mutual_authentication" rel="nofollow noreferrer">mutual TLS</a> as a full stack solution for transport authentication, which can be enabled without requiring service code changes.</p>
</blockquote>
<p>Peer authentication modes that are supported: <code>Permissive</code>, <code>Strict</code>, and <code>Disable</code>.</p>
<p>In order to answer this question:</p>
<blockquote>
<p>All of my services are now exposing port 80 for HTTP. Do I need to convert all of them to port 443 and HTTPS or just the ingress gateway is enough?</p>
</blockquote>
<p>fully we could have informed the customer that using Istio Gateway can expose services from Istio service mesh to the outside using plain HTTP, with TLS termination or in PASSTHROUGH TLS mode. Incoming TLS termination could be improved (using TLS certificate approved by a trusted CA or using cert-manger with Istio Gateway). You can read more about this topic <a href="https://istio.io/latest/docs/ops/integrations/certmanager/" rel="nofollow noreferrer">here</a>.</p>
