summaryrefslogtreecommitdiff
path: root/smoketest/scripts/cli
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2026-09-29 20:39:27 +0200
committerGitHub <noreply@github.com>2026-09-29 20:39:27 +0200
commit46d5702af546ce2f1d97d4cc145292a895e620fd (patch)
tree0ccb58238faf96a9b2811f93fe82f3e01cd32e77 /smoketest/scripts/cli
parentf15b8b2eebd4afa9ece0ed8034f08f279726c854 (diff)
parent9bb198be628b3cfaa3f36c87412f5b735ef9e2e0 (diff)
downloadvyos-1x-46d5702af546ce2f1d97d4cc145292a895e620fd.tar.gz
vyos-1x-46d5702af546ce2f1d97d4cc145292a895e620fd.zip
Merge pull request #5397 from jeleel-muibi/t8999-openvpn-shared-secret-errors
openvpn: T8999: improve shared-secret reference errors
Diffstat (limited to 'smoketest/scripts/cli')
-rwxr-xr-xsmoketest/scripts/cli/test_interfaces_openvpn.py44
1 files changed, 44 insertions, 0 deletions
diff --git a/smoketest/scripts/cli/test_interfaces_openvpn.py b/smoketest/scripts/cli/test_interfaces_openvpn.py
index 672f13bcb..922695ff2 100755
--- a/smoketest/scripts/cli/test_interfaces_openvpn.py
+++ b/smoketest/scripts/cli/test_interfaces_openvpn.py
@@ -938,6 +938,50 @@ class TestInterfacesOpenVPN(VyOSUnitTestSHIM.TestCase):
interface = f'vtun{ii}'
self.assertNotIn(interface, interfaces())
+ def test_openvpn_missing_shared_secret_references(self):
+ interface = 'vtun5099'
+ path = base_path + [interface]
+ missing_key = 'NONEXISTENT'
+ pki_key_path = ['pki', 'openvpn', 'shared-secret', 'ovpn_test']
+
+ self.cli_delete(pki_key_path)
+
+ self.cli_set(path + ['mode', 'server'])
+ self.cli_set(path + ['server', 'subnet', '10.20.30.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 + ['tls', 'auth-key', missing_key])
+ with self.assertRaisesRegex(
+ ConfigSessionError,
+ rf'Invalid "tls auth-key" value "{missing_key}" on OpenVPN interface\s+{interface}',
+ ):
+ self.cli_commit()
+
+ self.cli_delete(path + ['tls', 'auth-key'])
+ self.cli_set(path + ['tls', 'crypt-key', missing_key])
+ with self.assertRaisesRegex(
+ ConfigSessionError,
+ rf'Invalid "tls crypt-key" value "{missing_key}" on OpenVPN interface\s+{interface}',
+ ):
+ self.cli_commit()
+
+ self.cli_delete(path + ['tls'])
+ self.cli_delete(path + ['server'])
+ self.cli_set(path + ['mode', 'site-to-site'])
+ self.cli_set(path + ['local-address', '10.0.0.1'])
+ self.cli_set(path + ['remote-address', '10.0.0.2'])
+ self.cli_set(path + ['encryption', 'cipher', 'aes256'])
+ self.cli_set(path + ['shared-secret-key', missing_key])
+ with self.assertRaisesRegex(
+ ConfigSessionError,
+ rf'Invalid "shared-secret-key" value "{missing_key}" on OpenVPN interface\s+{interface}',
+ ):
+ self.cli_commit()
+
+ self.cli_set(pki_key_path + ['key'], ovpn_key_data.replace('\n', ''))
+
def test_openvpn_server_ip_version(self):
# Test the server mode behavior combined with each IP protocol version