OpenVPN seems connected but can't access normally accessible websites

I followed this tutorial : OpenVPN - Fedora Project Wiki

Then I followed this tutorial : Fedora 30 Connect to OpenVPN · GitHub

This is the conf file :

#Template client.ovpnclient
dev tun
tls-client
proto tcp-client
port 1194
remote vpn1.domain.fr
remote vpn2.domain.fr
client
nobind
persist-key
persist-tun

remote-cert-tls server
ca cert_export_CA-CDS.crt

cipher AES-128-CBC

auth MD5

auth-user-pass login.conf
auth-nocache


route 10.30.0.0 255.255.255.0

dhcp-option DNS 10.44.3.254

redirect-gateway def1
push "redirect-gateway def1"

The systemd service gives this error :

● openvpn.service - OpenVPN tunnel for
     Loaded: loaded (/usr/lib/systemd/system/openvpn.service; disabled; preset: disabled)
    Drop-In: /usr/lib/systemd/system/service.d
             └─10-timeout-abort.conf
     Active: active (running) since Sat 2023-04-29 23:20:44 CEST; 30min ago
       Docs: man:openvpn(8)
             https://community.openvpn.net/openvpn/wiki/Openvpn24ManPage
             https://community.openvpn.net/openvpn/wiki/HOWTO
   Main PID: 20040 (openvpn)
     Status: "Pre-connection initialization successful"
      Tasks: 1 (limit: 9334)
     Memory: 1.9M
        CPU: 301ms
     CGroup: /system.slice/openvpn.service
             └─20040 /usr/sbin/openvpn --suppress-timestamps --nobind --config vpn-intranet.ovpn

avril 29 23:43:05 cyprien-lenovo-yoga openvpn[20040]: TCPv4_CLIENT link remote: [AF_INET]81.255.194.33:1194
avril 29 23:43:06 cyprien-lenovo-yoga openvpn[20040]: Connection reset, restarting [0]
avril 29 23:43:06 cyprien-lenovo-yoga openvpn[20040]: SIGUSR1[soft,connection-reset] received, process restarting
avril 29 23:48:06 cyprien-lenovo-yoga openvpn[20040]: TCP/UDP: Preserving recently used remote address: [AF_INET]84.239.73.91:1194
avril 29 23:48:06 cyprien-lenovo-yoga openvpn[20040]: Attempting to establish TCP connection with [AF_INET]84.239.73.91:1194
avril 29 23:48:06 cyprien-lenovo-yoga openvpn[20040]: TCP connection established with [AF_INET]84.239.73.91:1194
avril 29 23:48:06 cyprien-lenovo-yoga openvpn[20040]: TCPv4_CLIENT link local: (not bound)
avril 29 23:48:06 cyprien-lenovo-yoga openvpn[20040]: TCPv4_CLIENT link remote: [AF_INET]84.239.73.91:1194
avril 29 23:48:06 cyprien-lenovo-yoga openvpn[20040]: Connection reset, restarting [0]
avril 29 23:48:06 cyprien-lenovo-yoga openvpn[20040]: SIGUSR1[soft,connection-reset] received, process restarting

I tried with NetworkManager-openvpn, it keeps asking for a password without an error message

I can’t say if the the vpn is connected or not given the output logs.

What I see is that I can’t access the website normally accessible with the vpn.

There is a SELinux popup appearing sometimes and I did what is preconised :

# ausearch -c "openvpn" --raw | audit2allow -M my-openvpn
# semodule -X 300 -i my-openvpn.pp

It is unclear to me which part of this tutorial you may have followed.

This tutorial is very outdated and should not be followed. It has you editing a system file to insert the path to a custom configuration file. I would instead recommend using the intended mechanism of systemd unit parameterization.
OpenVPN on Fedora has an parameterized unit file for openvpn-client. To use it with an instance name of vpn-intranet you would place your OpenVPN configuration in /etc/openvpn/client/vpn-intranet.conf. Then you can start the service using systemctl start openvpn-client@vpn-intranet.

It also has you write stuff into /etc/resolv.conf. On a default Fedora installation this file is managed by systemd-resolved and will likely get overwritten every time you connect to a different network through NetworkManager.

Also, the log you provided doesn’t have enough information to see if there is an error or what the error may be.

You might want to check the full log using journalctl -u openvpn.
If you suspect a SELinux error ensure that both the config file as well as the certificate files are appropriately labelled such that OpenVPN is allowed to read them. The second tutorial actually includes that step.

If NetworkManager-openvpn is failing you can check journalctl -u NetworkManager. If you want to follow the log live as you connect you can use journalctl -u NetworkManager -f.

I’m guessing your issue is either a mismatch of settings between server and client or the use of outdated cryptographic ciphers/digests, such as AES-128-CBC and MD5.

It is unclear to me which part of this tutorial you followed

I followed these steps :

