11#! /bin/bash
22
33# Debian and Ubuntu Server Hardening Interactive Script
4- # Version: 0.80.3 | 2026-03-03
4+ # Version: 0.80.4 | 2026-03-09
55# Changelog:
6+ # - v0.80.4: Warn and finish the script if Docker, Tailscale and Netbird fail to install properly.
67# - v0.80.3: Warn about password-less sudo and offer to generate password for the user if they choose to do so.
78# Improve SSH service detection for Debian systems.
89# - v0.80.2: Added an optional install of netbird (https://netbird.io/) as an alternative to tailscale.
105106set -euo pipefail
106107
107108# --- Update Configuration ---
108- CURRENT_VERSION=" 0.80.3 "
109+ CURRENT_VERSION=" 0.80.4 "
109110SCRIPT_URL=" https://raw.githubusercontent.com/buildplan/du_setup/refs/heads/main/du_setup.sh"
110111CHECKSUM_URL=" ${SCRIPT_URL} .sha256"
111112
@@ -167,6 +168,11 @@ PREVIOUS_SSH_PORT=""
167168IDS_INSTALLED=" "
168169TWO_FACTOR_ENABLED=" false"
169170
171+ DOCKER_INSTALL_WARN=false
172+ DOCKER_SANITY_WARN=false
173+ TAILSCALE_INSTALL_WARN=false
174+ NETBIRD_INSTALL_WARN=false
175+
170176# --- --help ---
171177show_usage () {
172178 printf " \n"
@@ -264,7 +270,7 @@ print_header() {
264270 printf ' %s\n' " ${CYAN} ╔═════════════════════════════════════════════════════════════════╗${NC} "
265271 printf ' %s\n' " ${CYAN} ║ ║${NC} "
266272 printf ' %s\n' " ${CYAN} ║ DEBIAN/UBUNTU SERVER SETUP AND HARDENING SCRIPT ║${NC} "
267- printf ' %s\n' " ${CYAN} ║ v0.80.3 | 2026-03-03 ║${NC} "
273+ printf ' %s\n' " ${CYAN} ║ v0.80.4 | 2026-03-09 ║${NC} "
268274 printf ' %s\n' " ${CYAN} ║ ║${NC} "
269275 printf ' %s\n' " ${CYAN} ╚═════════════════════════════════════════════════════════════════╝${NC} "
270276 printf ' \n'
@@ -4492,8 +4498,9 @@ install_docker() {
44924498 echo " deb [arch=$( dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/${ID} $( . /etc/os-release && echo " $VERSION_CODENAME " ) stable" > /etc/apt/sources.list.d/docker.list
44934499 print_info " Installing Docker packages..."
44944500 if ! apt-get update -qq || ! apt-get install -y -qq docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin; then
4495- print_error " Failed to install Docker packages."
4496- exit 1
4501+ print_error " Docker package installation failed. Once the script is complete, manually check and install it."
4502+ DOCKER_INSTALL_WARN=true
4503+ return 0
44974504 fi
44984505 print_info " Adding '$USERNAME ' to docker group..."
44994506 getent group docker > /dev/null || groupadd docker
@@ -4553,8 +4560,9 @@ DAEMONFILE
45534560 if sudo -u " $USERNAME " docker run --rm hello-world 2>&1 | tee -a " $LOG_FILE " | grep -q " Hello from Docker" ; then
45544561 print_success " Docker sanity check passed."
45554562 else
4556- print_error " Docker hello-world test failed. Please verify installation."
4557- exit 1
4563+ print_error " Docker hello-world test failed. Please verify installation once the script is complete."
4564+ DOCKER_SANITY_WARN=true
4565+ return 0
45584566 fi
45594567 print_warning " NOTE: '$USERNAME ' must log out and back in to use Docker without sudo."
45604568 log " Docker installation completed."
@@ -4653,6 +4661,7 @@ install_tailscale() {
46534661 print_error " Failed to download the Tailscale installation script."
46544662 print_info " After setup completes, please try installing it manually: curl -fsSL https://tailscale.com/install.sh | sh"
46554663 rm -f /tmp/tailscale_install.sh # Clean up partial download
4664+ TAILSCALE_INSTALL_WARN=true
46564665 return 0 # Exit the function without exiting the main script
46574666 fi
46584667
@@ -4661,6 +4670,7 @@ install_tailscale() {
46614670 print_error " Tailscale installation script failed to execute."
46624671 log " Tailscale installation failed."
46634672 rm -f /tmp/tailscale_install.sh # Clean up
4673+ TAILSCALE_INSTALL_WARN=true
46644674 return 0 # Exit the function gracefully
46654675 fi
46664676
@@ -4859,7 +4869,8 @@ install_netbird() {
48594869 print_info " Adding NetBird repository and installing package..."
48604870 if ! apt-get update -qq || ! apt-get install -y -qq ca-certificates curl gnupg; then
48614871 print_error " Failed to install dependencies for NetBird."
4862- return 1
4872+ NETBIRD_INSTALL_WARN=true
4873+ return 0
48634874 fi
48644875
48654876 curl -sSL https://pkgs.netbird.io/debian/public.key | gpg --dearmor --output /usr/share/keyrings/netbird-archive-keyring.gpg 2> /dev/null
@@ -4868,7 +4879,8 @@ install_netbird() {
48684879 if ! apt-get update -qq || ! apt-get install -y -qq netbird; then
48694880 print_error " Failed to install NetBird package."
48704881 log " NetBird installation failed."
4871- return 1
4882+ NETBIRD_INSTALL_WARN=true
4883+ return 0
48724884 fi
48734885 print_success " NetBird installation complete."
48744886 log " NetBird installation completed."
@@ -6045,6 +6057,18 @@ generate_summary() {
60456057 if [[ ${# FAILED_SERVICES[@]} -gt 0 ]]; then
60466058 print_warning " ACTION REQUIRED: The following services failed: ${FAILED_SERVICES[*]} . Verify with 'systemctl status <service>'."
60476059 fi
6060+ if [[ " ${DOCKER_INSTALL_WARN:- false} " == true ]]; then
6061+ print_warning " ACTION REQUIRED: Docker packages failed to install. Review '$LOG_FILE ' and reinstall Docker manually."
6062+ fi
6063+ if [[ " ${DOCKER_SANITY_WARN:- false} " == true ]]; then
6064+ print_warning " ACTION REQUIRED: Docker sanity check failed. Run 'docker run --rm hello-world' after reboot to verify."
6065+ fi
6066+ if [[ " ${TAILSCALE_INSTALL_WARN:- false} " == true ]]; then
6067+ print_warning " ACTION REQUIRED: Tailscale installation failed. Re-run the official installer and configure Tailscale manually."
6068+ fi
6069+ if [[ " ${NETBIRD_INSTALL_WARN:- false} " == true ]]; then
6070+ print_warning " ACTION REQUIRED: NetBird installation failed. Reinstall NetBird and run 'netbird up' manually."
6071+ fi
60486072 if [[ -n " ${TS_COMMAND:- } " ]]; then
60496073 print_warning " ACTION REQUIRED: Tailscale connection failed. Run the following command to connect manually:"
60506074 printf ' %s\n' " ${CYAN} $TS_COMMAND ${NC} "
0 commit comments