diff --git a/README.md b/README.md index bfaf532..a6bba14 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,9 @@ Usage: ./split-vpn-manager.sh run NETNS_NAME CMD runs a command in the specified net namespace + ./split-vpn-manager.sh inspect NETNS_NAME + list all processes using TCP/UDP sockets inside the specified net namespace + NOTE: Always run this script with privileged permissions (currently not) ``` diff --git a/split-vpn-manager.sh b/split-vpn-manager.sh index 6e5f608..b6f153b 100755 --- a/split-vpn-manager.sh +++ b/split-vpn-manager.sh @@ -140,6 +140,10 @@ run() { exit $EXIT_SUCCESS } +inspect() { + run $1 ss -tup +} + help() { echo "Usage:" echo " $0 launch_openvpn --name NETNS_NAME --config CONFIG_FILE --auth AUTH_FILE" @@ -148,6 +152,9 @@ help() { echo " $0 run NETNS_NAME CMD" echo " runs a command in the specified net namespace" echo "" + echo " $0 inspect NETNS_NAME" + echo " list all processes using TCP/UDP sockets inside the specified net namespace" + echo "" user_id="$(id -u)" if [ "$user_id" -ne 0 ]; then @@ -168,6 +175,8 @@ case "$command" in down_netns "$@";; run) run "$@";; + inspect) + inspect "$@";; help|--help) help;; *)