What the error means
curl: (35) error:0A00010B:SSL routines::wrong version number ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1006)
Every TLS record starts with a type byte and the protocol version. If HTTP/1.1 400 Bad Request or 220 mail.example.com ESMTP comes back instead, OpenSSL reads those bytes as a version number and reports a wrong version. Older OpenSSL versions write ssl3_get_record:wrong version number.
The most common causes
- Wrong port.
https://example.com:80or a service that only speaks HTTP on 8080. - STARTTLS port addressed with direct TLS. Ports 587 and 25 start in plain text and switch with
STARTTLS. Settingsmtps://or “SSL/TLS” there gives this error. Direct TLS is on 465 (SMTP), 993 (IMAP) and 995 (POP3). - Proxy configured with https://. Very common in corporate networks:
HTTPS_PROXY=https://proxy:3128. Almost all proxies speak plain HTTP, even for HTTPS targets. Correct isHTTPS_PROXY=http://proxy:3128. - nginx without
sslinlisten.listen 443;instead oflisten 443 ssl;serves plain text on port 443. - Load balancer or ingress does not terminate TLS. The service behind it expects TLS but gets plain text, or the other way round.
Check
# Does the port answer in plain text? Then HTML comes back here curl -v http://example.com:443/ # Mail server: STARTTLS instead of direct TLS openssl s_client -connect mail.example.com:587 -starttls smtp -servername mail.example.com # Which proxy is set? env | grep -i _proxy
In the SSL check you choose the port; on 25, 587, 143 and 110 it uses STARTTLS automatically.
Fix
- Match port and method: 443/465/993/995 with direct TLS, 25/587/143/110 with STARTTLS.
- Switch proxy variables to
http://, also in~/.gitconfig,pip.conf,.npmrcand Docker settings. - In nginx
listen 443 ssl;and for IPv6listen [::]:443 ssl;. The TLS config generator creates a complete configuration.
FAQ
Do I need to update OpenSSL?
Almost never. The error occurs because the other side does not speak TLS. Only if a server really only supports SSLv3 or TLS 1.0 do you get other messages such as “unsupported protocol”.
Why does it work in the browser but not with curl?
Browsers often take the system proxy settings with http://, curl reads HTTPS_PROXY from the environment. If that says https://, curl fails.
Which port for Thunderbird or Outlook?
Sending via 587 with STARTTLS or 465 with SSL/TLS, receiving via 993 with SSL/TLS. Port and encryption type must match.