From eb65800a0cd5b345bd202fce911cb88f85ab35a4 Mon Sep 17 00:00:00 2001 From: tschettervictor <85497460+tschettervictor@users.noreply.github.com> Date: Mon, 9 Dec 2024 22:02:01 -0700 Subject: [PATCH] show output when creating rdr rule --- usr/local/share/bastille/rdr.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/usr/local/share/bastille/rdr.sh b/usr/local/share/bastille/rdr.sh index 92f6d4ab..24733628 100644 --- a/usr/local/share/bastille/rdr.sh +++ b/usr/local/share/bastille/rdr.sh @@ -124,6 +124,9 @@ if [ -n "$JAIL_IP6" ]; then printf '%s\nrdr pass on $%s inet proto %s to port %s -> %s port %s\n' "$EXT_IF" "${bastille_network_pf_ext_if}" "$1" "$2" "$JAIL_IP6" "$3" ) \ | pfctl -a "rdr/${JAIL_NAME}" -f- fi +local interface="$( echo $EXT_IF | awk -F'"' '{print $2}')" +info "[${JAIL_NAME}]:" +info "Redirecting: ${1} port ${2} to ${3} on ${interface}" } # function: load rdr rule with log via pfctl @@ -139,14 +142,16 @@ if [ -n "$JAIL_IP6" ]; then printf '%s\nrdr pass %s on $%s inet proto %s to port %s -> %s port %s\n' "$EXT_IF" "$log" "${bastille_network_pf_ext_if}" "$proto" "$host_port" "$JAIL_IP6" "$jail_port" ) \ | pfctl -a "rdr/${JAIL_NAME}" -f- fi - +local interface="$( echo $EXT_IF | awk -F'"' '{print $2}')" +info "[${JAIL_NAME}]:" +info "Redirecting: ${1} port ${2} to ${3} on ${interface}" } while [ $# -gt 0 ]; do # Check if interface was specified, and use it instead of default if ifconfig | grep -wo "${1}"; then IF_NAME="${1}" - EXT_IF=ext_if="${1}" + EXT_IF=ext_if=\"${1}\" shift fi case "$1" in