cleanup...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2024-10-21 21:13:44 +03:00
parent 66b2b7ea7f
commit 39b42883fc
2 changed files with 20 additions and 15 deletions

View File

@ -173,20 +173,17 @@ To finalize the setup run:
make finalize make finalize
``` ```
This will break the ssh connection, reconnect via the WAN port
and reattach to the `tmux` session via:
```shell
tmux a
```
This will This will
- detach the host from any external ports and make it accessible only - Setup firewall rules.
from the internal network.
See: [Architecture](#architecture) and [Bootstrapping](#bootstrapping)
- setup firewall rules.
Note that the firewall will not be enabled, this should be done manually Note that the firewall will not be enabled, this should be done manually
after rule review. after rule review.
- Detach the host from any external ports and make it accessible only
from the internal network.
See: [Architecture](#architecture) and [Bootstrapping](#bootstrapping)
This will break the ssh connection when done, reconnect via the WAN port
to continue (see: [Accessing the host](#accessing-the-host)), or connect
directly to the ADMIN port (DHCP) and ssh into `$HOST_ADMIN_IP` (default: 10.0.0.254).
_Note that the ADMIN port is configured for direct connections only (DHCP), _Note that the ADMIN port is configured for direct connections only (DHCP),

View File

@ -49,6 +49,7 @@ BRIDGES_TPL=${BRIDGES_TPL:-bridges.tpl}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Bootstrap... # Bootstrap...
# cleanup...
if ! [ -z $BOOTSTRAP_CLEAN ] ; then if ! [ -z $BOOTSTRAP_CLEAN ] ; then
@ cp "$INTERFACES"{,.bak} @ cp "$INTERFACES"{,.bak}
@ -61,6 +62,7 @@ if ! [ -z $BOOTSTRAP_CLEAN ] ; then
@ ifreload -a @ ifreload -a
fi fi
fi fi
# clear self to avoid a second deffered execution...
unset -f __finalize unset -f __finalize
} }
@ -74,6 +76,7 @@ if ! [ -z $BOOTSTRAP_CLEAN ] ; then
DFL_DNS=1 DFL_DNS=1
DFL_FIREWALL=SKIP DFL_FIREWALL=SKIP
# NOTE: in general this is non-destructive and can be done inline.
__finalize __finalize
# stage 2: clean -> final # stage 2: clean -> final
@ -86,6 +89,8 @@ if ! [ -z $BOOTSTRAP_CLEAN ] ; then
DFL_DNS=SKIP DFL_DNS=SKIP
DFL_FIREWALL=1 DFL_FIREWALL=1
# NOTE: __finalize is deferred to just before reboot...
REBOOT=1 REBOOT=1
# done # done
@ -112,20 +117,20 @@ fi
#---------------------------------------------------------------------- #----------------------------------------------------------------------
# System... # system...
if xreadYes "# Update system?" UPDATE ; then if xreadYes "# Update system?" UPDATE ; then
@ apt update @ apt update
@ apt upgrade @ apt upgrade
fi fi
# Tools... # tools...
if xreadYes "# Install additional apps?" APPS ; then if xreadYes "# Install additional apps?" APPS ; then
@ apt install ${SOFTWARE[@]} @ apt install ${SOFTWARE[@]}
fi fi
# Bridges... # bridges...
if xreadYes "# Create bridges?" BRIDGES ; then if xreadYes "# Create bridges?" BRIDGES ; then
xread "WAN port: " WAN_PORT xread "WAN port: " WAN_PORT
xread "ADMIN port: " ADMIN_PORT xread "ADMIN port: " ADMIN_PORT
@ -262,11 +267,14 @@ showNotes
echo "# Done." echo "# Done."
if [[ $( type -t __finalize ) == function ]] ; then # finalize...
if [[ $( type -t __finalize ) == "function" ]] ; then
echo "# Finalizing ${INTERFACES}..."
__finalize __finalize
fi fi
# reboot...
if ! [ -z $REBOOT ] ; then if ! [ -z $REBOOT ] ; then
echo "# Rebooting..." echo "# Rebooting..."
@ reboot @ reboot