diff options
Diffstat (limited to 'test')
-rwxr-xr-x | test/mocks/mass-pnf-sim/MassPnfSim.py | 7 | ||||
-rw-r--r-- | test/mocks/mass-pnf-sim/test_lifecycle.py | 6 |
2 files changed, 11 insertions, 2 deletions
diff --git a/test/mocks/mass-pnf-sim/MassPnfSim.py b/test/mocks/mass-pnf-sim/MassPnfSim.py index cdf97fcf9..023c4cbf4 100755 --- a/test/mocks/mass-pnf-sim/MassPnfSim.py +++ b/test/mocks/mass-pnf-sim/MassPnfSim.py @@ -4,7 +4,7 @@ from subprocess import run, CalledProcessError import argparse import ipaddress from sys import exit -from os import chdir, getcwd, path, popen, kill, mkdir +from os import chdir, getcwd, path, popen, kill, getuid, stat, mkdir from shutil import copytree, rmtree, move from json import loads, dumps from yaml import load, SafeLoader @@ -276,6 +276,11 @@ class MassPnfSim: ftps_pasv_port_start += ftps_pasv_port_num_of_ports + 1 ftps_pasv_port_end += ftps_pasv_port_num_of_ports + 1 + # ugly hack to chown vsftpd config file to root + if getuid(): + self._run_cmd('sudo chown root config/vsftpd_ssl.conf', f'{self.sim_dirname_pattern}{i}') + self.logger.debug(f"vsftpd_ssl.conf file owner UID: {stat(self.sim_dirname_pattern + str(i) + '/config/vsftpd_ssl.conf').st_uid}") + self.logger.info(f'Done setting up instance #{i}') def build(self): diff --git a/test/mocks/mass-pnf-sim/test_lifecycle.py b/test/mocks/mass-pnf-sim/test_lifecycle.py index 0f77c9664..9bfb3dc7a 100644 --- a/test/mocks/mass-pnf-sim/test_lifecycle.py +++ b/test/mocks/mass-pnf-sim/test_lifecycle.py @@ -1,6 +1,6 @@ from MassPnfSim import MassPnfSim from glob import glob -from os import popen +from os import popen, stat from yaml import load, SafeLoader from ipaddress import ip_address from test_settings import * @@ -60,6 +60,10 @@ def test_bootstrap(args_bootstrap, parser, caplog): start_port += 2 print(yml['ippnfsim']) + # Verify vsftpd config file has proper permissions + for cfg in glob(f'{sim_dirname_pattern}*/config/vsftpd_ssl.conf'): + assert stat(cfg).st_uid == 0 + def test_bootstrap_status(args_status, caplog): MassPnfSim(args_status).status() for _ in range(SIM_INSTANCES): |