mirror of
https://github.com/buildplan/du_setup.git
synced 2025-12-29 16:14:59 +00:00
v4 error free tested on D12 & U24.04
This commit is contained in:
@@ -1,21 +1,20 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Debian 12 and Ubuntu Server Hardening Interactive Script
|
# Debian 12 and Ubuntu Server Hardening Interactive Script
|
||||||
# Version: 4-rc4 | 2025-06-28
|
# Version: 4.0 | 2025-06-28
|
||||||
# Changelog:
|
# Changelog:
|
||||||
# - v4.0: Generalized backup configuration to support any rsync-compatible SSH destination, renamed setup_hetzner_backup to setup_backup.
|
# - v4.0: Added automated backup config. Mainly for Hetzner Storage Box but can be used for any rsync/SSH enabled remote solution.
|
||||||
# - v4.0: Added Hetzner Storage Box backup configuration with root SSH key automation, cron job scheduling, ntfy/Discord notifications, and exclude file defaults.
|
# - v3.*: Improvements to script flow and fixed bugs which were found in tests at Oracle Cloud
|
||||||
# - v4.0: Enhanced generate_summary to include backup details (script path, cron schedule, notifications).
|
|
||||||
# - v4.0: Tested on Debian 12, Ubuntu 20.04, 22.04, 24.04, and 24.10 (experimental) at DigitalOcean, Oracle Cloud, Netcup, Hetzner, and local VMs.
|
|
||||||
#
|
#
|
||||||
# Description:
|
# Description:
|
||||||
# This script provisions and hardens a fresh Debian 12 or Ubuntu server with essential security
|
# This script provisions and hardens a fresh Debian 12 or Ubuntu server with essential security
|
||||||
# configurations, user management, SSH hardening, firewall setup, and optional features
|
# configurations, user management, SSH hardening, firewall setup, and optional features
|
||||||
# like Docker and Tailscale. It is designed to be idempotent, safe, and suitable for
|
# like Docker and Tailscale and automated backups to Hetzner storage box or any rsync location.
|
||||||
# production environments.
|
# It is designed to be idempotent, safe.
|
||||||
|
# README at GitHub: https://github.com/buildplan/setup_harden_server
|
||||||
#
|
#
|
||||||
# Prerequisites:
|
# Prerequisites:
|
||||||
# - Run as root on a fresh Debian 12 or Ubuntu server (e.g., sudo ./setup_harden_debian_ubuntu.sh).
|
# - Run as root on a fresh Debian 12 or Ubuntu server (e.g., sudo ./setup_harden_debian_ubuntu.sh or run as root ./setup_harden_debian_ubuntu.sh).
|
||||||
# - Internet connectivity is required for package installation.
|
# - Internet connectivity is required for package installation.
|
||||||
#
|
#
|
||||||
# Usage:
|
# Usage:
|
||||||
@@ -24,7 +23,7 @@
|
|||||||
# Run it: sudo ./setup_harden_debian_ubuntu.sh [--quiet]
|
# Run it: sudo ./setup_harden_debian_ubuntu.sh [--quiet]
|
||||||
#
|
#
|
||||||
# Options:
|
# Options:
|
||||||
# --quiet: Suppress non-critical output for automation.
|
# --quiet: Suppress non-critical output for automation. (Not recommended always best to review all the options)
|
||||||
#
|
#
|
||||||
# Notes:
|
# Notes:
|
||||||
# - The script creates a log file in /var/log/setup_harden_debian_ubuntu_*.log.
|
# - The script creates a log file in /var/log/setup_harden_debian_ubuntu_*.log.
|
||||||
@@ -83,7 +82,7 @@ print_header() {
|
|||||||
echo -e "${CYAN}╔═════════════════════════════════════════════════════════════════╗${NC}"
|
echo -e "${CYAN}╔═════════════════════════════════════════════════════════════════╗${NC}"
|
||||||
echo -e "${CYAN}║ ║${NC}"
|
echo -e "${CYAN}║ ║${NC}"
|
||||||
echo -e "${CYAN}║ DEBIAN/UBUNTU SERVER SETUP AND HARDENING SCRIPT ║${NC}"
|
echo -e "${CYAN}║ DEBIAN/UBUNTU SERVER SETUP AND HARDENING SCRIPT ║${NC}"
|
||||||
echo -e "${CYAN}║ v4-rc4 | 2025-06-28 ║${NC}"
|
echo -e "${CYAN}║ v4.0 | 2025-06-28 ║${NC}"
|
||||||
echo -e "${CYAN}║ ║${NC}"
|
echo -e "${CYAN}║ ║${NC}"
|
||||||
echo -e "${CYAN}╚═════════════════════════════════════════════════════════════════╝${NC}"
|
echo -e "${CYAN}╚═════════════════════════════════════════════════════════════════╝${NC}"
|
||||||
echo
|
echo
|
||||||
@@ -1473,7 +1472,7 @@ generate_summary() {
|
|||||||
print_warning "A reboot is required to apply all changes cleanly."
|
print_warning "A reboot is required to apply all changes cleanly."
|
||||||
if [[ $VERBOSE == true ]]; then
|
if [[ $VERBOSE == true ]]; then
|
||||||
if confirm "Reboot now?" "y"; then
|
if confirm "Reboot now?" "y"; then
|
||||||
print_info "Rebooting now..."
|
print_info "Rebooting now, Bye!..."
|
||||||
sleep 3
|
sleep 3
|
||||||
reboot
|
reboot
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user