From 11b75f5dadd9dbca990847a3f336cb9f75374055 Mon Sep 17 00:00:00 2001 From: Juan David Hurtado G Date: Sun, 24 Nov 2024 20:49:06 -0500 Subject: [PATCH 1/8] shellcheck errors: SC2068 Double quote array expansions to avoid re-splitting elements. --- usr/local/share/bastille/common.sh | 2 +- usr/local/share/bastille/rdr.sh | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/usr/local/share/bastille/common.sh b/usr/local/share/bastille/common.sh index aef59e38..74c12e67 100644 --- a/usr/local/share/bastille/common.sh +++ b/usr/local/share/bastille/common.sh @@ -58,7 +58,7 @@ error_notify() { # Notify message on error and exit error_exit() { - error_notify $@ + error_notify "$@" exit 1 } diff --git a/usr/local/share/bastille/rdr.sh b/usr/local/share/bastille/rdr.sh index 9e3ebf7b..6bd7fbcd 100644 --- a/usr/local/share/bastille/rdr.sh +++ b/usr/local/share/bastille/rdr.sh @@ -183,21 +183,21 @@ while [ $# -gt 0 ]; do jail_port=$3 shift 3 if [ $# -gt 3 ]; then - for last in $@; do + for last in "$@"; do true done if [ $2 == "(" ] && [ $last == ")" ] ; then check_jail_validity - persist_rdr_log_rule $proto $host_port $jail_port $@ - load_rdr_log_rule $proto $host_port $jail_port $@ + persist_rdr_log_rule $proto $host_port $jail_port "$@" + load_rdr_log_rule $proto $host_port $jail_port "$@" shift $# else usage fi elif [ $# -eq 1 ]; then check_jail_validity - persist_rdr_log_rule $proto $host_port $jail_port $@ - load_rdr_log_rule $proto $host_port $jail_port $@ + persist_rdr_log_rule $proto $host_port $jail_port "$@" + load_rdr_log_rule $proto $host_port $jail_port "$@" shift 1 else usage From 8c872c708bf41844aa3f1528d244978de1f087e9 Mon Sep 17 00:00:00 2001 From: tschettervictor <85497460+tschettervictor@users.noreply.github.com> Date: Mon, 25 Nov 2024 10:37:41 -0700 Subject: [PATCH 2/8] Update usage.rst - bastille list only shows running containers 'bastille list' will only print running containers. '-a' or 'all' is needed to print both running and stopped. --- docs/chapters/usage.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/chapters/usage.rst b/docs/chapters/usage.rst index fb6b9e55..9cad2220 100644 --- a/docs/chapters/usage.rst +++ b/docs/chapters/usage.rst @@ -26,7 +26,7 @@ Usage htop Interactive process viewer (requires htop). import Import a specified container. limits Apply resources limits to targeted container(s). See rctl(8). - list List containers (running and stopped). + list List containers (running). mount Mount a volume inside the targeted container(s). pkg Manipulate binary packages within targeted container(s). See pkg(8). rdr Redirect host port to container port. From 53bd72a2721d5a4579c6598f3d150a51018700ed Mon Sep 17 00:00:00 2001 From: tschettervictor <85497460+tschettervictor@users.noreply.github.com> Date: Tue, 3 Dec 2024 18:26:49 -0700 Subject: [PATCH 3/8] Update setup.sh - fail setup on multiple zpool detection --- usr/local/share/bastille/setup.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/usr/local/share/bastille/setup.sh b/usr/local/share/bastille/setup.sh index dce3230c..15efd351 100644 --- a/usr/local/share/bastille/setup.sh +++ b/usr/local/share/bastille/setup.sh @@ -123,6 +123,10 @@ configure_zfs() { else ## attempt to determine bastille_zroot from `zpool list` bastille_zroot=$(zpool list | grep -v NAME | awk '{print $1}') + if [ $(echo "${bastille_zroot}" | wc -l) -gt 1 ]; then + error_notify "Error: Multiple zfs pools available:\n"${bastille_zroot}"" + error_exit "Set desired pool using \"sysrc -f "${bastille_config}" bastille_zfs_zpool=ZPOOL_NAME\"" + fi sysrc -f "${bastille_config}" bastille_zfs_enable=YES sysrc -f "${bastille_config}" bastille_zfs_zpool="${bastille_zroot}" fi From 4e460abcde435189e0aa71854b307e158d366089 Mon Sep 17 00:00:00 2001 From: tschettervictor <85497460+tschettervictor@users.noreply.github.com> Date: Tue, 3 Dec 2024 18:32:54 -0700 Subject: [PATCH 4/8] Update setup.sh - add additional warning to enable ZFS when adding ZPOOL --- usr/local/share/bastille/setup.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/usr/local/share/bastille/setup.sh b/usr/local/share/bastille/setup.sh index 15efd351..f098e532 100644 --- a/usr/local/share/bastille/setup.sh +++ b/usr/local/share/bastille/setup.sh @@ -125,7 +125,8 @@ configure_zfs() { bastille_zroot=$(zpool list | grep -v NAME | awk '{print $1}') if [ $(echo "${bastille_zroot}" | wc -l) -gt 1 ]; then error_notify "Error: Multiple zfs pools available:\n"${bastille_zroot}"" - error_exit "Set desired pool using \"sysrc -f "${bastille_config}" bastille_zfs_zpool=ZPOOL_NAME\"" + error_notify "Set desired pool using \"sysrc -f "${bastille_config}" bastille_zfs_zpool=ZPOOL_NAME\"" + error_exit "Don't forget to also enable ZFS using \"sysrc -f "${bastille_config}" bastille_zfs_enable=YES\"" fi sysrc -f "${bastille_config}" bastille_zfs_enable=YES sysrc -f "${bastille_config}" bastille_zfs_zpool="${bastille_zroot}" From 052c8b7492003d881127c266a79adbe65302add4 Mon Sep 17 00:00:00 2001 From: tschettervictor <85497460+tschettervictor@users.noreply.github.com> Date: Wed, 4 Dec 2024 07:22:42 -0700 Subject: [PATCH 5/8] Update setup.sh - uppercase ZFS --- usr/local/share/bastille/setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr/local/share/bastille/setup.sh b/usr/local/share/bastille/setup.sh index f098e532..147bfc9d 100644 --- a/usr/local/share/bastille/setup.sh +++ b/usr/local/share/bastille/setup.sh @@ -124,7 +124,7 @@ configure_zfs() { ## attempt to determine bastille_zroot from `zpool list` bastille_zroot=$(zpool list | grep -v NAME | awk '{print $1}') if [ $(echo "${bastille_zroot}" | wc -l) -gt 1 ]; then - error_notify "Error: Multiple zfs pools available:\n"${bastille_zroot}"" + error_notify "Error: Multiple ZFS pools available:\n"${bastille_zroot}"" error_notify "Set desired pool using \"sysrc -f "${bastille_config}" bastille_zfs_zpool=ZPOOL_NAME\"" error_exit "Don't forget to also enable ZFS using \"sysrc -f "${bastille_config}" bastille_zfs_enable=YES\"" fi From 904c05f7fb18ae40860ccd9d77d066072b5db9f7 Mon Sep 17 00:00:00 2001 From: tschettervictor <85497460+tschettervictor@users.noreply.github.com> Date: Wed, 4 Dec 2024 10:26:32 -0700 Subject: [PATCH 6/8] Update bastille - list command only shows running --- 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 a6f6967d..dd9cbb25 100755 --- a/usr/local/bin/bastille +++ b/usr/local/bin/bastille @@ -88,7 +88,7 @@ Available Commands: htop Interactive process viewer (requires htop). import Import a specified container. limits Apply resources limits to targeted container(s). See rctl(8). - list List containers (running and stopped). + list List containers (running). mount Mount a volume inside the targeted container(s). pkg Manipulate binary packages within targeted container(s). See pkg(8). rcp reverse cp(1) files from a single container to the host. From 0030213ff379f26c2c33270a55c165dc40e79dc3 Mon Sep 17 00:00:00 2001 From: tschettervictor <85497460+tschettervictor@users.noreply.github.com> Date: Wed, 4 Dec 2024 10:27:07 -0700 Subject: [PATCH 7/8] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f7f6a9ce..cd72b4cb 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,7 @@ Available Commands: htop Interactive process viewer (requires htop). import Import a specified container. limits Apply resources limits to targeted container(s). See rctl(8). - list List containers (running and stopped). + list List containers (running). mount Mount a volume inside the targeted container(s). pkg Manipulate binary packages within targeted container(s). See pkg(8). rdr Redirect host port to container port. From 85d656bd114908fc97333331ccc4c9825a4d4cae Mon Sep 17 00:00:00 2001 From: Juan David Hurtado G Date: Sun, 8 Dec 2024 15:12:15 -0500 Subject: [PATCH 8/8] setup: shellcheck --- usr/local/share/bastille/setup.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/usr/local/share/bastille/setup.sh b/usr/local/share/bastille/setup.sh index 147bfc9d..f6153e5b 100644 --- a/usr/local/share/bastille/setup.sh +++ b/usr/local/share/bastille/setup.sh @@ -123,10 +123,10 @@ configure_zfs() { else ## attempt to determine bastille_zroot from `zpool list` bastille_zroot=$(zpool list | grep -v NAME | awk '{print $1}') - if [ $(echo "${bastille_zroot}" | wc -l) -gt 1 ]; then - error_notify "Error: Multiple ZFS pools available:\n"${bastille_zroot}"" - error_notify "Set desired pool using \"sysrc -f "${bastille_config}" bastille_zfs_zpool=ZPOOL_NAME\"" - error_exit "Don't forget to also enable ZFS using \"sysrc -f "${bastille_config}" bastille_zfs_enable=YES\"" + if [ "$(echo "${bastille_zroot}" | wc -l)" -gt 1 ]; then + error_notify "Error: Multiple ZFS pools available:\n${bastille_zroot}" + error_notify "Set desired pool using \"sysrc -f ${bastille_config} bastille_zfs_zpool=ZPOOL_NAME\"" + error_exit "Don't forget to also enable ZFS using \"sysrc -f ${bastille_config} bastille_zfs_enable=YES\"" fi sysrc -f "${bastille_config}" bastille_zfs_enable=YES sysrc -f "${bastille_config}" bastille_zfs_zpool="${bastille_zroot}"