liveBook · Manning

Mutual TLS

As explained in gRPC Microservices in Go

mTLS, or mutual TLS, is a TLS communication mode in which both the client and server present certificates to authenticate each other.

Mutual TLS (mTLS) secures a service connection while authenticating both endpoints. In an Order–Payment interaction, the server presents a certificate, the client verifies it, then the client presents its own certificate for server verification. section 6.3.1

A mutual TLS connection proceeds through these steps:

  • The Order service connects to the Payment service. section 6.3.1
  • The Payment service presents its certificate, and the Order service verifies it. section 6.3.1
  • The Order service presents its certificate, and the Payment service verifies it before accepting requests. section 6.3.1
  • Both services exchange data through an encrypted channel, with each side able to identify the owner of a call. section 6.3.1

Certificate setup uses a certificate authority (CA), private keys, certificate signing requests, signed server and client certificates, and verification commands. Certificate subject fields identify attributes such as organization, organizational unit, common name, and email address; extensions can specify subject alternative names. section 6.3.2

Order and Payment services

Create a CA certificate, generate a server key and signing request for Payment, sign and verify its certificate, then repeat the process for an Order client certificate. Configure the resulting certificates for the two services so Payment requires and verifies the Order certificate. section 6.3.2 section 6.4

openssl req -x509 \                                                     #1
    -sha256 \                                                           #2
    -newkey rsa:4096 \                                                  #3
    -days 365 \                                                         #4
    -keyout ca-key.pem \                                                #5
    -out ca-cert.pem \                                                  #6
    -subj "/C=TR/ST=EURASIA/L=ISTANBUL/O=Software/OU=Microservices/
      CN=*.microservices.dev/emailAddress=huseyin@microservices.dev"  #7
    -nodes                                                              #8

Use the OpenSSL listing to inspect the concrete CA certificate-generation command and its identity parameters. section 6.3.2

How gRPC Microservices in Go covers it

How deep it goes
Explains the handshake and certificate-generation workflow, but stops short of showing service integration code.
Examples
Uses Order and Payment services, OpenSSL CA commands, server and client signing requests, and certificate verification commands.
What it assumes
Assumes basic service communication and TLS familiarity while introducing certificate roles, signing requests, and verification steps.
What you can do after
Apply it via OpenSSL by creating a CA and signed server and client certificates for authenticated service communication.
How it connects
Connects TLS, certificates, certificate authorities, encrypted communication, gRPC, and zero-trust security.

Also explained in

Compare how 8 books explain mutual TLS →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of gRPC Microservices in Go. The section links point to the parts of the book it draws on.