On this page
Find the line that matters
“TLS key negotiation failed” is the last line, not the cause, and TLS Error: TLS handshake failed after it says the same. Read upwards: did the server answer at all?
An answer shows as TLS: Initial packet from [AF_INET]203.0.113.5:1194 (at verb 3 and above). With it, the port is open and the cause is further on: keys, certificates, versions. Without it, either the packets don't arrive or the server drops them in silence. A server with tls-auth or tls-crypt does that with a client whose key is wrong, so a wrong ta.key looks like a closed port. The server's own log tells the two apart.
TLS key negotiation failed to occur within 60 seconds (check your network connectivity), nothing from the server above itCausePackets don't arrive, or the server drops them in silence
What to doCheck the address, port and
proto, then the firewalls, then the tls-auth or tls-crypt keyThe same, but with
TLS: Initial packet fromCauseThe handshake started and stopped: large packets are lost, the network cuts it, or the server refused the certificate
What to doRead the server's log; try
proto tcp, another networkTLS Error: tls-crypt unwrapping failed fromCauseThe tls-crypt keys differ, or one side uses tls-crypt and the other tls-auth or nothing
What to doTake the same key and the same directive on both sides
TLS Error: cannot locate HMAC in incoming packet fromCauseOne side has
tls-auth, the other doesn't, or has tls-cryptWhat to doAdd the same
tls-authto the client, or remove it on the serverTLS Error: incoming packet authentication failed fromCauseDifferent ta.key files, the wrong
key-direction, or a differentauthWhat to doThe server has direction 0, the client 1; the key and
authare the sameVERIFY ERROR: depth=0, error=certificate has expiredCauseThe server's certificate is out of date, or the clock is wrong
What to doCheck the date, then renew the certificate
AUTH: Received control message: AUTH_FAILEDCauseThe server refused the login, password or cipher
What to doSee the section on AUTH_FAILED
OPTIONS ERROR: failed to negotiate cipher with serverCauseNo cipher in common, usually an old server
What to doAdd the cipher the line names to
data-ciphersRESOLVE: Cannot resolve host addressCauseThe server's name doesn't turn into an address
What to doCheck the name and your DNS
Connection refused, on WindowsWSAECONNRESETorWSAECONNREFUSEDCauseThe server is reachable, but nothing listens on this port and protocol
What to doStart OpenVPN on the server, compare the port and
proto
TLS key negotiation failed to occur within 60 seconds
- 1
Compare remote and proto with the server
proto udpon the client andproto tcpon the server will never meet, and neither will different ports. The server'sportandprotolines are in its config. - 2
Check that the server runs
On the server
systemctl status openvpn-server@server(or your unit's name) should sayactive (running), and the port should be in the answer ofss -lunfor UDP orss -ltnfor TCP. - 3
Open the port everywhere
There are up to three firewalls: on the server (
ufw allow 1194/udp), in the host's panel and, for a server at home, port forwarding on the router. UDP and TCP are opened separately. - 4
Check your own computer
A firewall or antivirus may block openvpn.exe, and another VPN may be carrying the connection: turn it off.
- 5
Try another network
Connect from mobile data. If it works there, the first network cuts OpenVPN or UDP.
proto tcpon port 443 helps against closed ports; against filtering that recognises OpenVPN you need a protocol with disguise. - 6
Look at the server's log while connecting
Nothing appears: the packets don't reach it. Lines with your address appear: the cause is in them.
tls-crypt unwrapping failed, cannot locate HMAC, packet authentication failed
These are about the extra key that wraps the handshake: ta.key or tc.key, one file that must be the same on both sides. The lines appear on the side that could not read the other's packet, most often the server; the client then only sees 60 seconds of silence. Next to them OpenVPN writes a more exact tls-crypt unwrap error: packet authentication failed or Authenticate/Decrypt packet error: packet HMAC authentication failed.
- Different keys. The server was reinstalled, and the old .ovpn still has the old key. Take a new file.
- Different directives.
tls-auth,tls-cryptandtls-crypt-v2don't mix: if the server hastls-crypt, so must the client. - Direction. Only for
tls-auth:tls-auth ta.key 0on the server,tls-auth ta.key 1on the client, orkey-direction 1when the key is inside the file.tls-crypthas no direction. - Strangers. On a public server such lines come from scanners that knock on the port. If your own devices connect, ignore them.
VERIFY ERROR and certificate verify failed
The other side's certificate didn't pass the check. After it usually come OpenSSL: error:0A000086:SSL routines::certificate verify failed, TLS_ERROR: BIO read tls_read_plaintext error and TLS Error: TLS object -> incoming plaintext read error. The reason is after error=:
certificate has expiredWhat it meansThe date has passed. easy-rsa gives certificates 825 days by default
What to doIssue a new certificate; check the clock first
certificate is not yet validWhat it meansThe device's clock is behind
What to doTurn on automatic date and time
CRL has expiredWhat it meansThe server's revocation list is out of date: easy-rsa makes it for 180 days. All devices stop connecting on the same day
What to doOn the server:
./easyrsa gen-crl, put the new crl.pem in placecertificate revokedWhat it meansThis device's certificate was revoked
What to doAsk for a new file
unable to get local issuer certificate,self-signed certificate in certificate chainWhat it meansThe
cain the file isn't the one that signed the server's certificateWhat to doTake the ca.crt of this server: after a reinstall it is different
unsuitable certificate purpose,VERIFY KU ERROR,VERIFY EKU ERRORWhat it means
remote-cert-tls serveris on, and the certificate wasn't issued as a server'sWhat to doIssue the server's certificate with build-server-full
CA signature digest algorithm too weak, orca md too weakWhat it meansAn old certificate signed with MD5 or SHA-1, refused by new OpenSSL
What to doMake new certificates
VERIFY X509NAME ERROR: …, must be …What it meansThe name in the certificate isn't the one in
verify-x509-nameWhat to doFix the name, or make sure this is the right server
AUTH_FAILED
Here TLS is fine: the server was reached and said no. The full line is AUTH: Received control message: AUTH_FAILED, and after it the client leaves with SIGTERM[soft,auth-failure]. If there is a comma and a reason, the server told you why.
- Just
AUTH_FAILEDmeans a wrong login or password. Type them by hand: one extra space in pass.txt is enough. Many services have a separate login for OpenVPN. AUTH_FAILED,Data channel cipher negotiation failed (no shared cipher)means no common cipher. Setdata-ciphers AES-256-GCM:AES-128-GCM:CHACHA20-POLY1305on the server; for a very old client add its cipher there.- The password is right, but it fails anyway. The subscription has ended, the limit of devices is reached, or the one-time code was used once already.
- It worked and fails after an hour. The server changes keys and asks for the password again; a one-time code no longer fits. The server needs
auth-gen-token.
Commands for checking
Test-NetConnection vpn.example.com -Port 443Only for proto tcp; on macOS and Linux nc -vz vpn.example.com 443. A UDP port can't be checked like this.
tcpdump -ni any udp port 1194Start it and connect. Nothing: the packets don't reach the server. Packets in and none out: the server drops them, read its log.
journalctl -u openvpn-server@server -n 50 --no-pagerA server with verb 0 writes only fatal errors; set verb 3 for the time of the search.
openssl x509 -in /etc/openvpn/server/server.crt -noout -dates
openssl crl -in /etc/openvpn/server/crl.pem -noout -nextupdateWhen this doesn't help
- Old server, new client. OpenVPN 2.6 no longer offers BF-CBC and the like, and OpenSSL 3 refuses weak certificates and old TLS:
unsupported protocolin the log is about the TLS version. Update the server. - Large packets are lost. The first small packets pass and the certificates don't. Try
proto tcpor another network. - A tangle of keys. On your own server it is faster to make a new certificate authority and hand out new files.