diff --git a/usr/local/share/bastille/common.sh b/usr/local/share/bastille/common.sh index 1295799..a78fd1d 100644 --- a/usr/local/share/bastille/common.sh +++ b/usr/local/share/bastille/common.sh @@ -79,7 +79,8 @@ generate_vnet_jail_netblock() { ## define uniq_epair local jail_list=$(bastille list jails) if [ -n "${jail_list}" ]; then - local list_jails_num=$(echo "${jail_list}" | wc -l | awk '{print $1}') + # local list_jails_num=$(echo "${jail_list}" | wc -l | awk '{print $1}') + local list_jails_num=$(grep -e "e[0-9]b_bastille" "${bastille_jailsdir}"/*/jail.conf | grep -Eo '(bastille)([0-9]{1,3});' | grep -Eo '[0-9]{1,2}' | wc -l | awk '{print $1}') local num_range=$((list_jails_num + 1)) for _num in $(seq 0 "${num_range}"); do if ! grep -q "e[0-9]b_bastille${_num}" "${bastille_jailsdir}"/*/jail.conf; then @@ -112,7 +113,7 @@ EOF vnet; vnet.interface = e0b_${uniq_epair}; exec.prestart += "jib addm ${uniq_epair} ${external_interface}"; - exec.prestart += "ifconfig e0a_${uniq_epair} description \"vnet host interface for Bastille jail ${jail_name}\""; + exec.prestart += "ifconfig e0a_${uniq_epair} description \'vnet host interface for Bastille jail ${jail_name}\'"; exec.poststop += "jib destroy ${uniq_epair}"; EOF fi