summaryrefslogtreecommitdiff
path: root/smoketest/scripts/cli
diff options
context:
space:
mode:
authorOleksandr Kuchmystyi <o.kuchmystyi@vyos.io>2025-07-15 12:31:07 +0300
committerOleksandr Kuchmystyi <o.kuchmystyi@vyos.io>2025-07-28 13:23:13 +0300
commitcdb97173c8ba251c577e30bb324555a418c32828 (patch)
tree2e7097915bea996714fcf30e9f72faf903d7b38f /smoketest/scripts/cli
parentfc5ea5bdf1a1fb0092d2f4847b100b29f1ac25a4 (diff)
downloadvyos-1x-cdb97173c8ba251c577e30bb324555a418c32828.tar.gz
vyos-1x-cdb97173c8ba251c577e30bb324555a418c32828.zip
ipsec: T7593: Add dynamic prefix for local and remote traffic selectors
In case when there is no local/remote prefix configured in a tunnel settings, a protocol configured for such tunnel is ignored. The correct way to generate the configuration is to set the prefix to `dynamic` if it was not set. The correct config for the described case is: ``` local_ts = dynamic[gre/] remote_ts = dynamic[gre/] ```
Diffstat (limited to 'smoketest/scripts/cli')
-rwxr-xr-xsmoketest/scripts/cli/test_vpn_ipsec.py62
1 files changed, 62 insertions, 0 deletions
diff --git a/smoketest/scripts/cli/test_vpn_ipsec.py b/smoketest/scripts/cli/test_vpn_ipsec.py
index 830e58fe8..7f52db74e 100755
--- a/smoketest/scripts/cli/test_vpn_ipsec.py
+++ b/smoketest/scripts/cli/test_vpn_ipsec.py
@@ -347,6 +347,68 @@ class TestVPNIPsec(VyOSUnitTestSHIM.TestCase):
for line in swanctl_conf_lines:
self.assertIn(line, swanctl_conf)
+ def test_site_to_site_with_default_ts(self):
+ """Test 'site to site' with default value of local and remote Traffic Selection"""
+
+ self.cli_set(base_path + ['ike-group', ike_group, 'key-exchange', 'ikev2'])
+
+ local_address = '192.0.2.11'
+ life_bytes = '100000'
+ life_packets = '2000000'
+
+ # vpn ipsec auth psk <tag> id <x.x.x.x>
+ self.cli_set(
+ base_path + ['authentication', 'psk', connection_name, 'id', local_id]
+ )
+ self.cli_set(
+ base_path + ['authentication', 'psk', connection_name, 'id', remote_id]
+ )
+ self.cli_set(
+ base_path + ['authentication', 'psk', connection_name, 'id', local_address]
+ )
+ self.cli_set(
+ base_path + ['authentication', 'psk', connection_name, 'id', peer_ip]
+ )
+ self.cli_set(
+ base_path + ['authentication', 'psk', connection_name, 'secret', secret]
+ )
+
+ # Site to site
+ peer_base_path = base_path + ['site-to-site', 'peer', connection_name]
+
+ self.cli_set(base_path + ['esp-group', esp_group, 'life-bytes', life_bytes])
+ self.cli_set(base_path + ['esp-group', esp_group, 'life-packets', life_packets])
+
+ self.cli_set(peer_base_path + ['authentication', 'mode', 'pre-shared-secret'])
+ self.cli_set(peer_base_path + ['ike-group', ike_group])
+ self.cli_set(peer_base_path + ['default-esp-group', esp_group])
+ self.cli_set(peer_base_path + ['local-address', local_address])
+ self.cli_set(peer_base_path + ['remote-address', peer_ip])
+ self.cli_set(peer_base_path + ['tunnel', '1', 'protocol', 'gre'])
+
+ self.cli_commit()
+
+ # Verify strongSwan configuration
+ swanctl_conf = read_file(swanctl_file)
+ swanctl_conf_lines = [
+ f'version = 2',
+ f'auth = psk',
+ f'life_bytes = {life_bytes}',
+ f'life_packets = {life_packets}',
+ f'rekey_time = 28800s', # default value
+ f'proposals = aes128-sha1-modp1024',
+ f'esp_proposals = aes128-sha1-modp1024',
+ f'life_time = 3600s', # default value
+ f'local_addrs = {local_address} # dhcp:no',
+ f'remote_addrs = {peer_ip}',
+ f'mode = tunnel',
+ f'{connection_name}-tunnel-1',
+ f'local_ts = dynamic[gre/]', # default value
+ f'remote_ts = dynamic[gre/]', # default value
+ f'mode = tunnel',
+ ]
+ for line in swanctl_conf_lines:
+ self.assertIn(line, swanctl_conf)
def test_site_to_site_vti(self):
local_address = '192.0.2.10'