AWS Builder Center
Enhancing Security with Mutual TLS (mTLS) for AWS Application Load Balancer

Enhancing Security with Mutual TLS (mTLS) for AWS Application Load Balancer

In this article, we'll explore how mTLS works, how AWS Application Load Balancer implements it, the difference between Verify and Passthrough modes, how trust stores and certificate revocation work, and the production considerations that should be evaluated before implementing mTLS.

Cloud & DevOps Architect | SRE | Multi-Cloud Infrastructure | Oracle DBA

Introduction

In today's interconnected, distributed cloud environments, ensuring robust security measures requires more than server-side encryption alone. Organizations increasingly need to verify the identities of both the server and the initiating client. To meet this need, Mutual TLS (mTLS) is gaining traction as a powerful two-way authentication and encryption mechanism. When integrated with an AWS Application Load Balancer, mTLS significantly enhances the overall security posture of your cloud applications.

mTLS

Mutual TLS (mTLS) enhances standard network security by enforcing two-way, certificate-based authentication between clients and servers. This protocol serves as a foundational pillar of Zero Trust architectures, a security model where no user or device is trusted automatically, thereby mitigating vulnerabilities across APIs, microservices, and enterprise applications. By offloading this verification directly to the AWS Application Load Balancer (ALB) layer, organizations can securely authenticate clients before traffic reaches backend systems, eliminating redundant authentication complexity within application workloads while enforcing robust edge security.
mTLS extends standard TLS by requiring both sides of a connection to establish their identities using digital certificates.
With conventional HTTPS/TLS, the server presents its certificate and the client validates the server's identity.
With mTLS, an additional authentication step occurs:
Client
│
│ Validates server certificate
▼
Server / ALB
│
│ Validates client certificate
▼
Authenticated Connection
Both parties therefore participate in certificate-based authentication.
mTLS is particularly useful for:
  • Machine-to-machine authentication
  • API security
  • B2B integrations
  • IoT device authentication
  • Internal service communication
  • Zero Trust architectures
It is important, however, to understand that mTLS is an authentication mechanism, not a complete authorization strategy.
A valid client certificate establishes an identity. Your architecture may still need to determine what that authenticated identity is authorized to access.



Is mTLS better than TLS?

1- TLS (Transport Layer Security):
  • Overview: TLS is a cryptographic protocol that ensures secure communication over a network by encrypting data during transit. It establishes a secure connection between a client and a server, typically used in scenarios like web browsing, email communication, and data transfer.
  • Authentication: TLS primarily focuses on server authentication, where the server presents its certificate to prove its identity to the client.
  • One-Way Authentication: In traditional TLS, only the server is authenticated to the client, ensuring that the client is connecting to the intended server.
2- Mutual TLS (mTLS):
  • Enhanced Authentication: mTLS, on the other hand, provides mutual authentication, requiring both the client and the server to present certificates to each other.
  • Bidirectional Trust: This bidirectional trust ensures that both parties are verified, adding an extra layer of security to the communication.
  • Zero Trust Security: mTLS is a key component in implementing a Zero Trust security model, where trust is not assumed by default, enhancing security in distributed environments.
3- Comparison:
  • Security: mTLS offers a higher level of security compared to traditional TLS by requiring mutual authentication, reducing the risk of man-in-the-middle attacks and unauthorized access.
  • Use Cases: While TLS is suitable for many common scenarios like web browsing, mTLS is more appropriate for situations where both parties need to be authenticated, such as in enterprise environments and API communication.
  • Complexity: Implementing mTLS can be more complex than traditional TLS due to the need for managing client certificates and configuring mutual authentication.
4- Examples:
  • TLS: A website using HTTPS employs TLS to encrypt data transmitted between the web server and the user's browser, ensuring confidentiality and integrity.
  • mTLS: In a healthcare application where medical devices communicate with a central server, mTLS can ensure that both the devices and the server are authenticated before sharing sensitive patient data.



mTLS Authentication concepts

Mutual authentication in Mutual TLS (mTLS) is a crucial security feature that ensures both the client and the server authenticate each other using digital certificates. Here's how mutual authentication in mTLS works:

1- Handshake Process:
  • Client Hello: The client initiates the connection by sending a "Client Hello" message to the server, indicating the supported cryptographic algorithms and parameters.
  • Server Hello: The server responds with a "Server Hello" message, confirming the chosen encryption parameters and presenting its digital certificate to the client.
  • Client Certificate Request: If configured for mutual authentication, the server may request a certificate from the client for authentication.
  • Client Certificate: The client responds with its digital certificate, which includes its public key and other identifying information.
  • Server Authentication: The client verifies the server's certificate to ensure it is valid and issued by a trusted Certificate Authority (CA).
