- Newest
- Most votes
- Most comments
This issue appears to be related to SSL/TLS negotiation failures specific to the payment gateway's client when connecting to your AWS EC2 instance. Based on your detailed observations, here are some potential causes and solutions:
-
TLS Version or Cipher Suite Mismatch: The payment gateway might be using specific TLS versions or cipher suites that are supported by ngrok but not by your EC2 or Hetzner configurations. The fact that the handshake fails immediately after ClientHello on EC2 suggests a fundamental incompatibility in the TLS parameters being negotiated.
-
Certificate Chain Issues: Let's Encrypt certificates require the full certificate chain to be properly configured. If the intermediate certificates are missing or incorrectly ordered in your EC2 setup, some clients (particularly older or more strict ones) might fail the handshake while modern browsers and tools like curl might still work due to their more robust certificate handling.
-
SNI (Server Name Indication) Requirements: The payment gateway might have specific SNI requirements that aren't being met in your EC2 configuration.
-
Network Path Differences: There could be intermediary network devices or configurations specific to AWS that are interfering with the TLS handshake for the payment gateway's client.
Troubleshooting steps:
-
Compare TLS Configurations: Use
openssl s_clientwith the-showcertsflag to compare the certificate chains presented by your EC2, Hetzner, and ngrok endpoints. -
Check Security Policies: Verify if your EC2 instance or any associated load balancers have security policies that might restrict certain TLS versions or cipher suites.
-
Enable Detailed TLS Logging: Configure Nginx with more verbose SSL logging to capture the exact point of failure during the handshake.
-
Packet Capture Analysis: Perform a more detailed packet capture analysis to see exactly what cipher suites and TLS versions the payment gateway is offering in its ClientHello message.
-
Contact the Payment Gateway: Since the issue is specific to their client, they might have encountered similar issues with other merchants on AWS EC2. They may have specific requirements for TLS configurations that aren't documented publicly.
-
Test with Different SSL Implementations: If possible, try a different SSL implementation (e.g., switch from Nginx to Apache or vice versa) to see if the issue persists.
The fact that the behavior differs between Hetzner (completes TLS but no HTTP request) and EC2 (fails during TLS handshake) suggests there might be multiple issues at play. The payment gateway client might be very sensitive to specific TLS parameters or certificate configurations that differ between your environments.
Sources
ALB Node SSL Connection Failure - One of Two Nodes Returns SSL_ERROR_SYSCALL in eu-central-1 | AWS re:Post
ALB Connections Accepted but No Requests Processed – HTTPS Hangs (RequestCount = 0) | AWS re:Post
Troubleshooting ClientTLSNegotiationErrorCount in AWS Network Load Balancer | AWS re:Post
Hey Boris,
Have you done captures in the destination instance, like the EC2, to check if the ClientHello reaches the EC2 and if the ServerHello is sent back by the EC2?
sudo tcpdump -nni enX0 -p tcp port 443 -w mycapture.pcap
You can use tcpdump and save this in a PCAP to investigate in a packet capture tool, like wireshark.
Have you certifies that the Path MTU discovery for the 3 Environments is the same?
You can check it using the following command:
tracepath API-URL
After this verification you can check if the MTU of the packet is the root cause of your problem.
Can you check if the the gateway sets the DF bit to 1? That could avoid the packets to be fragmented been discarded by any hop that have a smaller MTU.
Can you change the MTU of the gateway's interface to a smaller value? like 1400 bytes? That cold help to guarantee that no internet hop, usually 1500 MTU, will block this packet after the addition of TCP and TLS headers, and even TLS certificate transmissions?
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-mtu.html
Relevant content
- asked 2 years ago
- asked a year ago
- AWS OFFICIALUpdated 5 months ago
