mirror of
https://github.com/buildplan/du_setup.git
synced 2025-12-17 09:45:26 +00:00
commit
d24ec53084
@ -7,7 +7,7 @@
|
||||
|
||||
-----
|
||||
|
||||
**Version:** v0.78.1
|
||||
**Version:** v0.78.2
|
||||
|
||||
**Last Updated:** 2025-11-25
|
||||
|
||||
@ -87,12 +87,12 @@ sha256sum du_setup.sh
|
||||
|
||||
Compare the output hash to the one below. They must match exactly.
|
||||
|
||||
`c43b738b6231ed02427d6c885a9f57d2fd56c4e992ab00ef6a89bd4938caef1a`
|
||||
`d18f20d612eb9d2c8c8faac2cc3bdb6acf7d85860f5a4c93a0953284aa89c820`
|
||||
|
||||
Or echo the hash to check, it should output: `du_setup.sh: OK`
|
||||
|
||||
```bash
|
||||
echo c43b738b6231ed02427d6c885a9f57d2fd56c4e992ab00ef6a89bd4938caef1a du_setup.sh | sha256sum --check
|
||||
echo d18f20d612eb9d2c8c8faac2cc3bdb6acf7d85860f5a4c93a0953284aa89c820 du_setup.sh | sha256sum --check
|
||||
```
|
||||
|
||||
### 3. Run the Script
|
||||
|
||||
25
du_setup.sh
25
du_setup.sh
@ -1,8 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Debian and Ubuntu Server Hardening Interactive Script
|
||||
# Version: 0.78.1 | 2025-11-25
|
||||
# Version: 0.78.2 | 2025-11-25
|
||||
# Changelog:
|
||||
# - v0.78.2: In configure_system set choosen hostname from collect_config in the /etc/hosts
|
||||
# - v0.78.1: Collect config failure fixed on IPv6 only VPS.
|
||||
# - v0.78: Script tries to handles different environments: Direct Public IP, NAT/Router and Local VM only
|
||||
# The configure_ssh function provides context-aware instructions based on different environments.
|
||||
@ -90,7 +91,7 @@
|
||||
set -euo pipefail
|
||||
|
||||
# --- Update Configuration ---
|
||||
CURRENT_VERSION="0.78.1"
|
||||
CURRENT_VERSION="0.78.2"
|
||||
SCRIPT_URL="https://raw.githubusercontent.com/buildplan/du_setup/refs/heads/main/du_setup.sh"
|
||||
CHECKSUM_URL="${SCRIPT_URL}.sha256"
|
||||
|
||||
@ -245,7 +246,7 @@ print_header() {
|
||||
printf '%s\n' "${CYAN}╔═════════════════════════════════════════════════════════════════╗${NC}"
|
||||
printf '%s\n' "${CYAN}║ ║${NC}"
|
||||
printf '%s\n' "${CYAN}║ DEBIAN/UBUNTU SERVER SETUP AND HARDENING SCRIPT ║${NC}"
|
||||
printf '%s\n' "${CYAN}║ v0.78.1 | 2025-11-25 ║${NC}"
|
||||
printf '%s\n' "${CYAN}║ v0.78.2 | 2025-11-25 ║${NC}"
|
||||
printf '%s\n' "${CYAN}║ ║${NC}"
|
||||
printf '%s\n' "${CYAN}╚═════════════════════════════════════════════════════════════════╝${NC}"
|
||||
printf '\n'
|
||||
@ -3172,15 +3173,23 @@ configure_system() {
|
||||
if [[ $(hostnamectl --static) != "$SERVER_NAME" ]]; then
|
||||
hostnamectl set-hostname "$SERVER_NAME"
|
||||
hostnamectl set-hostname "$PRETTY_NAME" --pretty
|
||||
if grep -q "^127.0.1.1" /etc/hosts; then
|
||||
sed -i "s/^127.0.1.1.*/127.0.1.1\t$SERVER_NAME/" /etc/hosts
|
||||
else
|
||||
echo "127.0.1.1 $SERVER_NAME" >> /etc/hosts
|
||||
fi
|
||||
print_success "Hostname configured: $SERVER_NAME"
|
||||
else
|
||||
print_info "Hostname already set to $SERVER_NAME."
|
||||
fi
|
||||
if grep -q "^127.0.1.1" /etc/hosts; then
|
||||
# Check if the line matches the chosen server name; if not, update it
|
||||
if ! grep -q "^127.0.1.1.*$SERVER_NAME" /etc/hosts; then
|
||||
sed -i "s/^127.0.1.1.*/127.0.1.1\t$SERVER_NAME/" /etc/hosts
|
||||
print_info "Updated /etc/hosts to resolve $SERVER_NAME."
|
||||
else
|
||||
print_info "/etc/hosts already resolves $SERVER_NAME correctly."
|
||||
fi
|
||||
else
|
||||
echo "127.0.1.1 $SERVER_NAME" >> /etc/hosts
|
||||
print_info "Added entry to /etc/hosts for $SERVER_NAME."
|
||||
fi
|
||||
|
||||
log "System configuration completed."
|
||||
}
|
||||
|
||||
|
||||
@ -1 +1 @@
|
||||
c43b738b6231ed02427d6c885a9f57d2fd56c4e992ab00ef6a89bd4938caef1a du_setup.sh
|
||||
d18f20d612eb9d2c8c8faac2cc3bdb6acf7d85860f5a4c93a0953284aa89c820 du_setup.sh
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user