aboutsummaryrefslogtreecommitdiffstats
path: root/test/mocks
diff options
context:
space:
mode:
authorBartek Grzybowski <b.grzybowski@partner.samsung.com>2020-06-08 14:29:29 +0200
committerBartek Grzybowski <b.grzybowski@partner.samsung.com>2020-06-10 06:39:05 +0000
commit81287bce75c81fdcbcf5f7c16a6454960e200d38 (patch)
tree6dfef4977ad22073ec08f572116df57d94ee5cbb /test/mocks
parent138b1990ee124c00a482e756460f83944ba19a0a (diff)
Chown vsftpd config file to root while bootstrapping
Change-Id: I48716f544bd34b05a5524b58500cdff7c96a9578 Issue-ID: INT-1617 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
Diffstat (limited to 'test/mocks')
-rwxr-xr-xtest/mocks/mass-pnf-sim/MassPnfSim.py7
-rw-r--r--test/mocks/mass-pnf-sim/test_lifecycle.py6
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):