From 432fa1807de6f71c76cbcada4d295b4773ca59ab Mon Sep 17 00:00:00 2001 From: Nataliia Solomko Date: Mon, 2 Nov 2026 19:01:34 +0200 Subject: openvpn: T9560: Render tls-auth in site-to-site mode In site-to-site mode "tls auth-key" was accepted but never used. The key direction is now taken from "tls role": active uses 1, passive uses 0. A raw "openvpn-option --tls-auth" in site-to-site mode, the only way to use the key until now, is left as it is: no tls-auth is rendered next to it, so existing tunnels keep working. --- src/conf_mode/interfaces_openvpn.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/conf_mode/interfaces_openvpn.py b/src/conf_mode/interfaces_openvpn.py index 276e4972a..2666f7601 100755 --- a/src/conf_mode/interfaces_openvpn.py +++ b/src/conf_mode/interfaces_openvpn.py @@ -249,6 +249,15 @@ def get_config(config=None): ): openvpn['tun_mtu'] = dco_default_mtu + # Before tls-auth was rendered in site-to-site mode, a raw option was the + # only way to use the key. Left without a direction it is bidirectional, + # but OpenVPN keeps a direction rendered ahead of it - so render none. + if openvpn.get('mode') == 'site-to-site': + for option in dict_search('openvpn_option', openvpn) or []: + tmp = option.split() + if tmp and tmp[0].lstrip('-') == 'tls-auth': + openvpn['raw_tls_auth'] = True + # Check vrf membership, to ensure firewall is updated if is_vrf_changed(conf, ifname): set_dependents('firewall', conf) @@ -449,7 +458,7 @@ def verify_pki(openvpn): if not verify_ca_chain(sorted_chain, pki['ca']): raise ConfigError(f'CA certificates are not a valid chain') - if mode != 'client' and 'auth_key' not in tls: + if mode != 'client': if 'certificate' not in tls: raise ConfigError(f'Missing "tls certificate" on openvpn interface {interface}') -- cgit v1.2.3