From c66295e27c44c3ad4453f0d7ba9ccd905a6decb8 Mon Sep 17 00:00:00 2001 From: t3sserakt Date: Mon, 30 Aug 2021 15:04:46 +0200 Subject: - introduced nested namespace in test script to get rid of the permission problem, renamed test file. --- src/testing/netjail_core.sh | 11 ++++++++++- src/testing/netjail_exec.sh | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'src/testing') diff --git a/src/testing/netjail_core.sh b/src/testing/netjail_core.sh index f49d4b312..cf350d3fa 100755 --- a/src/testing/netjail_core.sh +++ b/src/testing/netjail_core.sh @@ -1,7 +1,7 @@ #!/bin/sh # -JAILOR=${SUDO_USER:?must run in sudo} + # running with `sudo` is required to be # able running the actual commands as the @@ -90,6 +90,7 @@ netjail_node_add_default() { } netjail_node_exec() { + JAILOR=${SUDO_USER:?must run in sudo} NODE=$1 FD_IN=$2 FD_OUT=$3 @@ -99,9 +100,17 @@ netjail_node_exec() { } netjail_node_exec_without_fds() { + JAILOR=${SUDO_USER:?must run in sudo} NODE=$1 shift 1 ip netns exec $NODE sudo -u $JAILOR -- $@ } +netjail_node_exec_without_fds_and_sudo() { + NODE=$1 + shift 1 + + ip netns exec $NODE $@ +} + diff --git a/src/testing/netjail_exec.sh b/src/testing/netjail_exec.sh index c20a8c117..17a7caaac 100755 --- a/src/testing/netjail_exec.sh +++ b/src/testing/netjail_exec.sh @@ -13,4 +13,4 @@ NODE=$(netjail_print_name "N" $N $M) -netjail_node_exec_without_fds $NODE $3 $4 $5 $1 $2 +netjail_node_exec_without_fds_and_sudo $NODE $3 $4 $5 $1 $2 -- cgit v1.2.3