diff options
| author | Nataliia Solomko <natalirs1985@gmail.com> | 2026-11-02 19:01:34 +0200 |
|---|---|---|
| committer | Nataliia Solomko <natalirs1985@gmail.com> | 2026-11-02 19:35:52 +0200 |
| commit | 432fa1807de6f71c76cbcada4d295b4773ca59ab (patch) | |
| tree | 962788a556b6a47e457b1211f8948cd1f10a09e1 /src | |
| parent | ded66339096464636f4c5910c010c637184d1a3e (diff) | |
| download | vyos-1x-432fa1807de6f71c76cbcada4d295b4773ca59ab.tar.gz vyos-1x-432fa1807de6f71c76cbcada4d295b4773ca59ab.zip | |
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.
Diffstat (limited to 'src')
| -rwxr-xr-x | src/conf_mode/interfaces_openvpn.py | 11 |
1 files changed, 10 insertions, 1 deletions
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}') |
