From 8725e9ccacb84865a830cabec0e0f42a8b7ffdd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carsten=20B=C3=83cker?= Date: Wed, 30 Sep 2020 09:05:44 +0000 Subject: [PATCH 1/3] Prevent acting on non-bastille jails when using target ALL --- usr/local/bin/bastille | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr/local/bin/bastille b/usr/local/bin/bastille index f2bafe35..eb3da3ee 100755 --- a/usr/local/bin/bastille +++ b/usr/local/bin/bastille @@ -145,7 +145,7 @@ clone|cmd|console|convert|cp|edit|export|htop|limits|mount|pkg|rename|service|st shift if [ "${TARGET}" = 'ALL' ]; then - JAILS=$(jls name) + JAILS=$(ls ${bastille_jailsdir}) else JAILS=$(jls name | awk "/^${TARGET}$/") From 9fd83714c86cb5c4e185c2c841ab57620f86d3c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carsten=20B=C3=83cker?= Date: Wed, 30 Sep 2020 10:36:58 +0000 Subject: [PATCH 2/3] Restrict to running jails --- usr/local/bin/bastille | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/usr/local/bin/bastille b/usr/local/bin/bastille index eb3da3ee..edc11221 100755 --- a/usr/local/bin/bastille +++ b/usr/local/bin/bastille @@ -145,7 +145,15 @@ clone|cmd|console|convert|cp|edit|export|htop|limits|mount|pkg|rename|service|st shift if [ "${TARGET}" = 'ALL' ]; then - JAILS=$(ls ${bastille_jailsdir}) + _JAILS=$(jls name) + JAILS="" + for _jail in ${_JAILS}; do + _JAILPATH=$(jls -j "${_jail}" path) + if [ -z ${_JAILPATH##${bastille_jailsdir}*} ]; then + JAILS="${JAILS} ${_jail}" + fi + done + else JAILS=$(jls name | awk "/^${TARGET}$/") From 0c5225571f33303804cfadd9b2c6c116ce92c3a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carsten=20B=C3=83cker?= Date: Wed, 30 Sep 2020 10:41:14 +0000 Subject: [PATCH 3/3] Fix whitespace --- usr/local/bin/bastille | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/usr/local/bin/bastille b/usr/local/bin/bastille index edc11221..62b97bb7 100755 --- a/usr/local/bin/bastille +++ b/usr/local/bin/bastille @@ -145,15 +145,14 @@ clone|cmd|console|convert|cp|edit|export|htop|limits|mount|pkg|rename|service|st shift if [ "${TARGET}" = 'ALL' ]; then - _JAILS=$(jls name) - JAILS="" - for _jail in ${_JAILS}; do - _JAILPATH=$(jls -j "${_jail}" path) - if [ -z ${_JAILPATH##${bastille_jailsdir}*} ]; then - JAILS="${JAILS} ${_jail}" - fi + _JAILS=$(jls name) + JAILS="" + for _jail in ${_JAILS}; do + _JAILPATH=$(jls -j "${_jail}" path) + if [ -z ${_JAILPATH##${bastille_jailsdir}*} ]; then + JAILS="${JAILS} ${_jail}" + fi done - else JAILS=$(jls name | awk "/^${TARGET}$/")