2- Mutual Authentication:
  • Client Authentication: After validating the server's certificate, the client may request a certificate from the server for mutual authentication.
  • Server Certificate: The server sends its certificate to the client, which contains its public key and identity information.
  • Client Authentication Verification: The server validates the client's certificate to ensure it is authentic and issued by a trusted CA.
3- Establishing Secure Connection: Once mutual authentication is successfully completed, both parties have verified each other's identities. They can then proceed to establish a secure encrypted connection using the agreed-upon cryptographic keys and algorithms.
4- Data Exchange: With mutual authentication and encryption in place, data exchanged between the client and the server is secure, ensuring confidentiality and integrity.
5- Benefits of Mutual Authentication in mTLS:
  • Enhanced Security: Mutual authentication ensures that both the client and the server are who they claim to be, reducing the risk of unauthorized access.
  • Trust Establishment: By verifying each other's identities, mutual authentication establishes trust between the client and the server.
  • Protection Against Impersonation: Mutual authentication helps prevent impersonation attacks and man-in-the-middle threats, enhancing overall security.



Deploy mTLS on your Application Load Balancer

Step 1- Prerequisites
Before you begin configuring mutual TLS on your Application Load Balancer, be aware of the following requirements:
Certificates: Application Load Balancers support the following for certificates used with mutual TLS authentication:
  • Supported certificate: "X.509v3" for both the client and the server
  • Supported public keys: RSA 2K 8K or ECDSA secp256r1, secp384r1, secp521r1
  • Supported signature algorithms: SHA256, 384, 512 with RSA/SHA256, 384, 512 with EC/SHA256,384,512 hash with RSASSA-PSS with MGF1
CA certificate bundles: The following applies to certificate authority (CA) bundles: Application Load Balancers upload each certificate authority (CA) certificate bundle as a batch. Application Load Balancers don't support uploading individual certificates. If you need to add new certificates, you must upload the certificates bundle file.
Certificate order for passthrough: When you use mutual TLS passthrough, the Application Load Balancer inserts headers to present the clients certificate chain to the backend targets. The order of presentation starts with the leaf certificates and finishes with the root certificate.
Session resumption: Session resumption is not supported while using mutual TLS passthrough or verify modes with an Application Load Balancer.
HTTP headers: Application Load Balancers use X-Amzn-Mtls headers to send certificate information when it negotiates client connections using mutual TLS. For more information and example headers, see  HTTP headers and mutual TLS .
CA certificate files:
A certificate files must satisfy the following requirements:
  • Certificate file must use PEM (Privacy Enhanced Mail) format.
  • Certificate contents must be enclosed within the  -----BEGIN CERTIFICATE----- and -----END CERTIFICATE-----  boundaries.
  • Comments must be preceded by a # character and must not contain any - characters.
  • There cannot be any blank lines.
Step 2- Configurations
1- Application Load Balancer:
  • Create a target group containing the targets (instances or IP addresses) that the Application Load Balancer will route traffic to.
  • Configure a listener on the Application Load Balancer for the desired port (e.g., 443) and protocol (HTTPS).
2- Generate Certificates: Generate X.509v3 certificates for both the server (ALB) and the clients that will be accessing the ALB. Ensure the certificates are issued by a trusted Certificate Authority (CA).
3- Configure Security Groups: Configure security groups associated with the Application Load Balancer to allow traffic on the required ports (e.g., 443 for HTTPS).
4- Enable Client Authentication: In the listener configuration, enable client authentication (mTLS) by selecting the option to "Authenticate clients" and choose the truststore that contains the client certificates.
5- Upload pem file to an S3 bucket and create a Trust store:

6- Add mTLS settings to ALB listener:

7- Update Target Group Settings:
Re-configure the target group associated with the listener to route traffic to the desired targets based on the mTLS configuration.
8- Validate Client Certificates: Configure the Application Load Balancer to validate client certificates against a trusted CA or a certificate chain.
9- Testing: Test the mTLS configuration by accessing the Application Load Balancer with a client that presents a valid client certificate during the TLS handshake.

Additional Considerations:

  • Certificate Renewal: Ensure that certificates are renewed before expiration to prevent service disruptions.
  • Logging and Monitoring: Set up logging and monitoring to track mTLS connections and troubleshoot any issues that may arise.



Conclusion

In conclusion, while both TLS and mTLS serve the purpose of securing communications, mTLS offers a higher level of security through mutual authentication. The choice between TLS and mTLS depends on the specific requirements of the application, with mTLS being favored in scenarios where bidirectional trust and enhanced security are crucial.
Mutual authentication in mTLS plays a vital role in establishing secure and trusted communication channels between clients and servers.
Mutual TLS for AWS Application Load Balancer is a powerful security feature that enhances the authenticity and confidentiality of communication between clients and servers. By implementing mTLS, organizations can strengthen their security posture and protect sensitive data from unauthorized access or tampering.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article