mirror of
https://github.com/GRFreire/split-vpn-manager.git
synced 2026-01-09 21:09:39 +00:00
add inspect command
the inspect command is a simple wrapper arround `ss -tup`, which shows all processes running in a given net namespace
This commit is contained in:
parent
44d8318129
commit
fdadef7025
@ -14,6 +14,9 @@ Usage:
|
|||||||
./split-vpn-manager.sh run NETNS_NAME CMD
|
./split-vpn-manager.sh run NETNS_NAME CMD
|
||||||
runs a command in the specified net namespace
|
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)
|
NOTE: Always run this script with privileged permissions (currently not)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@ -140,6 +140,10 @@ run() {
|
|||||||
exit $EXIT_SUCCESS
|
exit $EXIT_SUCCESS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inspect() {
|
||||||
|
run $1 ss -tup
|
||||||
|
}
|
||||||
|
|
||||||
help() {
|
help() {
|
||||||
echo "Usage:"
|
echo "Usage:"
|
||||||
echo " $0 launch_openvpn --name NETNS_NAME --config CONFIG_FILE --auth AUTH_FILE"
|
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 " $0 run NETNS_NAME CMD"
|
||||||
echo " runs a command in the specified net namespace"
|
echo " runs a command in the specified net namespace"
|
||||||
echo ""
|
echo ""
|
||||||
|
echo " $0 inspect NETNS_NAME"
|
||||||
|
echo " list all processes using TCP/UDP sockets inside the specified net namespace"
|
||||||
|
echo ""
|
||||||
|
|
||||||
user_id="$(id -u)"
|
user_id="$(id -u)"
|
||||||
if [ "$user_id" -ne 0 ]; then
|
if [ "$user_id" -ne 0 ]; then
|
||||||
@ -168,6 +175,8 @@ case "$command" in
|
|||||||
down_netns "$@";;
|
down_netns "$@";;
|
||||||
run)
|
run)
|
||||||
run "$@";;
|
run "$@";;
|
||||||
|
inspect)
|
||||||
|
inspect "$@";;
|
||||||
help|--help)
|
help|--help)
|
||||||
help;;
|
help;;
|
||||||
*)
|
*)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user