summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2012-05-06 00:58:06 +0000
committererdgeist <erdgeist@erdgeist.org>2012-05-06 00:58:06 +0000
commit7646f7e7776b361fad92069ba7f0d2e68f5e5e26 (patch)
tree011d3de3e42cfda539c79f1521811133ce0a2d6b
parent542f046fabc7bfb6c33d7c69a442cef2e4ed4b36 (diff)
FreeBSD versions before 8.0 did not know about jls -n. Use the old check for now. Thanks to Fahad.
-rwxr-xr-xezjail-admin23
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=,