Support jailing datasets

This commit is contained in:
tschettervictor
2025-05-09 10:33:19 -06:00
parent 9e1a1f65d1
commit c222d602aa
2 changed files with 19 additions and 1 deletions

View File

@@ -186,6 +186,16 @@ for _jail in ${JAILS}; do
# Start jail
jail ${OPTION} -f "${bastille_jailsdir}/${_jail}/jail.conf" -c "${_jail}"
# Add ZFS jailed datasets
if [ -s "${bastille_jailsdir}/${_jail}/zfs.conf" ]; then
while read _dataset _mount; do
zfs set jailed=on "${_dataset}"
zfs jail ${_jail} "${_dataset}"
jexec -l -U root "${_jail}" zfs set mountpoint="${_mount}" "${_dataset}"
jexec -l -U root "${_jail}" zfs mount "${_dataset}" 2>/dev/null
done < "${bastille_jailsdir}/${_jail}/zfs.conf"
fi
# Add rctl limits
if [ -s "${bastille_jailsdir}/${_jail}/rctl.conf" ]; then
while read _limits; do
@@ -215,4 +225,4 @@ for _jail in ${JAILS}; do
bastille_running_jobs "${bastille_process_limit}"
done
wait
wait