diff options
-rwxr-xr-x | ezjail-admin | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/ezjail-admin b/ezjail-admin index b2b8443..06579b2 100755 --- a/ezjail-admin +++ b/ezjail-admin | |||
@@ -726,18 +726,23 @@ EOF | |||
726 | # Add none meaning the host system. Prepare this list as argument for pgrep | 726 | # Add none meaning the host system. Prepare this list as argument for pgrep |
727 | # by prepending -j to each jid | 727 | # by prepending -j to each jid |
728 | IFS=${TIFS} | 728 | IFS=${TIFS} |
729 | jail_ids=`( echo none= | 729 | _freebsd_version=`uname -r` |
730 | jls -n | sed -E -n s/'.*jid=([0-9]+).*ip4\.addr=([0-9.,]+).*'/'\1=\2'/p | grep -Ee "${ezjail_ip}(,|$)" | 730 | if [ ${_freebsd_version%%.*} -gt 7 ]; then |
731 | jls -n | sed -E -n s/'.*jid=([0-9]+).*ip6\.addr=([0-9a-f:,]+).*'/'\1=\2'/p | grep -Ee "${ezjail_ip}(,|$)" | 731 | jail_ids=`( echo none= |
732 | ) | cut -d= -f1 | sed s/^/-j/` | 732 | jls -n | sed -E -n s/'.*jid=([0-9]+).*ip4\.addr=([0-9.,]+).*'/'\1=\2'/p | grep -Ee "${ezjail_ip}(,|$)" |
733 | jls -n | sed -E -n s/'.*jid=([0-9]+).*ip6\.addr=([0-9a-f:,]+).*'/'\1=\2'/p | grep -Ee "${ezjail_ip}(,|$)" | ||
734 | ) | cut -d= -f1 | sed s/^/-j/` | ||
733 | 735 | ||
734 | # Fetch all corresponding process ids for all matching jail | 736 | # Fetch all corresponding process ids for all matching jail |
735 | jail_pids=`pgrep $jail_ids` | 737 | jail_pids=`pgrep $jail_ids` |
736 | 738 | ||
737 | # expand pids to form a greppable expression | 739 | # expand pids to form a greppable expression |
738 | jail_grep=`echo $jail_pids | sed -E -e"s/ / )|( /g" -e"s/^/( /" -e"s/$/ )/"` | 740 | jail_grep=`echo $jail_pids | sed -E -e"s/ / )|( /g" -e"s/^/( /" -e"s/$/ )/"` |
739 | 741 | ||
740 | IFS=_ | 742 | IFS=_ |
743 | else | ||
744 | jail_grep=. | ||
745 | fi | ||
741 | ezjail_listener=`sockstat -46l | grep -E -e "\*:[[:digit:]]" | grep -E -e "${jail_grep}"` | 746 | ezjail_listener=`sockstat -46l | grep -E -e "\*:[[:digit:]]" | grep -E -e "${jail_grep}"` |
742 | [ $? -eq 0 ] && echo -e "Warning: Some services already seem to be listening on all IP, (including ${ezjail_ip})\n This may cause some confusion, here they are:\n${ezjail_listener}" | 747 | [ $? -eq 0 ] && echo -e "Warning: Some services already seem to be listening on all IP, (including ${ezjail_ip})\n This may cause some confusion, here they are:\n${ezjail_listener}" |
743 | IFS=, | 748 | IFS=, |