summaryrefslogtreecommitdiff
path: root/smoketest/scripts/cli/test_vpn_sstp.py
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-10-03 19:58:45 +0200
committerChristian Poessinger <christian@poessinger.com>2020-10-03 19:59:21 +0200
commitbe3c9bdf9274866d9e6548792a7f668fa04fa24f (patch)
treef76081f37cd87f381b43685c3180aedbafb20187 /smoketest/scripts/cli/test_vpn_sstp.py
parent2c90c0d7c8d3bef95c1397c199bb53f7847743d7 (diff)
downloadvyos-1x-be3c9bdf9274866d9e6548792a7f668fa04fa24f.tar.gz
vyos-1x-be3c9bdf9274866d9e6548792a7f668fa04fa24f.zip
smoketest: sstp: add basic tests
Diffstat (limited to 'smoketest/scripts/cli/test_vpn_sstp.py')
-rwxr-xr-xsmoketest/scripts/cli/test_vpn_sstp.py34
1 files changed, 33 insertions, 1 deletions
diff --git a/smoketest/scripts/cli/test_vpn_sstp.py b/smoketest/scripts/cli/test_vpn_sstp.py
index fbf958c4d..d129867cc 100755
--- a/smoketest/scripts/cli/test_vpn_sstp.py
+++ b/smoketest/scripts/cli/test_vpn_sstp.py
@@ -17,17 +17,49 @@
import unittest
from base_accel_ppp_test import BasicAccelPPPTest
+from vyos.util import cmd
process_name = 'accel-pppd'
+ca_cert = '/tmp/ca.crt'
+ssl_cert = '/tmp/server.crt'
+ssl_key = '/tmp/server.key'
class TestVPNSSTPServer(BasicAccelPPPTest.BaseTest):
def setUp(self):
self._base_path = ['vpn', 'sstp']
+ self._process_name = 'accel-pppd'
+ self._config_file = '/run/accel-pppd/sstp.conf'
+ self._chap_secrets = '/run/accel-pppd/sstp.chap-secrets'
+
super().setUp()
def tearDown(self):
- self.session.delete(local_if)
super().tearDown()
+ def basic_config(self):
+ # SSL is mandatory
+ self.set(['ssl', 'ca-cert-file', ca_cert])
+ self.set(['ssl', 'cert-file', ssl_cert])
+ self.set(['ssl', 'key-file', ssl_key])
+
+ self.set(['network-settings', 'client-ip-settings', 'subnet', '192.0.2.0/24'])
+ self.set(['network-settings', 'client-ip-settings', 'gateway-address', '1.1.1.1'])
+
+ super().basic_config()
+
if __name__ == '__main__':
+ # Our SSL certificates need a subject ...
+ subject = '/C=DE/ST=BY/O=VyOS/localityName=Cloud/commonName=vyos/' \
+ 'organizationalUnitName=VyOS/emailAddress=maintainers@vyos.io/'
+
+ # Generate mandatory SSL certificate
+ tmp = f'openssl req -newkey rsa:4096 -new -nodes -x509 -days 3650 '\
+ f'-keyout {ssl_key} -out {ssl_cert} -subj {subject}'
+ cmd(tmp)
+
+ # Generate "CA"
+ tmp = f'openssl req -new -x509 -key {ssl_key} -out {ca_cert} '\
+ f'-subj {subject}'
+ cmd(tmp)
+
unittest.main()