From 4753006e2cddc82850fedc28713f25a0e2660e46 Mon Sep 17 00:00:00 2001 From: msoudny <164319180+msoudny@users.noreply.github.com> Date: Sun, 24 Nov 2024 09:47:57 +0100 Subject: [PATCH 1/2] Update setup.sh - check that bastille.conf exists or create a copy from .sample, - changed "bastille0" loopback creation to read config value $bastille_network_loopback instead, - changed setup.sh argument "bastille0" for loopback interface creation to a more generic "network", - "bastille0" as a setup.sh argument is left for backwards compatibility --- usr/local/share/bastille/setup.sh | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/usr/local/share/bastille/setup.sh b/usr/local/share/bastille/setup.sh index 21f0a51d..d29322fe 100644 --- a/usr/local/share/bastille/setup.sh +++ b/usr/local/share/bastille/setup.sh @@ -31,10 +31,15 @@ bastille_config="/usr/local/etc/bastille/bastille.conf" . /usr/local/share/bastille/common.sh # shellcheck source=/usr/local/etc/bastille/bastille.conf + +if [ ! -f "${bastille_config}" ] +then + cp /usr/local/etc/bastille/bastille.conf.sample ${bastille_config} +fi . ${bastille_config} usage() { - error_exit "Usage: bastille setup [pf|bastille0|zfs|vnet]" + error_exit "Usage: bastille setup [pf|network|zfs|vnet]" } # Check for too many args @@ -42,13 +47,13 @@ if [ $# -gt 1 ]; then usage fi -# Configure bastille0 network interface -configure_bastille0() { - info "Configuring bastille0 loopback interface" +# Configure bastille loopback network interface +configure_network() { + info "Configuring ${bastille_network_loopback} loopback interface" sysrc cloned_interfaces+=lo1 - sysrc ifconfig_lo1_name="bastille0" + sysrc ifconfig_lo1_name="${bastille_network_loopback}" - info "Bringing up new interface: bastille0" + info "Bringing up new interface: ${bastille_network_loopback}" service netif cloneup } @@ -123,7 +128,7 @@ configure_zfs() { # Run all base functions (w/o vnet) if no args if [ $# -eq 0 ]; then sysrc bastille_enable=YES - configure_bastille0 + configure_network configure_pf configure_zfs fi @@ -136,8 +141,8 @@ help|-h|--help) pf|firewall) configure_pf ;; -bastille0|loopback) - configure_bastille0 +network|bastille0|loopback) + configure_network ;; zfs|storage) configure_zfs From cee4d669ca4df2b5d56254b3508e29933a2ba314 Mon Sep 17 00:00:00 2001 From: Juan David Hurtado G Date: Sun, 24 Nov 2024 11:07:46 -0500 Subject: [PATCH 2/2] setup: warning deprecation of bastille0 option and updates documentation --- README.md | 2 +- docs/chapters/subcommands/setup.rst | 2 +- usr/local/share/bastille/setup.sh | 13 +++++++++---- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 36eb47e1..f7f6a9ce 100644 --- a/README.md +++ b/README.md @@ -110,7 +110,7 @@ automatically. This feature is new since version 0.10.20231013. ```shell ishmael ~ # bastille setup -h -ishmael ~ # Usage: bastille setup [pf|bastille0|zfs|vnet] +ishmael ~ # Usage: bastille setup [pf|network|zfs|vnet] ``` On fresh installations it is likely safe to run `bastille setup` with no diff --git a/docs/chapters/subcommands/setup.rst b/docs/chapters/subcommands/setup.rst index 53d65e61..cf5ddfbc 100644 --- a/docs/chapters/subcommands/setup.rst +++ b/docs/chapters/subcommands/setup.rst @@ -9,7 +9,7 @@ options for a Bastille host with one command. .. code-block:: shell ishmael ~ # bastille setup -h ## display setup help - ishmael ~ # bastille setup bastille0 ## only configure loopback interface + ishmael ~ # bastille setup network ## only configure loopback interface ishmael ~ # bastille setup pf ## only configure default firewall ishmael ~ # bastille setup zfs ## only configure ZFS storage ishmael ~ # bastille setup vnet ## only configure VNET bridge diff --git a/usr/local/share/bastille/setup.sh b/usr/local/share/bastille/setup.sh index d29322fe..d9db8834 100644 --- a/usr/local/share/bastille/setup.sh +++ b/usr/local/share/bastille/setup.sh @@ -30,12 +30,12 @@ bastille_config="/usr/local/etc/bastille/bastille.conf" . /usr/local/share/bastille/common.sh -# shellcheck source=/usr/local/etc/bastille/bastille.conf -if [ ! -f "${bastille_config}" ] -then +if [ ! -f "${bastille_config}" ]; then cp /usr/local/etc/bastille/bastille.conf.sample ${bastille_config} fi + +# shellcheck source=/usr/local/etc/bastille/bastille.conf . ${bastille_config} usage() { @@ -141,7 +141,12 @@ help|-h|--help) pf|firewall) configure_pf ;; -network|bastille0|loopback) +bastille0) + # TODO remove in future release 0.13 + warn "'bastille setup bastille0' will be deprecated in the next 0.13 version." + configure_network + ;; +network|loopback) configure_network ;; zfs|storage)