[solved] OpenVPN: udp -> tls handshake failed / tcp ->

Post new topic   Reply to topic    DD-WRT Forum Index -> General Questions
Author Message
BigMan200
DD-WRT Novice


Joined: 27 Mar 2010
Posts: 47

PostPosted: Sun Apr 16, 2017 10:27    Post subject: [solved] OpenVPN: udp -> tls handshake failed / tcp -> Reply with quote
Hi,
since two days I am trying to setup an OpenVPN connection.
When I am using udp as a protocoll, the error messeage is: TLS Error: TLS handshake failed

Code:

$ sudo openvpn --config /etc/openvpn/client/client.conf
Sun Apr 16 11:31:58 2017 OpenVPN 2.4.1 i686-pc-linux-gnu [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [PKCS11] [MH/PKTINFO] [AEAD] built on Mar 22 2017
Sun Apr 16 11:31:58 2017 library versions: OpenSSL 1.0.2k  26 Jan 2017, LZO 2.10
Enter Private Key Password: ************************
Sun Apr 16 11:32:08 2017 WARNING: this configuration may cache passwords in memory -- use the auth-nocache option to prevent this
Sun Apr 16 11:32:09 2017 TCP/UDP: Preserving recently used remote address: [AF_INET]94.114.160.3:1194
Sun Apr 16 11:32:09 2017 UDP link local: (not bound)
Sun Apr 16 11:32:09 2017 UDP link remote: [AF_INET]94.114.160.3:1194
Sun Apr 16 11:33:09 2017 TLS Error: TLS key negotiation failed to occur within 60 seconds (check your network connectivity)
Sun Apr 16 11:33:09 2017 TLS Error: TLS handshake failed
Sun Apr 16 11:33:09 2017 SIGUSR1[soft,tls-error] received, process restarting


and in case of tcp: Connection reset, restarting [0]
Code:

sudo openvpn --config /etc/openvpn/client/client.conf
Sun Apr 16 11:53:22 2017 OpenVPN 2.4.1 i686-pc-linux-gnu [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [PKCS11] [MH/PKTINFO] [AEAD] built on Mar 22 2017
Sun Apr 16 11:53:22 2017 library versions: OpenSSL 1.0.2k  26 Jan 2017, LZO 2.10
Enter Private Key Password: ************************
Sun Apr 16 11:53:34 2017 WARNING: this configuration may cache passwords in memory -- use the auth-nocache option to prevent this
Sun Apr 16 11:53:35 2017 TCP/UDP: Preserving recently used remote address: [AF_INET]94.114.160.3:1194
Sun Apr 16 11:53:35 2017 Attempting to establish TCP connection with [AF_INET]94.114.160.3:1194 [nonblock]
Sun Apr 16 11:53:36 2017 TCP connection established with [AF_INET]94.114.160.3:1194
Sun Apr 16 11:53:36 2017 TCP_CLIENT link local: (not bound)
Sun Apr 16 11:53:36 2017 TCP_CLIENT link remote: [AF_INET]94.114.160.3:1194
Sun Apr 16 11:53:44 2017 Connection reset, restarting [0]
Sun Apr 16 11:53:44 2017 SIGUSR1[soft,connection-reset] received, process restarting
Sun Apr 16 11:53:49 2017 TCP/UDP: Preserving recently used remote address: [AF_INET]94.114.160.3:1194


It makes no difference if the SPI firewall is enabled or disabled.

OpenVpn config file on the client:
Code:

remote <MY-DNS-IP> 1194

client
remote-cert-tls server
dev tun0
proto tcp
resolv-retry infinite
nobind
persist-key
persist-tun
float

ca /etc/openvpn/ca.crt
cert /etc/openvpn/client_LenovoX201.crt
key /etc/openvpn/client_LenovoX201.key


Config file on the dd-wrt-Router:
Code:

push "route 10.0.0.0 255.255.255.0"
server 10.8.0.0 255.255.255.0
dev tun0
proto tcp
port 1194

dh /tmp/openvpn/dh.pem
ca /tmp/openvpn/ca.crt
cert /tmp/openvpn/cert.pem
key /tmp/openvpn/key.pem

ping-timer-rem
keepalive 20 180
verb 5
mute 50
management localhost 5001


dd-wrt Web-Gui Admininstration -> Commands -> Save Firewall
Code:

iptables -I INPUT 1 -p tcp --dport 1194 -j ACCEPT
iptables -I FORWARD 1 --source 10.8.0.0/24 -j ACCEPT
iptables -I FORWARD -i br0 -o tun0 -j ACCEPT
iptables -I FORWARD -i tun0 -o br0 -j ACCEPT


# ps | grep openvpn (dd-wrt router)
Code:

770 root      2064 S    openvpn --config /tmp/openvpn/openvpn.conf --route-up /tmp/openvpn/route-up.sh --down /tmp/openvpn/route-down.sh


# cat /var/log/messages | grep openvpn (dd-wrt router)
Code:

Apr 16 12:10:24 DD-WRT (Host) daemon.notice openvpn[770]: OpenVPN 2.1_rc20 mipsel-unknown-linux-gnu [SSL] [LZO1] [EPOLL] built on Oct 10 2009
Apr 16 12:10:24 DD-WRT (Host) daemon.notice openvpn[770]: MANAGEMENT: TCP Socket listening on 127.0.0.1:5001
Apr 16 12:10:26 DD-WRT (Host) daemon.notice openvpn[770]: Diffie-Hellman initialized with 2048 bit key


Last edited by BigMan200 on Mon Apr 17, 2017 17:16; edited 1 time in total
Sponsor
Per Yngve Berg
DD-WRT Guru


Joined: 13 Aug 2013
Posts: 6868
Location: Romerike, Norway

PostPosted: Sun Apr 16, 2017 12:00    Post subject: Reply with quote
You are using two different OpenVPN versions (2.1 and 2.4)

IPV4 and IPV6 is split in the configuration file from 2.3

Old: proto udp
New: proto udp4

dd-wrt build 31825 contains OpenVPN version 2.4.0
BigMan200
DD-WRT Novice


Joined: 27 Mar 2010
Posts: 47

PostPosted: Sun Apr 16, 2017 12:41    Post subject: Reply with quote
Per Yngve Berg wrote:
You are using two different OpenVPN versions (2.1 and 2.4)

IPV4 and IPV6 is split in the configuration file from 2.3

Old: proto udp
New: proto udp4

dd-wrt build 31825 contains OpenVPN version 2.4.0


I have a Linksys wrtgl54 Router.
When I look this one up in the dd-wrt database it tells me:
Supported by v24 preSP2 [Beta] Build 13064. The file offered on this webpage which includes "VPN Generic" is dated 2009-10-10.

And when I check on the top-right in my dd-WRT Webgui it says:
Firmware: DD-WRT v24-sp2 (10/10/09) vpn

==> I assume, I have the most updated version I can get for this router (correct?)

... based on the assumption I cannot update my OpenVpn on the dd-WRT router, I tried the following:

in the config-file from the client, I changed "proto tcp" to proto "tcp4" ... but this didn't chagne anything.
Next I also changed on the dd-wrt Router the Openvpn config to tcp4 and the Adminstration->Commands->Save firewall to tcp4 ... still no improvement. I could also see, that in this case "ps | grep openvpn" on the dd-wrt didn't return anything. So I changed it back to tcp on the router (while keeping tcp4 on the client).

Bottom line: still not working Sad
Per Yngve Berg
DD-WRT Guru


Joined: 13 Aug 2013
Posts: 6868
Location: Romerike, Norway

PostPosted: Sun Apr 16, 2017 13:56    Post subject: Reply with quote
Don't use the Router Database

ftp://ftp.dd-wrt.com/betas/2017/04-06-2017-r31825/broadcom/dd-wrt.v24_vpn_generic.bin

http://www.dd-wrt.com/phpBB2/viewtopic.php?t=308185
BigMan200
DD-WRT Novice


Joined: 27 Mar 2010
Posts: 47

PostPosted: Sun Apr 16, 2017 16:15    Post subject: Reply with quote
Per Yngve Berg wrote:
Don't use the Router Database

ftp://ftp.dd-wrt.com/betas/2017/04-06-2017-r31825/broadcom/dd-wrt.v24_vpn_generic.bin

http://www.dd-wrt.com/phpBB2/viewtopic.php?t=308185


okay, I updated the dd-wrt firmeware successfully. Now, it says:
Firmware: DD-WRT v3.0-r31825 vpn (04/06/17).

Also, I changed everything back to tcp only (in the config files and in the firewall command I have now only tcp, not tcp4). But the problem is still there. Same, when I use udp.

But there is now one point different to my old firmeware. I can now choose between Config as "Server" or "Daemon". First I tried it with "Daemon" and putted in the Additional Config box my previous Config setting.

I also tried it with "Server" and I got more field to fill out. Here I was a bit lost and choose for the Network 10.0.0.0 (which is my target network I want to connect with).

Anyhow nothing worked. But in /var/log/messages I have now (new):
Code:
Apr 16 19:02:42 DD-WRT (Host) daemon.notice openvpn[1644]: Diffie-Hellman initialized with 2048 bit key
Apr 16 19:02:42 DD-WRT (Host) daemon.err openvpn[1644]: neither stdin nor stderr are a tty device and you have neither a controlling tty nor systemd - can't ask for 'Enter Private Key Password:'.  If you used --daemon, you need to use --askpass to make passphrase-protected ke
Apr 16 19:02:42 DD-WRT (Host) daemon.notice openvpn[1644]: Exiting due to fatal error


... once again a full day spend on this without success ... well ... btw ... when should I use "Config as Server", and when "Config as Daemon"???
Per Yngve Berg
DD-WRT Guru


Joined: 13 Aug 2013
Posts: 6868
Location: Romerike, Norway

PostPosted: Sun Apr 16, 2017 18:08    Post subject: Reply with quote
You should not have generated the certificates with a password.
BigMan200
DD-WRT Novice


Joined: 27 Mar 2010
Posts: 47

PostPosted: Mon Apr 17, 2017 7:10    Post subject: Reply with quote
Per Yngve Berg wrote:
You should not have generated the certificates with a password.


I generated all key-pairs with easy-rsa.
When I create the CA and the key-pairs I am always asked for a "PEM pass phrase". How can I avoid this:

Code:
# easyrsa build-ca
# easyrsa gen-req ddwrtRouter
# easyrsa gen-req client1

==> all three commands are asking me automatically for a password.

I assume now, your point is not to use password for the key/certificate which goes to the ddwrtRouter. For this I figured out the following:
Code:
#easyrsa gen-req ddwrtRouter nopass


But so far I couldn't test, if this solves the issue, because with the update to the new ddWRT-firmeware I have now a changed WebGui interface for the OpenVPN setting. Since this is a new problem, I opened another thread http://www.dd-wrt.com/phpBB2/viewtopic.php?p=1075519#1075519.
BigMan200
DD-WRT Novice


Joined: 27 Mar 2010
Posts: 47

PostPosted: Mon Apr 17, 2017 17:15    Post subject: Reply with quote
in the meantime, I was able to check it.
Yes the problem is solved.
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> General Questions All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum