OpenVPN was used inside Docker containers running Debian stable for a long time.
At some point, there was an attempt to upgrade the Debian versions running inside the containers.
The version used before:
Debian 10 Buster -> openvpn (2.4.7-1+deb10u1) ->
https://packages.debian.org/buster/openvpn
The version after the upgrade:
Debian 11 Bullseye -> openvpn (2.5.1-3) ->
https://packages.debian.org/bullseye/openvpn
After upgrading, OpenVPN started to break OS routes on installation.
Example of working routes, how they were at
openvpn (2.4.7-1+deb10u1)
and should be:
default via 10.35.0.1 dev eth0
10.35.0.0/24 dev eth0 proto kernel scope link src 10.35.0.195
10.35.0.0/16 via 10.35.0.1 dev eth0
10.190.0.0/16 via 10.190.0.12 dev tun0
Example of broken routes, how they are at
openvpn (2.5.1-3)
and should
not be:
default via 10.35.0.1 dev eth0
10.35.0.0/24 via 10.190.0.12 dev tun0
10.35.0.0/16 via 10.35.0.1 dev eth0
10.190.0.0/16 via 10.190.0.12 dev tun0
I installed an even newer 2.5.x version and the issue was still not solved.
I am out of ideas why this might happen. It worked great before and now it is broken for several 2.5.x versions.
Neither was I able to find any relevant change regarding this functionality in the list of commits, provided as some kind of changelog.
The only commit that was related to gateway routing semed not to be relevant, as the behaviour did not change when changing to versions that did not incorporate that commit.
server 10.190.0.0 255.255.0.0
verb 3
client-to-client
crl-verify /path/to/pki/crl.pem
key /path/to/pki/private/server.key
ca /path/to/pki/ca.crt
cert /path/to/pki/issued/server.crt
dh /path/to/pki/dh.pem
tls-auth /path/to/pki/ta.key 0
cipher AES-256-GCM
key-direction 0
keepalive 10 60
persist-key
persist-tun
proto tcp
port 4443
dev tun0
status /var/log/openvpn-status.log
user nobody
group nogroup
client-config-dir /path/to/config/ccd
push "route 10.35.0.0 255.255.255.0"
push "dhcp-option DOMAIN-SEARCH debian-11-openvpn-1.svc.cluster.local"
push "dhcp-option DOMAIN-SEARCH svc.cluster.local"
push "dhcp-option DOMAIN-SEARCH cluster.local"
push "dhcp-option DOMAIN-SEARCH invalid"
push "dhcp-option DNS 10.36.0.10"
One of the many clients' config:
nobind
dev tun
remote openvpn 4443 tcp
cipher AES-256-GCM
<key>
# Private Key
</key>
<cert>
# Certificate
</cert>
<ca>
# CA Certificate
</ca>
<tls-auth>
# Static Key
</tls-auth>
key-direction 1
CCD config for this particular client:
ifconfig-push 10.190.0.12 10.190.0.12
The purpose of this CCD config is to apply a static IP to that particular client.
Client log is unavailable and server log does not show anything beyond normal behaviour. The issue arises 100% client-side. The server does not even use Debian, in the first place.
Server OpenVPN version information:
OpenVPN 2.4.8 x86_64-alpine-linux-musl [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [MH/PKTINFO] [AEAD] built on Feb 7 2020
library versions: OpenSSL 1.1.1d 10 Sep 2019, LZO 2.10
Originally developed by James Yonan
Copyright (C) 2002-2018 OpenVPN Inc <sales@openvpn.net>
Compile time defines: enable_async_push='no' enable_comp_stub='no' enable_crypto='yes' enable_crypto_ofb_cfb='yes' enable_debug='yes' enable_def_auth='yes' enable_dlopen='unknown' enable_dlopen_self='unknown' enable_dlopen_self_static='unknown' enable_fast_install='yes' enable_fragment='yes' enable_iproute2='yes' enable_libtool_lock='yes' enable_lz4='yes' enable_lzo='yes' enable_management='yes' enable_multihome='yes' enable_pam_dlopen='no' enable_pedantic='no' enable_pf='yes' enable_pkcs11='no' enable_plugin_auth_pam='yes' enable_plugin_down_root='yes' enable_plugins='yes' enable_port_share='yes' enable_selinux='no' enable_server='yes' enable_shared='yes' enable_shared_with_static_runtimes='no' enable_small='no' enable_static='yes' enable_strict='no' enable_strict_options='no' enable_systemd='no' enable_werror='no' enable_win32_dll='yes' enable_x509_alt_username='no' with_aix_soname='aix' with_crypto_library='openssl' with_gnu_ld='yes' with_mem_check='no' with_sysroot='no'