Skip to content

Commit

Permalink
mt: use safe name for jails .conf file
Browse files Browse the repository at this point in the history
  • Loading branch information
msimerson committed Mar 13, 2024
1 parent eeb3855 commit faccb3f
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions mail-toaster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -475,21 +475,22 @@ get_safe_jail_path()

add_jail_conf_d()
{
_safe_path="/etc/jail.conf.d/$(safe_jailname $1).conf"
if [ -f "/etc/jail.conf.d/$1.conf" ]; then
tell_status "preserving jail config /etc/jail.conf.d/$1.conf"
tell_status "preserving jail config $_safe_path"
return
fi

tell_status "creating /etc/jail.conf.d/$1.conf"
tell_status "creating $_safe_path"
echo "$(jail_conf_header)
$1 {$(get_safe_jail_path $1)
mount.fstab = \"$ZFS_DATA_MNT/$1/etc/fstab\";
$(safe_jailname $1) {$(get_safe_jail_path $1)
mount.fstab = \"\$path/etc/fstab\";
ip4.addr = $JAIL_NET_INTERFACE|${_jail_ip};
ip6.addr = $JAIL_NET_INTERFACE|$(get_jail_ip6 $1);${JAIL_CONF_EXTRA}
exec.created = \"$ZFS_DATA_MNT/$1/etc/pf.conf.d/pfrule.sh load\";
exec.poststop = \"$ZFS_DATA_MNT/$1/etc/pf.conf.d/pfrule.sh unload\";
}" | tee -a /etc/jail.conf.d/$1.conf
exec.created = \"\$path/etc/pf.conf.d/pfrule.sh load\";
exec.poststop = \"\$path/etc/pf.conf.d/pfrule.sh unload\";
}" | tee -a $_safe_path
}

add_automount()
Expand Down

0 comments on commit faccb3f

Please sign in to comment.