iptables -A INPUT -i eth1 -p udp --dport 1194 -j ACCEPT
iptables -A INPUT -i tun+ -j ACCEPT
iptables -A FORWARD -i tun+ -j ACCEPT
iptables -A FORWARD -i eth0 -o tun+ -j ACCEPT
iptables -A FORWARD -i eth1 -o tun+ -m state --state ESTABLISHED,RELATED -j ACCEPT

And

The default ‘openvpn’ service references udp port 1194
firewall-cmd --add-service=openvpn
Add the network interface to the default zone (e.g. “FedoraServer” for Fedora Server)
firewall-cmd --add-interface=tun0 --permanent
Allow intra-zone forwarding for the default zone
firewall-cmd --add-forward --permanent
Allow masquerading (Network address translation - NAT) for the default zone
firewall-cmd --add-masquerade --permanent
Reload FirewallD to check the bootup behaviour
firewall-cmd --reload
Show the complete current config
firewall-cmd --list-

Then the client configuration :

https://fedoraproject.org/wiki/OpenVPN#Setting_up_a_Linux_OpenVPN_client

This tutorial is very outdated and should not be followed.

Yes, I should not have followed this guide.

I’ll check the logs later.

I’m guessing your issue is either a mismatch of settings between server and client or the use of outdated cryptographic ciphers/digests, such as AES-128-CBC and MD5.

It’s an option. There has been several changes made to the vpn conf and I doubt this is the latest one.

I checked the logs, this is what I found :

avril 30 18:02:40 cyprien-lenovo-yoga nm-openvpn[9138]: DEPRECATED OPTION: --cipher set to 'AES-128-CBC' but missing in --data-ciphers (AES-256-GCM:AES-128-GCM). Future OpenVPN version will ignore --cipher for cipher negotiations. Add 'AES-128-CBC' to --data-ciphers or change --cipher 'AES-128-CBC' to --data-ciphers-fallback 'AES-128-CBC' to silence this warning.
avril 30 18:02:40 cyprien-lenovo-yoga nm-openvpn[9138]: OpenVPN 2.5.9 x86_64-redhat-linux-gnu [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [PKCS11] [MH/PKTINFO] [AEAD] built on Feb 16 2023
avril 30 18:02:40 cyprien-lenovo-yoga nm-openvpn[9138]: library versions: OpenSSL 3.0.8 7 Feb 2023, LZO 2.10
avril 30 18:02:40 cyprien-lenovo-yoga nm-openvpn[9138]: NOTE: the current --script-security setting may allow this configuration to call user-defined scripts
avril 30 18:02:40 cyprien-lenovo-yoga nm-openvpn[9138]: TCP/UDP: Preserving recently used remote address: [AF_INET]81.255.194.33:1194
avril 30 18:02:40 cyprien-lenovo-yoga nm-openvpn[9138]: Attempting to establish TCP connection with [AF_INET]81.255.194.33:1194 [nonblock]
avril 30 18:02:40 cyprien-lenovo-yoga nm-openvpn[9138]: TCP connection established with [AF_INET]81.255.194.33:1194
avril 30 18:02:40 cyprien-lenovo-yoga nm-openvpn[9138]: TCP_CLIENT link local: (not bound)
avril 30 18:02:40 cyprien-lenovo-yoga nm-openvpn[9138]: TCP_CLIENT link remote: [AF_INET]81.255.194.33:1194
avril 30 18:02:40 cyprien-lenovo-yoga nm-openvpn[9138]: NOTE: UID/GID downgrade will be delayed because of --client, --pull, or --up-delay
avril 30 18:02:41 cyprien-lenovo-yoga nm-openvpn[9138]: [OVPN-SERVER] Peer Connection Initiated with [AF_INET]81.255.194.33:1194
avril 30 18:02:53 cyprien-lenovo-yoga nm-openvpn[9138]: AUTH: Received control message: AUTH_FAILED, user ctaque authentication failed
avril 30 18:02:53 cyprien-lenovo-yoga nm-openvpn[9138]: SIGUSR1[soft,auth-failure] received, process restarting

AUTH_FAILED, user ctaque authentication failed

So I guess it’s a credentials mistake ?

AUTH_FAILED: that indeed looks like credentials. Are you using a commercial/business server or are you trying to setup your own VPN? login.conf should contain two lines with username and password, but on the server there should be a script for verification active. There is an auth-pam.pl script example as starting point. No idea whether this “auth MD5” makes sense or causes problems.

Further: there is “redirect-gateway def1” which routes all traffic through the VPN. But It is a bit remarkable that a client tells the server to change it routes with push “redirect-gateway def1”.
But it is in the tutorial.

Do you not need to have, apart from the ca certificate, a client certificate and key?

The iptables and firewall-cmd stuff is a bit double, firewall-cmd is the modern one, but be sure that tun0 is assigned to the same zone as the zone you want to forward to.

A nasty thing is /proc/sys/net/ipv4/ip_forward. Should be one, otherwise there is no forwarding at all. Probably firewall-cmd masquerade takes care of it, but please check. Notethat this whole stuff is only necessary if you want to route your LAN over the VPN, but it IS necessary on the VPN server if you want to access internet from clients via the VPN.