In this lesson, you will learn how to implement Mutual TLS (mTLS) to ensure that only authorized log forwarders can send data to your log aggregators, preventing unauthorized data injection or tampering.
The Concept of Mutual TLS
In a standard TLS connection, the client verifies the server’s identity. However, in a logging pipeline, we also need to ensure that the server (the aggregator) trusts the client (the forwarder). With mTLS, both parties exchange digital certificates signed by a common Certificate Authority (CA). If a forwarder does not present a valid certificate signed by your internal CA, the aggregator will reject the connection entirely, securing your pipeline against rogue agents.
Configuring mTLS for Log Forwarders
When using tools like Fluent Bit or Promtail, you configure the output plugin to use client-side certificates. On the aggregator side (e.g., Elasticsearch or Loki), you configure the listener to require client authentication.
Here is a simplified configuration snippet for a log forwarder connecting to a secured endpoint:
[OUTPUT]
Name http
Match *
Host log-aggregator.logging.svc.cluster.local
Port 443
tls On
tls.ca_file /etc/certs/ca.crt
tls.crt_file /etc/certs/forwarder.crt
tls.key_file /etc/certs/forwarder.key
Why mTLS Matters for Observability
Logs often contain sensitive PII (Personally Identifiable Information) or internal system metadata. Without mTLS, any pod in your cluster could potentially spoof a log forwarder and spam your aggregator with malformed data or intercept the stream. By enforcing mTLS, you move security from the network layer to the application layer. This ensures that even if a malicious actor gains network access, they cannot transmit fake logs because they lack the cryptographic credentials required by the aggregator.
In a Kubernetes environment, you can simplify the distribution of these certificates by using a service mesh (like Istio) or by mounting Kubernetes Secrets containing the CA and client certs into your forwarder pods.
Key Takeaway: Mutual TLS creates a "zero-trust" log pipeline by requiring both the forwarder and the aggregator to cryptographically prove their identity, ensuring that only authenticated logs are ingested into your observability stack.