From 47faf79f3af909dcbd2ba680da2afc235824869d Mon Sep 17 00:00:00 2001 From: tschettervictor <85497460+tschettervictor@users.noreply.github.com> Date: Thu, 20 Mar 2025 17:31:26 -0600 Subject: [PATCH 1/2] clone: Fix old style interface to new style --- usr/local/share/bastille/clone.sh | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/usr/local/share/bastille/clone.sh b/usr/local/share/bastille/clone.sh index 0db63835..f278dd15 100644 --- a/usr/local/share/bastille/clone.sh +++ b/usr/local/share/bastille/clone.sh @@ -153,13 +153,22 @@ update_jailconf() { else _ip4="$(bastille config ${TARGET} get ip4.addr | sed 's/,/ /g')" _ip6="$(bastille config ${TARGET} get ip6.addr | sed 's/,/ /g')" + _interface="$(bastille config ${TARGET} get interface)" + # Remove old style interface naming in place of new if|ip style + if [ "${_interface}" != "not set" ]; then + sed -i '' "/.*interface = .*/d" "${JAIL_CONFIG}" + fi # IP4 if [ "${_ip4}" != "not set" ]; then for _ip in ${_ip4}; do if echo ${_ip} | grep -q "|"; then _ip="$(echo ${_ip} | awk -F"|" '{print $2}')" fi - sed -i '' "/ip4.addr = .*/ s/${_ip}/${IP}/" "${JAIL_CONFIG}" + if [ "${_interface}" != "not set" ]; then + sed -i '' "s/.*${_interface} = .*/ ip4.addr = ${_interface}|${IP};/" "${JAIL_CONFIG}" + else + sed -i '' "/ip4.addr = .*/ s/${_ip}/${IP}/" "${JAIL_CONFIG}" + fi sed -i '' "/ip4.addr += .*/ s/${_ip}/127.0.0.1/" "${JAIL_CONFIG}" done fi @@ -169,7 +178,11 @@ update_jailconf() { if echo ${_ip} | grep -q "|"; then _ip="$(echo ${_ip} | awk -F"|" '{print $2}')" fi - sed -i '' "/ip6.addr = .*/ s/${_ip}/${IP}/" "${JAIL_CONFIG}" + if [ "${_interface}" != "not set" ]; then + sed -i '' "s/.*${_interface} = .*/ ip6.addr = ${_interface}|${IP};/" "${JAIL_CONFIG}" + else + sed -i '' "/ip6.addr = .*/ s/${_ip}/${IP}/" "${JAIL_CONFIG}" + fi sed -i '' "/ip6.addr += .*/ s/${_ip}/127.0.0.1/" "${JAIL_CONFIG}" sed -i '' "s/ip6 = .*/ip6 = ${IP6_MODE};/" "${JAIL_CONFIG}" done From 0f3b5baf83215a6097fba610b33c056cd676c9b0 Mon Sep 17 00:00:00 2001 From: tschettervictor <85497460+tschettervictor@users.noreply.github.com> Date: Fri, 21 Mar 2025 05:43:04 -0600 Subject: [PATCH 2/2] clone: Fix old to new interface style --- usr/local/share/bastille/clone.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr/local/share/bastille/clone.sh b/usr/local/share/bastille/clone.sh index f278dd15..1ac64bca 100644 --- a/usr/local/share/bastille/clone.sh +++ b/usr/local/share/bastille/clone.sh @@ -165,7 +165,7 @@ update_jailconf() { _ip="$(echo ${_ip} | awk -F"|" '{print $2}')" fi if [ "${_interface}" != "not set" ]; then - sed -i '' "s/.*${_interface} = .*/ ip4.addr = ${_interface}|${IP};/" "${JAIL_CONFIG}" + sed -i '' "s/.*ip4.addr = .*/ ip4.addr = ${_interface}|${IP};/" "${JAIL_CONFIG}" else sed -i '' "/ip4.addr = .*/ s/${_ip}/${IP}/" "${JAIL_CONFIG}" fi