My OpenVPN version is 2.4.11 under CentOS 8.
I am having trouble to finger out the error.
I myself can login and use the server without any error. I don't lose my connection.
However, my oversea brother can login, but after just a few while, his connection is lost with error. He didn't have this problem before.
I restart the OpenVPN, reboot the server. It doesn't fix the error. My brother also uninstall OpenVPN Connect from his iPhone and reinstall it, re-import client.ovpn. The error continues.
Because it is iPhone, update-resolv.sh probably never runs because it only allows importing client.ovpn, even though it is in the client.ovpn.
It used to work nicely for both of us.
Please help.
Many thanks.
Below is my server.conf
## GENERAL ##
# TCP or UDP, port 1194, tunneling
mode server
proto udp
port 1194
dev tun
## KEY, CERTS AND NETWORK CONFIGURATION ##
# Identity
ca ca.crt
# Public key
cert server.crt
# Private key
key server.key
# Symmetric encryption
dh dh.pem
# Improve security (DDOS, port flooding...)
# 0 for the server, 1 for the client
tls-auth ta.key 0
# Encryption protocol
cipher AES-256-CBC
# Network
# Subnetwork, the server will be the 10.8.0.1 and clients will take the other ips
server 10.8.0.0 255.255.255.0
# Redirect all IP network traffic originating on client machines to pass through the OpenVPN server
push "redirect-gateway def1"
# Alternatives DNS (FDN)
push "dhcp-option DNS 80.67.169.12"
push "dhcp-option DNS 80.67.169.40"
# (OpenDNS)
# push "dhcp-option DNS 208.67.222.222"
# push "dhcp-option DNS 208.67.220.220"
# (Google)
# push "dhcp-option DNS 8.8.8.8"
# push "dhcp-option DNS 8.8.4.4"
# Ping every 10 seconds and if after 120 seconds the client doesn't respond we disconnect
keepalive 10 120
# Regenerate key each 5 hours (disconnect the client)
reneg-sec 18000
## SECURITY ##
# Downgrade privileges of the daemon
user nobody
group nobody
# Persist keys (because we are nobody, so we couldn't read them again)
persist-key
# Don't close and re open TUN/TAP device
persist-tun
# Enable compression
comp-lzo
## LOG ##
# Verbosity
# 3/4 for a normal utilisation
verb 3
# Max 20 messages of the same category
mute 20
# Log gile where we put the clients status
status openvpn-status.log
# Log file
log-append /var/log/openvpn.log
# Configuration directory of the clients
client-config-dir ccd
## PASS ##
# Allow running external scripts with password in ENV variables
script-security 3
# Use the authenticated username as the common name, rather than the common name from the client cert
username-as-common-name
# Client certificate is not required
verify-client-cert none
# Use the connection script when a user wants to login
# auth-user-pass-verify scripts/login.sh via-env
auth-user-pass-verify "/usr/bin/php /home/www/domains/l3vpn3/openvpn/scripts/login.php" via-env
# Maximum of clients
max-clients 50
# Run this scripts when the client connects/disconnects
# client-connect scripts/connect.sh
# client-disconnect scripts/disconnect.sh
client-connect "/usr/bin/php /home/www/domains/l3vpn3/openvpn/scripts/connect.php"
client-disconnect "/usr/bin/php /home/www/domains/l3vpn3/openvpn/scripts/disconnect.php"
# Notify the client that when the server restarts so it
# can automatically reconnect.
explicit-exit-notify 1
Below is my client.ovpn
client
dev tun
proto udp
remote xxx.xxx.xxx.xx 1194
resolv-retry infinite
cipher AES-256-CBC
redirect-gateway
# Keys
# Identity
key-direction 1
remote-cert-tls server
auth-user-pass
auth-nocache
# Security
nobind
persist-key
persist-tun
comp-lzo
verb 3
# DNS
script-security 2
up ./update-resolv.sh
down ./update-resolv.sh
# Proxy ?
# http-proxy cache.univ.fr 3128
<ca>
-----BEGIN CERTIFICATE-----
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-----END CERTIFICATE-----
</ca>
<tls-auth>
#
# 2048 bit OpenVPN static key
#
-----BEGIN OpenVPN Static key V1-----
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-----END OpenVPN Static key V1-----
</tls-auth>
Below is the log output
Code: Select all
59.61.122.206:52784 TLS: Username/Password authentication succeeded for username 'roger' [CN SET]
59.61.122.206:52784 Control Channel: TLSv1.3, cipher TLSv1.3 TLS_AES_256_GCM_SHA384
59.61.122.206:52784 [roger] Peer Connection Initiated with [AF_INET]59.61.122.206:52784
roger/59.61.122.206:52784 MULTI_sva: pool returned IPv4=10.8.0.10, IPv6=(Not enabled)
roger/59.61.122.206:52784 OPTIONS IMPORT: reading client specific options from: /tmp/openvpn_cc_cae5c04d9f0bf82ff76e72233ec44a.tmp
roger/59.61.122.206:52784 MULTI: Learn: 10.8.0.10 -> roger/59.61.122.206:52784
roger/59.61.122.206:52784 MULTI: primary virtual IP for roger/59.61.122.206:52784: 10.8.0.10
roger/59.61.122.206:52784 PUSH: Received control message: 'PUSH_REQUEST'
roger/59.61.122.206:52784 SENT CONTROL [roger]: 'PUSH_REPLY,redirect-gateway def1,dhcp-option DNS 80.67.169.12,dhcp-option DNS 80.67.169.40,route 10.8.0.1,topology net30,ping 10,ping-restart 120,ifconfig 10.8.0.10 10.8.0.9,peer-id 3,cipher AES-256-GCM' (status=1)
roger/59.61.122.206:52784 Data Channel: using negotiated cipher 'AES-256-GCM'
roger/59.61.122.206:52784 Outgoing Data Channel: Cipher 'AES-256-GCM' initialized with 256 bit key
roger/59.61.122.206:52784 Incoming Data Channel: Cipher 'AES-256-GCM' initialized with 256 bit key
roger/59.61.122.206:52784 SIGTERM[soft,remote-exit] received, client-instance exiting
59.61.122.206:56200 TLS: Initial packet from [AF_INET]59.61.122.206:56200, sid=02a86c5e 17e80491
59.61.122.206:56200 Authenticate/Decrypt packet error: bad packet ID (may be a replay): [ #1 / time = (1626149586) Mon Jul 12 23:13:06 2021 ] -- see the man page entry for --no-replay and --replay-window for more info or silence this warning with --mute-replay-warnings
59.61.122.206:56200 TLS Error: incoming packet authentication failed from [AF_INET]59.61.122.206:56200
59.61.122.206:56200 Authenticate/Decrypt packet error: bad packet ID (may be a replay): [ #1 / time = (1626149586) Mon Jul 12 23:13:06 2021 ] -- see the man page entry for --no-replay and --replay-window for more info or silence this warning with --mute-replay-warnings
59.61.122.206:56200 TLS Error: incoming packet authentication failed from [AF_INET]59.61.122.206:56200
59.61.122.206:56200 Authenticate/Decrypt packet error: bad packet ID (may be a replay): [ #1 / time = (1626149586) Mon Jul 12 23:13:06 2021 ] -- see the man page entry for --no-replay and --replay-window for more info or silence this warning with --mute-replay-warnings
59.61.122.206:56200 TLS Error: incoming packet authentication failed from [AF_INET]59.61.122.206:56200
59.61.122.206:56200 Authenticate/Decrypt packet error: bad packet ID (may be a replay): [ #1 / time = (1626149586) Mon Jul 12 23:13:06 2021 ] -- see the man page entry for --no-replay and --replay-window for more info or silence this warning with --mute-replay-warnings
59.61.122.206:56200 TLS Error: incoming packet authentication failed from [AF_INET]59.61.122.206:56200
59.61.122.206:56200 Authenticate/Decrypt packet error: bad packet ID (may be a replay): [ #1 / time = (1626149586) Mon Jul 12 23:13:06 2021 ] -- see the man page entry for --no-replay and --replay-window for more info or silence this warning with --mute-replay-warnings
59.61.122.206:56200 TLS Error: incoming packet authentication failed from [AF_INET]59.61.122.206:56200
59.61.122.206:56200 Authenticate/Decrypt packet error: bad packet ID (may be a replay): [ #1 / time = (1626149586) Mon Jul 12 23:13:06 2021 ] -- see the man page entry for --no-replay and --replay-window for more info or silence this warning with --mute-replay-warnings
59.61.122.206:56200 TLS Error: incoming packet authentication failed from [AF_INET]59.61.122.206:56200
59.61.122.206:49501 TLS Error: TLS key negotiation failed to occur within 60 seconds (check your network connectivity)
59.61.122.206:49501 TLS Error: TLS handshake failed