TLS Error: TLS key negotiation failed to occur within 60 seconds

The error means the client and the server didn't finish the TLS handshake in 60 seconds. If there is nothing from the server in the log before it, the packets don't get through: a closed port, UDP instead of TCP or the other way round, a wrong address, a stopped server, or a network that cuts OpenVPN. If the server did answer, look at the line above: tls-crypt and HMAC errors mean a wrong key, VERIFY ERROR means the certificate, AUTH_FAILED means the login.

Updated

.ovpn file: build, split and check it

Veli says why it doesn't connect. While an OpenVPN profile connects, the line under the button names the cause in words: “The server isn't answering: it's down, or the network doesn't let it through” stands for TLS key negotiation failed, “The server refuses the connection: the VPN isn't running on it, or the port is closed” for connection refused, and there is one for a name that isn't found.

Download Veli for free
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 it

    CausePackets 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 key

  • The same, but with TLS: Initial packet from

    CauseThe 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 network

  • TLS Error: tls-crypt unwrapping failed from

    CauseThe 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 from

    CauseOne side has tls-auth, the other doesn't, or has tls-crypt

    What to doAdd the same tls-auth to the client, or remove it on the server

  • TLS Error: incoming packet authentication failed from

    CauseDifferent ta.key files, the wrong key-direction, or a different auth

    What to doThe server has direction 0, the client 1; the key and auth are the same

  • VERIFY ERROR: depth=0, error=certificate has expired

    CauseThe 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_FAILED

    CauseThe server refused the login, password or cipher

    What to doSee the section on AUTH_FAILED

  • OPTIONS ERROR: failed to negotiate cipher with server

    CauseNo cipher in common, usually an old server

    What to doAdd the cipher the line names to data-ciphers

  • RESOLVE: Cannot resolve host address

    CauseThe server's name doesn't turn into an address

    What to doCheck the name and your DNS

  • Connection refused, on Windows WSAECONNRESET or WSAECONNREFUSED

    CauseThe 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. 1

    Compare remote and proto with the server

    proto udp on the client and proto tcp on the server will never meet, and neither will different ports. The server's port and proto lines are in its config.

  2. 2

    Check that the server runs

    On the server systemctl status openvpn-server@server (or your unit's name) should say active (running), and the port should be in the answer of ss -lun for UDP or ss -ltn for TCP.

  3. 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. 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. 5

    Try another network

    Connect from mobile data. If it works there, the first network cuts OpenVPN or UDP. proto tcp on port 443 helps against closed ports; against filtering that recognises OpenVPN you need a protocol with disguise.

  6. 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-crypt and tls-crypt-v2 don't mix: if the server has tls-crypt, so must the client.
  • Direction. Only for tls-auth: tls-auth ta.key 0 on the server, tls-auth ta.key 1 on the client, or key-direction 1 when the key is inside the file. tls-crypt has 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 expired

    What 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 valid

    What it meansThe device's clock is behind

    What to doTurn on automatic date and time

  • CRL has expired

    What 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 place

  • certificate revoked

    What 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 chain

    What it meansThe ca in the file isn't the one that signed the server's certificate

    What to doTake the ca.crt of this server: after a reinstall it is different

  • unsuitable certificate purpose, VERIFY KU ERROR, VERIFY EKU ERROR

    What it meansremote-cert-tls server is on, and the certificate wasn't issued as a server's

    What to doIssue the server's certificate with build-server-full

  • CA signature digest algorithm too weak, or ca md too weak

    What 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-name

    What 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_FAILED means 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. Set data-ciphers AES-256-GCM:AES-128-GCM:CHACHA20-POLY1305 on 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

TCP port, Windows: PowerShell
Test-NetConnection vpn.example.com -Port 443

Only for proto tcp; on macOS and Linux nc -vz vpn.example.com 443. A UDP port can't be checked like this.

On the server: do the packets arrive
tcpdump -ni any udp port 1194

Start it and connect. Nothing: the packets don't reach the server. Packets in and none out: the server drops them, read its log.

On the server: the log
journalctl -u openvpn-server@server -n 50 --no-pager

A server with verb 0 writes only fatal errors; set verb 3 for the time of the search.

Dates of a certificate
openssl x509 -in /etc/openvpn/server/server.crt -noout -dates
openssl crl -in /etc/openvpn/server/crl.pem -noout -nextupdate

When 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 protocol in 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 tcp or another network.
  • A tangle of keys. On your own server it is faster to make a new certificate authority and hand out new files.

Sources

How we write and check

In Veli

Veli says why it doesn't connect

While an OpenVPN profile connects, the line under the button names the cause in words: “The server isn't answering: it's down, or the network doesn't let it through” stands for TLS key negotiation failed, “The server refuses the connection: the VPN isn't running on it, or the port is closed” for connection refused, and there is one for a name that isn't found. AUTH_FAILED is shown as the server sent it. “What happened” opens the connection's log with OpenVPN's own lines.

Veli connects OpenVPN on Windows and Linux only. In Profiles, OpenVPN servers show the ping of the address, not a check of the protocol. On your own server the app installs OpenVPN with fresh certificates valid for ten years and the tls-crypt key already inside the .ovpn, so keys and directions don't have to be matched by hand.

FAQ

What is TLS key negotiation failed to occur within 60 seconds?

The handshake with the server didn't finish in the time set by hand-window, 60 seconds by default. The usual causes are a closed port, the wrong protocol or a wrong tls-auth key.

Why does OpenVPN connect from mobile data but not from home Wi-Fi?

Your home network or its provider doesn't let this port or OpenVPN itself through. Try proto tcp on port 443 or a protocol with disguise.

What is ta.key and can I connect without it?

It is the key of tls-auth or tls-crypt that protects the handshake. If the server has it, a client without it gets no answer at all.

Why did all devices stop connecting on the same day?

Most likely the server's CRL or its certificate expired. Look for “CRL has expired” or “certificate has expired” in the server's log.

The reason in words, not sixty seconds of silence

Veli is a free client for Windows, macOS, Linux and Android. OpenVPN connects on Windows and Linux, and the line under the button says what is wrong.