Hi Everybody,
I'm trying to make a openvpn connection between a client in a docker container and a server which is probably on a xen host.
Here is my client config :
client
dev tun
proto udp
remote <MY_SERVER_PUBLIC_IP> <MY_OPENVPN_PORT>
resolv-retry infinite
nobind
user nobody
group nogroup
persist-key
persist-tun
ca keys/ca.crt
cert keys/my_user.crt
key keys/my_user.key
ns-cert-type server
tls-auth keys/ta.key 1
cipher AES-256-CBC
auth SHA512
comp-lzo
verb 3
tun-mtu 1492
redirect-gateway def1
status openvpn-status.log
log-append openvpn.log
script-security 2
up "/etc/openvpn/clean-resolv-conf && /etc/openvpn/update-resolv-conf"
down /etc/openvpn/update-resolv-conf
if you're curious, here is the script clean-resolv-conf, which I wrote to make resolvconf to work in a container :
#!/bin/bash
umount /etc/resolv.conf
rm /etc/resolv.conf
ln -s /etc/resolvconf/run/resolv.conf /etc/resolv.conf
my client logs :
openvpn.log:
Sun Dec 27 20:49:57 2015 OpenVPN 2.3.4 x86_64-pc-linux-gnu [SSL (OpenSSL)] [LZO] [EPOLL] [PKCS11] [MH] [IPv6] built on Dec 1 2014
Sun Dec 27 20:49:57 2015 library versions: OpenSSL 1.0.1k 8 Jan 2015, LZO 2.08
Sun Dec 27 20:49:57 2015 NOTE: the current --script-security setting may allow this configuration to call user-defined scripts
Sun Dec 27 20:49:57 2015 Control Channel Authentication: using 'keys/ta.key' as a OpenVPN static key file
Sun Dec 27 20:49:57 2015 Outgoing Control Channel Authentication: Using 512 bit message hash 'SHA512' for HMAC authentication
Sun Dec 27 20:49:57 2015 Incoming Control Channel Authentication: Using 512 bit message hash 'SHA512' for HMAC authentication
Sun Dec 27 20:49:57 2015 WARNING: normally if you use --mssfix and/or --fragment, you should also set --tun-mtu 1500 (currently it is 1492)
Sun Dec 27 20:49:57 2015 Socket Buffers: R=[212992->131072] S=[212992->131072]
Sun Dec 27 20:49:57 2015 NOTE: UID/GID downgrade will be delayed because of --client, --pull, or --up-delay
Sun Dec 27 20:49:57 2015 UDPv4 link local: [undef]
Sun Dec 27 20:49:57 2015 UDPv4 link remote: [AF_INET]<MY_SERVER_PUBLIC_IP>:<MY_OPENVPN_PORT>
Sun Dec 27 20:49:57 2015 TLS: Initial packet from [AF_INET]<MY_SERVER_PUBLIC_IP>:<MY_OPENVPN_PORT>, sid=5b0d6bc3 8d9c1b2e
Sun Dec 27 20:49:58 2015 VERIFY OK: depth=1, C=FR, ST=n/a, L=n/a, O=me, OU=me, CN=my CA, name=Me, emailAddress=me@mail.com
Sun Dec 27 20:49:58 2015 VERIFY OK: nsCertType=SERVER
Sun Dec 27 20:49:58 2015 VERIFY OK: depth=0, C=FR, ST=n/a, L=n/a, O=me, OU=me, CN=server, name=Me, emailAddress=me@mail.com
Sun Dec 27 20:50:03 2015 Data Channel Encrypt: Cipher 'AES-256-CBC' initialized with 256 bit key
Sun Dec 27 20:50:03 2015 Data Channel Encrypt: Using 512 bit message hash 'SHA512' for HMAC authentication
Sun Dec 27 20:50:03 2015 Data Channel Decrypt: Cipher 'AES-256-CBC' initialized with 256 bit key
Sun Dec 27 20:50:03 2015 Data Channel Decrypt: Using 512 bit message hash 'SHA512' for HMAC authentication
Sun Dec 27 20:50:03 2015 Control Channel: TLSv1, cipher TLSv1/SSLv3 DHE-RSA-AES256-SHA, 8192 bit RSA
Sun Dec 27 20:50:03 2015 [server] Peer Connection Initiated with [AF_INET]<MY_SERVER_PUBLIC_IP>:<MY_OPENVPN_PORT>
Sun Dec 27 20:50:06 2015 SENT CONTROL [server]: 'PUSH_REQUEST' (status=1)
Sun Dec 27 20:50:06 2015 PUSH: Received control message: 'PUSH_REPLY,redirect-gateway def1 bypass-dhcp,dhcp-option DNS 80.67.169.12,dhcp-option DNS 80.67.169.40,route 10.8.49.1,topology net30,ping 10,ping-restart 120,ifconfig 10.8.49.6 10.8.49.5'
Sun Dec 27 20:50:06 2015 OPTIONS IMPORT: timers and/or timeouts modified
Sun Dec 27 20:50:06 2015 OPTIONS IMPORT: --ifconfig/up options modified
Sun Dec 27 20:50:06 2015 OPTIONS IMPORT: route options modified
Sun Dec 27 20:50:06 2015 OPTIONS IMPORT: --ip-win32 and/or --dhcp-option options modified
Sun Dec 27 20:50:06 2015 ROUTE_GATEWAY 172.17.0.1/255.255.0.0 IFACE=eth0 HWADDR=03:36:bc:41:51:02
Sun Dec 27 20:50:06 2015 TUN/TAP device tun0 opened
Sun Dec 27 20:50:06 2015 TUN/TAP TX queue length set to 100
Sun Dec 27 20:50:06 2015 do_ifconfig, tt->ipv6=0, tt->did_ifconfig_ipv6_setup=0
Sun Dec 27 20:50:06 2015 /sbin/ip link set dev tun0 up mtu 1492
Sun Dec 27 20:50:06 2015 /sbin/ip addr add dev tun0 local 10.8.49.6 peer 10.8.49.5
Sun Dec 27 20:50:06 2015 /etc/openvpn/clean-resolv-conf && /etc/openvpn/update-resolv-conf tun0 1492 1594 10.8.49.6 10.8.49.5 init
Sun Dec 27 20:50:06 2015 /sbin/ip route add <MY_SERVER_PUBLIC_IP>/32 via 172.17.0.1
Sun Dec 27 20:50:06 2015 /sbin/ip route add 0.0.0.0/1 via 10.8.49.5
Sun Dec 27 20:50:06 2015 /sbin/ip route add 128.0.0.0/1 via 10.8.49.5
Sun Dec 27 20:50:06 2015 /sbin/ip route add 10.8.49.1/32 via 10.8.49.5
Sun Dec 27 20:50:06 2015 GID set to nogroup
Sun Dec 27 20:50:06 2015 UID set to nobody
Sun Dec 27 20:50:06 2015 Initialization Sequence Completed
I can't ping anything :
ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes
^C--- 8.8.8.8 ping statistics ---
8 packets transmitted, 0 packets received, 100% packet loss
except for the openvpn server ip :
# ping <MY_SERVER_PUBLIC_IP>
PING <MY_SERVER_PUBLIC_IP> (<MY_SERVER_PUBLIC_IP>): 56 data bytes
64 bytes from <MY_SERVER_PUBLIC_IP>: icmp_seq=0 ttl=52 time=70.411 ms
64 bytes from <MY_SERVER_PUBLIC_IP>: icmp_seq=1 ttl=52 time=71.218 ms
^C--- <MY_SERVER_PUBLIC_IP> ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
I don't think it's a dns problem, here is my resolv.conf :
cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 80.67.169.12
nameserver 80.67.169.40
on the docker host and on the openvpn server host I use ufw and I've put the good settings to forward packets (I think):
in /etc/default/ufw :
DEFAULT_FORWARD_POLICY="ACCEPT"
# cat /proc/sys/net/ipv4/ip_forward
1
and on the open vpn server:
# ufw status
Status: active
To Action From
-- ------ ----
<MY_SERVER_PUBLIC_IP> <MY_OPENVPN_PORT>/udp ALLOW <MY_PUBLIC_IP>
Here is my server conf :
port <MY_OPENVPN_PORT>
proto udp
dev tun
ca keys/ca.crt
cert keys/server.crt
key keys/server.key # This file should be kept secret
dh keys/dh8192.pem
server 10.8.49.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "redirect-gateway def1 bypass-dhcp"
push "dhcp-option DNS 80.67.169.12"
push "dhcp-option DNS 80.67.169.40"
keepalive 10 120
tls-auth keys/ta.key 0 # This file is secret
cipher AES-256-CBC # AES
comp-lzo
max-clients 2
user nobody
group nogroup
persist-key
persist-tun
status openvpn-status.log
log openvpn.log
log-append openvpn.log
verb 3
mute 5
script-security 2
tun-mtu 1492
auth SHA512
What's wrong with this ? I've tried to disable ufw on both the docker host and the openvpn server but it didn’t work, either
Thanks in advance for your help.