From 844a4263c9300398e5a2aa63c0fc4c67bdebcc6b Mon Sep 17 00:00:00 2001 From: tschettervictor <85497460+tschettervictor@users.noreply.github.com> Date: Mon, 16 Jun 2025 11:09:43 -0600 Subject: [PATCH 1/4] network: Standard is default --- usr/local/share/bastille/network.sh | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/usr/local/share/bastille/network.sh b/usr/local/share/bastille/network.sh index b5257e92..47028a38 100644 --- a/usr/local/share/bastille/network.sh +++ b/usr/local/share/bastille/network.sh @@ -41,7 +41,6 @@ usage() { -a | --auto Start/stop the jail(s) if required. -B | --bridge Add a bridged VNET interface to an existing jail. - -C | --classic Add an interface to a classic (non-VNET) jail. -M | --static-mac Generate a static MAC address for the interface. -n | --no-ip Create interface without an IP (VNET only). -P | --passthrough Pass the entire interface through to the jail. @@ -56,8 +55,8 @@ EOF # Handle options. AUTO=0 BRIDGE=0 -CLASSIC=0 STATIC_MAC=0 +STANDARD=0 PASSTHROUGH=0 VNET=0 VLAN_ID="" @@ -75,10 +74,6 @@ while [ "$#" -gt 0 ]; do BRIDGE=1 shift ;; - -C|--classic) - CLASSIC=1 - shift - ;; -M|--static-mac) STATIC_MAC=1 shift @@ -112,7 +107,6 @@ while [ "$#" -gt 0 ]; do case ${_o} in a) AUTO=1 ;; B) BRIDGE=1 ;; - C) CLASSIC=1 ;; M) STATIC_MAC=1 ;; n) NO_IP=1 ;; P) PASSTHROUGH=1 ;; @@ -140,16 +134,19 @@ else IP="" fi +# Default is standard interface +if [ "${VNET}" -eq 0 ] && [ "${BRIDGE}" -eq 0 ] && [ "${PASSTHROUGH}" -eq 0 ]; then + STANDARD=1 +fi + if [ "${ACTION}" = "add" ]; then if { [ "${VNET}" -eq 1 ] && [ "${BRIDGE}" -eq 1 ]; } || \ - { [ "${VNET}" -eq 1 ] && [ "${CLASSIC}" -eq 1 ]; } || \ + { [ "${VNET}" -eq 1 ] && [ "${STANDARD}" -eq 1 ]; } || \ { [ "${VNET}" -eq 1 ] && [ "${PASSTHROUGH}" -eq 1 ]; } || \ - { [ "${BRIDGE}" -eq 1 ] && [ "${CLASSIC}" -eq 1 ]; } || \ + { [ "${BRIDGE}" -eq 1 ] && [ "${STANDARD}" -eq 1 ]; } || \ { [ "${BRIDGE}" -eq 1 ] && [ "${PASSTHROUGH}" -eq 1 ]; } || \ - { [ "${CLASSIC}" -eq 1 ] && [ "${PASSTHROUGH}" -eq 1 ]; } then - error_exit "[ERROR]: Only one of [-B|--bridge], [-C|--classic], [-P|--passthrough] or [-V|--vnet] should be set." - elif [ "${VNET}" -eq 0 ] && [ "${BRIDGE}" -eq 0 ] && [ "${CLASSIC}" -eq 0 ] && [ "${PASSTHROUGH}" -eq 0 ]; then - error_exit "[ERROR]: [-B|--bridge], [-C|--classic], [-P|--passthrough] or [-V|--vnet] must be set." + { [ "${STANDARD}" -eq 1 ] && [ "${PASSTHROUGH}" -eq 1 ]; } then + error_exit "[ERROR]: Only one of [-B|--bridge], [-P|--passthrough] or [-V|--vnet] should be set." elif [ "${VNET}" -eq 0 ] && [ "${BRIDGE}" -eq 0 ] && [ "${PASSTHROUGH}" -eq 0 ] && [ -n "${VLAN_ID}" ]; then error_exit "[ERROR]: VLANs can only be used with VNET interfaces." elif [ "${VNET}" -eq 0 ] && [ "${BRIDGE}" -eq 0 ] && [ "${NO_IP}" -eq 1 ]; then @@ -455,7 +452,7 @@ EOF fi echo "Added Passthrough interface: \"${_if}\"" - elif [ "${CLASSIC}" -eq 1 ]; then + elif [ "${STANDARD}" -eq 1 ]; then if [ -n "${IP6_ADDR}" ]; then sed -i '' "s/interface = .*/&\n ip6.addr += ${_if}|${_ip};/" ${_jail_config} else @@ -674,7 +671,7 @@ case "${ACTION}" in if [ "${AUTO}" -eq 1 ]; then bastille start "${TARGET}" fi - elif [ "${CLASSIC}" -eq 1 ]; then + elif [ "${STANDARD}" -eq 1 ]; then if [ "$(bastille config ${TARGET} get vnet)" != "not set" ]; then error_exit "[ERROR]: ${TARGET} is a VNET jail." else From a331985687d7d9ba92cc71cc6ac3e6c859d03ed1 Mon Sep 17 00:00:00 2001 From: tschettervictor <85497460+tschettervictor@users.noreply.github.com> Date: Mon, 16 Jun 2025 11:12:41 -0600 Subject: [PATCH 2/4] Update network.rst --- docs/chapters/subcommands/network.rst | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/chapters/subcommands/network.rst b/docs/chapters/subcommands/network.rst index 077d632b..06a9f195 100644 --- a/docs/chapters/subcommands/network.rst +++ b/docs/chapters/subcommands/network.rst @@ -7,7 +7,8 @@ You can only add an interface once to a jail, with two exceptions. 1. For classic jails, you can add an interface as many times as you want, but each time with a different IP. All this does is add the IP as another alias - on that interface. + on that interface. This is the default if no option is given. See help output + below. 2. For VNET jails, if the ``-v|--vlan`` switch is given along with a numerical VLAN ID, Bastille will add the VLAN ID to the jail as a vnetX.X interface, @@ -16,6 +17,8 @@ You can only add an interface once to a jail, with two exceptions. Bridges and VNET interfaces can be added to VNET jails, no matter if they were created with ``-V`` or ``-B``. +If no option is given, Bastille will assume a standard/classic jail. + It is possible to passthrough an entire interface from the host to the jail using the ``-P|--passthrough`` option. This will make the interface fully available without the need for additional configuration. It will be available @@ -38,11 +41,10 @@ network TARGET remove INTERFACE`` while both jails are stopped. Options: -a | --auto Start/stop the jail(s) if required. - -B | --bridge Add a bridged VNET interface to an existing jail. - -C | --classic Add an interface to a classic (non-VNET) jail. - -M | --static-mac Generate a static MAC address for the interface. + -B | --bridge Add a bridge VNET interface to an existing jail. + -M | --static-mac Generate a static MAC address for the interface (VNET only). -n | --no-ip Create interface without an IP (VNET only). - -P | --passthrough Pass the entire interface through to the jail. + -P | --passthrough Pass entire interface to jail. -V | --vnet Add a VNET interface to an existing jail. -v | --vlan VLANID Add interface with specified VLAN ID (VNET only). -x | --debug Enable debug mode. \ No newline at end of file From 3eb1deb5efec4c9706e5d8db0148d38bcd0d77ab Mon Sep 17 00:00:00 2001 From: tschettervictor <85497460+tschettervictor@users.noreply.github.com> Date: Mon, 16 Jun 2025 11:17:29 -0600 Subject: [PATCH 3/4] Update network.sh --- usr/local/share/bastille/network.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/usr/local/share/bastille/network.sh b/usr/local/share/bastille/network.sh index 47028a38..ac9de8ae 100644 --- a/usr/local/share/bastille/network.sh +++ b/usr/local/share/bastille/network.sh @@ -39,13 +39,13 @@ usage() { Options: - -a | --auto Start/stop the jail(s) if required. - -B | --bridge Add a bridged VNET interface to an existing jail. - -M | --static-mac Generate a static MAC address for the interface. + -a | --auto Start/stop jail(s) if required. + -B | --bridge Add a bridge VNET interface. + -M | --static-mac Generate a static MAC address for the interface (VNET only). -n | --no-ip Create interface without an IP (VNET only). - -P | --passthrough Pass the entire interface through to the jail. - -V | --vnet Add a VNET interface to an existing jail. - -v | --vlan VLANID Add interface with specified VLAN ID (VNET only). + -P | --passthrough Add a raw interface. + -V | --vnet Add a VNET interface. + -v | --vlan VLANID Assign VLAN ID to interface (VNET only). -x | --debug Enable debug mode. EOF From 6d5ce7674ba401ecd525dbf5713feca4d631fc34 Mon Sep 17 00:00:00 2001 From: tschettervictor <85497460+tschettervictor@users.noreply.github.com> Date: Mon, 16 Jun 2025 11:18:52 -0600 Subject: [PATCH 4/4] Update network.rst --- docs/chapters/subcommands/network.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/chapters/subcommands/network.rst b/docs/chapters/subcommands/network.rst index 06a9f195..a31f1892 100644 --- a/docs/chapters/subcommands/network.rst +++ b/docs/chapters/subcommands/network.rst @@ -40,11 +40,11 @@ network TARGET remove INTERFACE`` while both jails are stopped. Options: - -a | --auto Start/stop the jail(s) if required. - -B | --bridge Add a bridge VNET interface to an existing jail. + -a | --auto Start/stop jail(s) if required. + -B | --bridge Add a bridge VNET interface. -M | --static-mac Generate a static MAC address for the interface (VNET only). -n | --no-ip Create interface without an IP (VNET only). - -P | --passthrough Pass entire interface to jail. - -V | --vnet Add a VNET interface to an existing jail. - -v | --vlan VLANID Add interface with specified VLAN ID (VNET only). + -P | --passthrough Add a raw interface. + -V | --vnet Add a VNET interface. + -v | --vlan VLANID Assign VLAN ID to interface (VNET only). -x | --debug Enable debug mode. \ No newline at end of file