OpenVPN templates: drop windows-driver, tls-client, client user/group

windows-driver was removed in OpenVPN 2.7 and broke clients; add
explicit-exit-notify for UDP clients, tidy the server template.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
ayurishchevandClaude Sonnet 5.5 committed 2026-10-07 09:38:09 +03:00
1 parent 7d6f44c965
commit d29c261347
5 files changed
+81 -14

No files matched your search

+3 -9
View File
@@ -1,25 +1,19 @@
client
dev tun
windows-driver wintun
proto {{ protocol }}
remote {{ remote_ip }} {{ port }}
resolv-retry infinite
nobind
{% if protocol == 'udp' %}
explicit-exit-notify
{% endif %}
{% if tun_mtu %}
tun-mtu {{ tun_mtu }}
{% endif %}
user nobody
group nobody
persist-key
persist-tun
{% if protocol == 'tcp' %}
tls-client
{% else %}
#tls-client
{% endif %}
mute-replay-warnings
remote-cert-tls server
+1 -5
View File
@@ -1,9 +1,6 @@
dev tun
proto {{ protocol }}
{% if protocol == 'tcp' %}
tls-server
{% else %}
# explicit-exit-notify 1
{% if protocol != 'tcp' %}
explicit-exit-notify 1
{% endif %}
port {{ port }}
@@ -28,7 +25,6 @@ server {{ vpn_network }} {{ vpn_netmask }}
ifconfig-pool-persist /etc/openvpn/ipp.txt
log /var/log/openvpn/openvpn.log
log-append /var/log/openvpn/openvpn.log
verb 3
+17
View File
@@ -0,0 +1,17 @@
"""One test for the client profile template (templates/client.ovpn.j2), tcp and udp."""
import pytest
from services.generator import env
@pytest.mark.parametrize("protocol", ["tcp", "udp"])
def test_client_template(protocol):
text = env.get_template("client.ovpn.j2").render(
protocol=protocol, remote_ip="203.0.113.1", port=1194, ca_cert="CA",
client_cert="CERT", client_key="KEY", tls_auth="TA", tun_mtu=None)
lines = [x.strip() for x in text.splitlines()]
assert f"proto {protocol}" in lines and "client" in lines
# directives that OpenVPN 2.7 rejects or that are redundant/harmful on user devices
for gone in ("windows-driver", "tls-client", "#tls-client", "user", "group"):
assert not any(x.split(" ")[0] == gone for x in lines)
assert ("explicit-exit-notify" in lines) == (protocol == "udp")