You are not logged in.

#1 2016-04-30 15:35:16

ngc_2359
Member
Registered: 2016-04-30
Posts: 2

OpenVPN fails [CLI & networkmanager]

Hep, I'm using a commercial VPN service that provides OpenVPN connectivity by CA certificate and username/password login.

I first tried filling everything in networkmanager (Gnome 3.20) but when clicking "Add"... nothing happens, absolutely nothing. This is for OpenVPN and (huh) PPTP.

Then I tried the CLI, here is my client.conf (it supports LZO compression) :

##############################################
# Sample client-side OpenVPN 2.0 config file #
# for connecting to multi-client server.     #
#                                            #
# This configuration can be used by multiple #
# clients, however each client should have   #
# its own cert and key files.                #
#                                            #
# On Windows, you might want to rename this  #
# file so it has a .ovpn extension           #
##############################################

# Specify that we are a client and that we
# will be pulling certain config file directives
# from the server.
client

# Use the same setting as you are using on
# the server.
# On most systems, the VPN will not function
# unless you partially or fully disable
# the firewall for the TUN/TAP interface.
;dev tap
dev tun

# Windows needs the TAP-Win32 adapter name
# from the Network Connections panel
# if you have more than one.  On XP SP2,
# you may need to disable the firewall
# for the TAP adapter.
;dev-node MyTap

# Are we connecting to a TCP or
# UDP server?  Use the same setting as
# on the server.
;proto tcp
proto udp

# The hostname/IP and port of the server.
# You can have multiple remote entries
# to load balance between the servers.
remote fr1.vpn.goldenfrog.com 1194
;remote my-server-2 1194

# Choose a random host from the remote
# list for load-balancing.  Otherwise
# try hosts in the order specified.
;remote-random

# Keep trying indefinitely to resolve the
# host name of the OpenVPN server.  Very useful
# on machines which are not permanently connected
# to the internet such as laptops.
resolv-retry infinite

# Most clients don't need to bind to
# a specific local port number.
nobind

# Downgrade privileges after initialization (non-Windows only)
user nobody
group nobody

# Try to preserve some state across restarts.
persist-key
persist-tun

# If you are connecting through an
# HTTP proxy to reach the actual OpenVPN
# server, put the proxy server/IP and
# port number here.  See the man page
# if your proxy server requires
# authentication.
;http-proxy-retry # retry on connection failures
;http-proxy [proxy server] [proxy port #]

# Wireless networks often produce a lot
# of duplicate packets.  Set this flag
# to silence duplicate packet warnings.
;mute-replay-warnings

# SSL/TLS parms.
# See the server config file for more
# description.  It's best to use
# a separate .crt/.key file pair
# for each client.  A single ca
# file can be used for all clients.
ca /etc/openvpn/ca.vyprvpn.com.crt
;cert client.crt
;key client.key
auth-user-pass

# Verify server certificate by checking that the
# certicate has the correct key usage set.
# This is an important precaution to protect against
# a potential attack discussed here:
#  [url]http://openvpn.net/howto.html#mitm[/url]
#
# To use this feature, you will need to generate
# your server certificates with the keyUsage set to
#   digitalSignature, keyEncipherment
# and the extendedKeyUsage to
#   serverAuth
# EasyRSA can do this for you.
ns-cert-type server
;remote-cert-tls server

# If a tls-auth key is used on the server
# then every client must also have the key.
;tls-auth ta.key 1

# Select a cryptographic cipher.
# If the cipher option is used on the server
# then you must also specify it here.
;cipher x

# Enable compression on the VPN link.
# Don't enable this unless it is also
# enabled in the server config file.
comp-lzo

# Set log file verbosity.
verb 3

# Silence repeating messages
;mute 20

Connection to the VPN works fine but everytime and with all of the available servers it crashes and OpenVPN is unable to reconnect :

Sat Apr 30 16:36:01 2016 Authenticate/Decrypt packet error: bad packet ID (may be a replay): [ #292635 ] -- see the man page entry for --no-replay and --replay-window for more info or silence this warning with --mute-replay-warnings
Sat Apr 30 16:36:01 2016 Authenticate/Decrypt packet error: bad packet ID (may be a replay): [ #292636 ] -- see the man page entry for --no-replay and --replay-window for more info or silence this warning with --mute-replay-warnings

Is OpenVPN that unstable ? networkmanager doesn't work at all with Arch Linux ?

Last edited by ngc_2359 (2016-04-30 17:47:55)

Offline

#2 2016-05-01 08:13:49

ngc_2359
Member
Registered: 2016-04-30
Posts: 2

Re: OpenVPN fails [CLI & networkmanager]

Ok so I investigated a little more and found out it was due to "Inactivity timeout".

The OpenVPN server pushes those options :

 Sun May  1 09:56:19 2016 PUSH: Received control message: 'PUSH_REPLY,redirect-gateway def1 bypass-dhcp,dhcp-option DNS 10.2.37.1,explicit-exit-notify 5,rcvbuf 262144,route-gateway 10.2.37.1,topology subnet,ping 10,ping-restart 60,ifconfig 10.2.37.127 255.255.255.0'

Here is my condensed version of client.conf :

client
dev tun
redirect-gateway def1
proto udp
remote fr1.vpn.goldenfrog.com 1194
remote ch1.vpn.goldenfrog.com 1194
ca /etc/openvpn/ca.vyprvpn.com.crt
auth-user-pass
ns-cert-type server
remote-random
resolv-retry infinite
user nobody
group nobody
persist-key
persist-tun
keepalive 5 120
comp-lzo
verb 3

Of course I allowed forwarding for tun0 in iptables. I've explicitely routed all the traffic to the server with 'redirect-gateway def1' but the connection still timed out sometimes. I ran Wireshark and found that the OpenVPN server was forcing to use a 'keepalive 10 60'. I have a shitty wifi internet connection so it is possible that sometimes packets are dropped. Is there a way to force sending ping more often without being overwritten by the server's push options ?

Last edited by ngc_2359 (2016-05-01 08:21:48)

Offline

Board footer

Powered by FluxBB