From 74b6eb76e7f7ced244dbac644d2bb497dae498e0 Mon Sep 17 00:00:00 2001 From: JRGTH Date: Thu, 14 Jul 2022 21:41:52 -0400 Subject: [PATCH] Update the exec.* with uniq_epair when cloning jails This update will fix the startup error after cloning a jail, this was because the exec.prestart/poststop not being properly updated. --- usr/local/share/bastille/clone.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/usr/local/share/bastille/clone.sh b/usr/local/share/bastille/clone.sh index 5d89826f..edc9a7fa 100644 --- a/usr/local/share/bastille/clone.sh +++ b/usr/local/share/bastille/clone.sh @@ -109,7 +109,11 @@ update_jailconf_vnet() { if [ -n "${jail_list}" ]; then if ! grep -q "e0b_bastille${_num}" "${bastille_jailsdir}"/*/jail.conf; then uniq_epair="bastille${_num}" + # Update the exec.* with uniq_epair when cloning jails. sed -i '' "s|vnet.interface = e0b_bastille.*;|vnet.interface = e0b_${uniq_epair};|" "${JAIL_CONFIG}" + sed -i '' "s|exec.prestart += \"jib addm bastille[0-9]|exec.prestart += \"jib addm ${uniq_epair}|" "${JAIL_CONFIG}" + sed -i '' "s|exec.prestart += \"ifconfig e0a_bastille[0-9].*|exec.prestart += \"ifconfig e0a_${uniq_epair} description \\\\\"vnet host interface for Bastille jail ${NEWNAME}\\\\\"\";|" "${JAIL_CONFIG}" + sed -i '' "s|exec.poststop += \"jib destroy bastille[0-9]\";|exec.poststop += \"jib destroy ${uniq_epair}\";|" "${JAIL_CONFIG}" break fi fi