19
19
from base_accel_ppp_test import BasicAccelPPPTest
20
20
from configparser import ConfigParser
21
21
from vyos .utils .process import cmd
22
+ from vyos .utils .file import read_file
23
+
24
+
25
+ swanctl_file = '/etc/swanctl/swanctl.conf'
22
26
23
27
24
28
class TestVPNL2TPServer (BasicAccelPPPTest .TestCase ):
@@ -57,11 +61,16 @@ def test_l2tp_server_authentication_protocols(self):
57
61
def test_vpn_l2tp_dependence_ipsec_swanctl (self ):
58
62
# Test config vpn for tasks T3843 and T5926
59
63
64
+ outside_address = '203.0.113.1'
65
+
60
66
base_path = ['vpn' , 'l2tp' , 'remote-access' ]
61
67
# make precondition
62
68
self .cli_set (['interfaces' , 'dummy' , 'dum0' , 'address' , '203.0.113.1/32' ])
63
69
self .cli_set (['vpn' , 'ipsec' , 'interface' , 'dum0' ])
64
70
71
+ # Passing the 'unique = never' for StrongSwan's `connections.<conn>.unique` parameter
72
+ self .cli_set (['vpn' , 'ipsec' , 'disable-uniqreqids' ])
73
+
65
74
self .cli_commit ()
66
75
# check ipsec apply to swanctl
67
76
self .assertEqual ('' , cmd ('echo vyos | sudo -S swanctl -L ' ))
@@ -76,14 +85,27 @@ def test_vpn_l2tp_dependence_ipsec_swanctl(self):
76
85
self .cli_set (base_path + ['ipsec-settings' , 'authentication' , 'pre-shared-secret' , 'SeCret' ])
77
86
self .cli_set (base_path + ['ipsec-settings' , 'ike-lifetime' , '8600' ])
78
87
self .cli_set (base_path + ['ipsec-settings' , 'lifetime' , '3600' ])
79
- self .cli_set (base_path + ['outside-address' , '203.0.113.1' ])
88
+ self .cli_set (base_path + ['outside-address' , outside_address ])
80
89
self .cli_set (base_path + ['gateway-address' , '203.0.113.1' ])
81
90
82
91
self .cli_commit ()
83
92
84
93
# check l2tp apply to swanctl
85
94
self .assertTrue ('l2tp_remote_access:' in cmd ('echo vyos | sudo -S swanctl -L ' ))
86
95
96
+ swanctl_conf = read_file (swanctl_file )
97
+ swanctl_lines = [
98
+ f'local_addrs = { outside_address } ' ,
99
+ 'proposals = aes256-sha1-modp1024,3des-sha1-modp1024' ,
100
+ 'dpd_delay = 15s' ,
101
+ 'dpd_timeout = 45s' ,
102
+ 'rekey_time = 8600s' ,
103
+ 'reauth_time = 0' ,
104
+ 'unique = never' ,
105
+ ]
106
+ for line in swanctl_lines :
107
+ self .assertIn (line , swanctl_conf )
108
+
87
109
self .cli_delete (['vpn' , 'l2tp' ])
88
110
self .cli_commit ()
89
111
0 commit comments