From 3f35a629db9165e464249b7a8fa0d7f924ebcca7 Mon Sep 17 00:00:00 2001 From: tschettervictor <85497460+tschettervictor@users.noreply.github.com> Date: Mon, 12 May 2025 09:48:26 -0600 Subject: [PATCH] config: Allow setting ip[4|6].addr with out IF --- usr/local/share/bastille/config.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/usr/local/share/bastille/config.sh b/usr/local/share/bastille/config.sh index 642c1036..29a66fcf 100644 --- a/usr/local/share/bastille/config.sh +++ b/usr/local/share/bastille/config.sh @@ -117,7 +117,18 @@ print_jail_conf() { for _jail in ${JAILS}; do ( - + + # Backwards compatibility for specifying only an IP with ip[4|6].addr + if [ "${ACTION}" = "set" ] && [ "${PROPERTY}" = "ip4.addr" ]; then + if ! echo "${VALUE}" | grep -q "|"; then + VALUE="$(bastille config ${_jail} get ip4.addr | awk -F"|" '{print $1}')|${VALUE}" + fi + elif [ "${ACTION}" = "set" ] && [ "${PROPERTY}" = "ip6.addr" ]; then + if ! echo "${VALUE}" | grep -q "|"; then + VALUE="$(bastille config ${_jail} get ip6.addr | awk -F"|" '{print $1}')|${VALUE}" + fi + fi + # Handle Bastille specific properties # Currently only 'depend' 'priority' and 'boot' if [ "${PROPERTY}" = "priority" ] || [ "${PROPERTY}" = "prio" ]; then