diff options
| author | Christian Breunig <christian@breunig.cc> | 2026-10-07 20:04:21 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-10-07 20:04:21 +0200 |
| commit | 58ccdee2d255f4e952322467902f7d69b4f828fa (patch) | |
| tree | 3b0a15a5241c413bad09e702ddc705bc9bf008f9 /smoketest/scripts/cli/test_interfaces_openvpn.py | |
| parent | fff4e828d2a7ec1549ca20db30906ff47396e374 (diff) | |
| parent | 8d99a2f6f81b225014d246dcf6c7bb03c641d4da (diff) | |
| download | vyos-1x-58ccdee2d255f4e952322467902f7d69b4f828fa.tar.gz vyos-1x-58ccdee2d255f4e952322467902f7d69b4f828fa.zip | |
Merge pull request #5523 from mandelbitdev/T9370-openvpn-chacha20poly1305
openvpn: T9370: add chacha20poly1305 data cipher
Diffstat (limited to 'smoketest/scripts/cli/test_interfaces_openvpn.py')
| -rwxr-xr-x | smoketest/scripts/cli/test_interfaces_openvpn.py | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/smoketest/scripts/cli/test_interfaces_openvpn.py b/smoketest/scripts/cli/test_interfaces_openvpn.py index 93c79e646..476fcbdf4 100755 --- a/smoketest/scripts/cli/test_interfaces_openvpn.py +++ b/smoketest/scripts/cli/test_interfaces_openvpn.py @@ -329,6 +329,76 @@ class TestInterfacesOpenVPN(VyOSUnitTestSHIM.TestCase): f'{self._openvpn_log(client)}', ) + def test_openvpn_dco_chacha20poly1305(self): + # ChaCha20-Poly1305 is offloaded just like AES-GCM. A peer only shows + # up in the Kernel once its key got installed, so a client and a server + # offering nothing else prove the module took that very cipher. + server = 'vtun5110' + client = 'vtun5111' + port = '1196' + + path = base_path + [server] + self.cli_set(path + ['mode', 'server']) + self.cli_set(path + ['local-port', port]) + self.cli_set(path + ['server', 'subnet', '10.98.0.0/24']) + self.cli_set(path + ['tls', 'ca-certificate', 'ovpn_test']) + self.cli_set(path + ['tls', 'certificate', 'ovpn_test']) + self.cli_set(path + ['tls', 'dh-params', 'ovpn_test']) + self.cli_set(path + ['encryption', 'data-ciphers', 'chacha20poly1305']) + self.cli_set(path + ['offload', 'dco']) + self.cli_commit() + + config = read_file(f'/run/openvpn/{server}.conf') + self.assertIn('data-ciphers CHACHA20-POLY1305', config) + self.assertDcoDataPath(server) + + path = base_path + [client] + self.cli_set(path + ['mode', 'client']) + self.cli_set(path + ['remote-host', '127.0.0.1']) + self.cli_set(path + ['remote-port', port]) + self.cli_set(path + ['tls', 'ca-certificate', 'ovpn_test']) + self.cli_set(path + ['tls', 'certificate', 'ovpn_test']) + self.cli_set(path + ['encryption', 'data-ciphers', 'chacha20poly1305']) + self.cli_set(path + ['offload', 'dco']) + self.cli_commit() + + self.assertDcoDataPath(client, multipoint=False) + self.assertGreater( + self._peers(server), + 0, + f'the Kernel holds no peer for {server}\n{self._openvpn_log(server)}', + ) + self.assertGreater( + self._peers(client), + 0, + f'the Kernel holds no peer for {client}\n{self._openvpn_log(client)}', + ) + + # and it is the cipher the two of them settled on + log = cmdl( + ['sudo', 'journalctl', '-u', f'openvpn@{client}.service', '-o', 'cat'] + ) + self.assertIn("Data Channel: cipher 'CHACHA20-POLY1305'", log) + + def test_openvpn_site2site_dco_chacha20poly1305(self): + # the fallback cipher decides the offload in site-to-site mode + interface = 'vtun5000' + path = base_path + [interface] + + self.cli_set(path + ['mode', 'site-to-site']) + self.cli_set(path + ['local-address', '10.0.0.1']) + self.cli_set(path + ['remote-address', '192.168.0.1']) + self.cli_set(path + ['tls', 'ca-certificate', 'ovpn_test']) + self.cli_set(path + ['tls', 'certificate', 'ovpn_test']) + self.cli_set(path + ['tls', 'role', 'active']) + self.cli_set(path + ['encryption', 'data-ciphers-fallback', 'chacha20poly1305']) + self.cli_set(path + ['offload', 'dco']) + self.cli_commit() + + config = read_file(f'/run/openvpn/{interface}.conf') + self.assertIn('data-ciphers-fallback CHACHA20-POLY1305', config) + self.assertDcoDataPath(interface, multipoint=False) + # OVPN_CMD_PEER_GET carries GENL_ADMIN_PERM, hence the detour through # sudo. The probe swallows its own errors so a missing interface or a # refused dump reads as "no peer" with the reason attached, instead of |
