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

+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")