I'm connecting to an openvpn server that I have no control over. It works perfectly for one hour, then the tls reset happens and after that - despite still appearing to be connected - there is no successful traffic through the vpn. If I restart openvpn (client) it works again until the next tls reset.
I'm having trouble figuring out exactly where the problem is...
My machine (the client) is set up like this:
eth0 - wan
eth1 and eth2 - local subnets (not involved with vpn)
tap0 - openvpn
I have a routing policy set up so that only desired traffic goes through the vpn, and everything else goes through the normal wan connection.
I do not have access to the server config, but my client config is:
Code: Select all
client
dev tap
proto tcp
port 5555
remote my_vpn_server.xxx
resolv-retry infinite
nobind
persist-key
persist-tun
ca tp.ca.crt
ns-cert-type server
comp-lzo
verb 3
auth-user-pass /etc/openvpn/pwf
status openvpn-status.log
log /var/log/openvpn.log
log-append /var/log/openvpn.log
# this is here because I don't want all traffic going through the vpn
# my "up" script takes care of routing
route-noexec
pull
My custom up script (sets up routing, iptables rules, etc.)
Code: Select all
ip route add $trusted_ip/32 via $route_net_gateway
real_default_route=`ip route show table main | grep default`
ip route del table main $real_default_route
ip route add table real_default $real_default_route
ip route add table vpn default via $route_vpn_gateway
# I put this bogus route here because I was getting "network
# unreachable" on the initial routeing decision because
# until the mark is matched by ip rule and (re)routed correctly,
# there was no default so the packet would apparently get dropped.
ip route add table bogus default via 192.168.0.252 dev eth1
/sbin/iptables -t nat -A POSTROUTING -o tap0 -j MASQUERADE
/sbin/iptables -t mangle -A OUTPUT -p tcp --dport 80 -j MARK --set-mark 4
/sbin/iptables -t mangle -A OUTPUT -p tcp --dport 443 -j MARK --set-mark 4
/sbin/iptables -t mangle -A OUTPUT -p udp --dport 53 -j MARK --set-mark 4
# added this so vpn traffic (with invalid route at this stage) wouldn't get
# zapped by my other rules...
/sbin/iptables -I OUTPUT -m mark --mark 4 -j ACCEPT
# vpn, real_default, and bogus are in my /etc/iproute2/rt_tables
ip rule flush
ip rule add prio 32766 from all lookup main
ip rule add prio 32767 from all lookup default
ip rule add prio 40000 from all fwmark 0x4 lookup vpn
ip rule add prio 40001 not from all fwmark 0x4 lookup real_default
ip rule add prio 40002 from all lookup bogus
ip route flush cache
This all works flawlessly, until the tls-reset occurs. Here is the log: (IPs and private info changed/replaced with xxx):
Code: Select all
Mon Dec 26 17:05:57 2011 OpenVPN 2.1.4 x86_64-pc-linux-gnu [SSL] [LZO2] [EPOLL] built on Dec 4 2011
Mon Dec 26 17:05:57 2011 NOTE: the current --script-security setting may allow this configuration to call user-defined scripts
Mon Dec 26 17:05:57 2011 LZO compression initialized
Mon Dec 26 17:05:57 2011 Control Channel MTU parms [ L:1576 D:140 EF:40 EB:0 ET:0 EL:0 ]
Mon Dec 26 17:05:57 2011 Socket Buffers: R=[87380->131072] S=[16384->131072]
Mon Dec 26 17:05:57 2011 Data Channel MTU parms [ L:1576 D:1450 EF:44 EB:135 ET:32 EL:0 AF:3/1 ]
Mon Dec 26 17:05:57 2011 Local Options hash (VER=V4): '31fdf004'
Mon Dec 26 17:05:57 2011 Expected Remote Options hash (VER=V4): '3e6d1056'
Mon Dec 26 17:05:57 2011 Attempting to establish TCP connection with xxx.xxx.54.12:5555 [nonblock]
Mon Dec 26 17:05:58 2011 TCP connection established with xxx.xxx.54.12:5555
Mon Dec 26 17:05:58 2011 TCPv4_CLIENT link local: [undef]
Mon Dec 26 17:05:58 2011 TCPv4_CLIENT link remote: xxx.xxx.54.12:5555
Mon Dec 26 17:05:58 2011 TLS: Initial packet from xxx.xxx.54.12:5555, sid=135bda35 9e260870
Mon Dec 26 17:05:58 2011 WARNING: this configuration may cache passwords in memory -- use the auth-nocache option to prevent this
Mon Dec 26 17:06:01 2011 VERIFY OK: depth=1, /C=US/ST=CA/L=xxxxxxxxxxx/O=xxxxxxxxxxxx/CN=xxxxxxxxxxxCA/emailAddress=admin@xxxxxxxxxxxxx.xxx
Mon Dec 26 17:06:01 2011 VERIFY OK: nsCertType=SERVER
Mon Dec 26 17:06:01 2011 VERIFY OK: depth=0, /C=US/ST=CA/L=xxxxxxxxxxxxx/O=xxxxxxxxxxxxx/CN=server/emailAddress=admin@xxxxxxxxxxxxx.xxx
Mon Dec 26 17:06:02 2011 Data Channel Encrypt: Cipher 'BF-CBC' initialized with 128 bit key
Mon Dec 26 17:06:02 2011 Data Channel Encrypt: Using 160 bit message hash 'SHA1' for HMAC authentication
Mon Dec 26 17:06:02 2011 Data Channel Decrypt: Cipher 'BF-CBC' initialized with 128 bit key
Mon Dec 26 17:06:02 2011 Data Channel Decrypt: Using 160 bit message hash 'SHA1' for HMAC authentication
Mon Dec 26 17:06:02 2011 Control Channel: TLSv1, cipher TLSv1/SSLv3 DHE-RSA-AES256-SHA, 1024 bit RSA
Mon Dec 26 17:06:02 2011 [server] Peer Connection Initiated with xxx.xxx.54.12:5555
Mon Dec 26 17:06:05 2011 SENT CONTROL [server]: 'PUSH_REQUEST' (status=1)
Mon Dec 26 17:06:05 2011 PUSH: Received control message: 'PUSH_REPLY,redirect-gateway def1,route-gateway 10.10.0.1,dhcp-option DNS 10.10.0.1,ifconfig 10.10.0.52 255.255.255.0'
Mon Dec 26 17:06:05 2011 OPTIONS IMPORT: --ifconfig/up options modified
Mon Dec 26 17:06:05 2011 OPTIONS IMPORT: route options modified
Mon Dec 26 17:06:05 2011 OPTIONS IMPORT: route-related options modified
Mon Dec 26 17:06:05 2011 OPTIONS IMPORT: --ip-win32 and/or --dhcp-option options modified
Mon Dec 26 17:06:05 2011 ROUTE default_gateway=xxx.xxx.23.1
Mon Dec 26 17:06:05 2011 TUN/TAP device tap0 opened
Mon Dec 26 17:06:05 2011 TUN/TAP TX queue length set to 100
Mon Dec 26 17:06:05 2011 /sbin/ip link set dev tap0 up mtu 1500
Mon Dec 26 17:06:05 2011 /sbin/ip addr add dev tap0 10.10.0.52/24 broadcast 10.10.0.255
Mon Dec 26 17:06:05 2011 /etc/openvpn/up.sh tap0 1500 1576 10.10.0.52 255.255.255.0 init
* status: inactive
Mon Dec 26 17:06:05 2011 Initialization Sequence Completed
Mon Dec 26 18:06:02 2011 TLS: soft reset sec=0 bytes=5559329/0 pkts=14618/0
Mon Dec 26 18:06:02 2011 WARNING: this configuration may cache passwords in memory -- use the auth-nocache option to prevent this
Mon Dec 26 18:06:05 2011 VERIFY OK: depth=1, /C=US/ST=CA/L=xxxxxxxxxxx/O=xxxxxxxxxxx/CN=xxxxxxxxxxxCA/emailAddress=admin@xxxxxxxxxxx.xxx
Mon Dec 26 18:06:05 2011 VERIFY OK: nsCertType=SERVER
Mon Dec 26 18:06:05 2011 VERIFY OK: depth=0, /C=US/ST=CA/L=xxxxxxxxxxx/O=xxxxxxxxxxx/CN=server/emailAddress=admin@xxxxxxxxxxx.xxx
Mon Dec 26 18:06:09 2011 Data Channel Encrypt: Cipher 'BF-CBC' initialized with 128 bit key
Mon Dec 26 18:06:09 2011 Data Channel Encrypt: Using 160 bit message hash 'SHA1' for HMAC authentication
Mon Dec 26 18:06:09 2011 Data Channel Decrypt: Cipher 'BF-CBC' initialized with 128 bit key
Mon Dec 26 18:06:09 2011 Data Channel Decrypt: Using 160 bit message hash 'SHA1' for HMAC authentication
Mon Dec 26 18:06:09 2011 Control Channel: TLSv1, cipher TLSv1/SSLv3 DHE-RSA-AES256-SHA, 1024 bit RSA
Any ideas? Thanks in advance!!