mirror of
https://github.com/buildplan/du_setup.git
synced 2025-12-29 16:14:59 +00:00
Update setup_harden_debian_ubuntu.sh
This commit is contained in:
@@ -511,7 +511,7 @@ load_config() {
|
|||||||
HOSTNAME="$SERVER_NAME"
|
HOSTNAME="$SERVER_NAME"
|
||||||
fi
|
fi
|
||||||
if [[ "$HOSTNAME" != *.* ]]; then
|
if [[ "$HOSTNAME" != *.* ]]; then
|
||||||
print_warning "Hostname '$HOSTNAME' is not an FQDN. Consider using an FQDN (e.g., $HOSTNAME.mydomain.com) for better compatibility."
|
print_warning "Hostname '$HOSTNAME' is not an FQDN. Consider using an FQDN (e.g., $HOSTNAME.mydomain.com) for better compatibility."
|
||||||
fi
|
fi
|
||||||
if [[ -z "$SSH_PORT" ]]; then
|
if [[ -z "$SSH_PORT" ]]; then
|
||||||
errors+=("Missing SSH_PORT")
|
errors+=("Missing SSH_PORT")
|
||||||
@@ -1412,12 +1412,13 @@ configure_monitoring() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
elif echo "Test email from $(hostname) at $(date)" | mail -s "Test Alert" "$SMTP_TO"; then
|
elif echo "Test email from $(hostname) at $(date)" | mail -s "Test Alert" "$SMTP_TO"; then
|
||||||
sleep 2
|
sleep 2
|
||||||
if tail -n 50 /var/log/mail.log | grep -qE "status=(sent|delivered|completed)"; then
|
if tail -n 50 /var/log/mail.log | grep -qE "status=(sent|delivered|completed)"; then
|
||||||
print_success "SMTP test email sent to $SMTP_TO."
|
print_success "SMTP test email sent to $SMTP_TO."
|
||||||
else
|
else
|
||||||
print_error "Failed to send test email. Check /var/log/mail.log for details."
|
print_error "Failed to send test email. Check /var/log/mail.log for details."
|
||||||
exit 1
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
log "SMTP monitoring configured."
|
log "SMTP monitoring configured."
|
||||||
else
|
else
|
||||||
@@ -1462,6 +1463,7 @@ EOF
|
|||||||
print_success "Monitoring cron job configured."
|
print_success "Monitoring cron job configured."
|
||||||
fi
|
fi
|
||||||
log "Monitoring configuration completed."
|
log "Monitoring configuration completed."
|
||||||
|
}
|
||||||
|
|
||||||
# Install Docker Engine
|
# Install Docker Engine
|
||||||
install_docker() {
|
install_docker() {
|
||||||
@@ -1513,11 +1515,11 @@ install_tailscale() {
|
|||||||
[[ "$TAILSCALE_ACCEPT_DNS" == "yes" ]] && up_args="$up_args --accept-dns=true" || up_args="$up_args --accept-dns=false"
|
[[ "$TAILSCALE_ACCEPT_DNS" == "yes" ]] && up_args="$up_args --accept-dns=true" || up_args="$up_args --accept-dns=false"
|
||||||
[[ "$TAILSCALE_ACCEPT_ROUTES" == "yes" ]] && up_args="$up_args --accept-routes=true" || up_args="$up_args --accept-routes=false"
|
[[ "$TAILSCALE_ACCEPT_ROUTES" == "yes" ]] && up_args="$up_args --accept-routes=true" || up_args="$up_args --accept-routes=false"
|
||||||
if tailscale up $up_args && tailscale status >/dev/null 2>&1; then
|
if tailscale up $up_args && tailscale status >/dev/null 2>&1; then
|
||||||
print_success "Tailscale configured and started."
|
print_success "Tailscale configured and started."
|
||||||
else
|
else
|
||||||
print_error "Failed to configure Tailscale. Check 'tailscale status'."
|
print_error "Failed to configure Tailscale. Check 'tailscale status'."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
print_warning "Tailscale installed but not configured. Run 'sudo tailscale up' manually."
|
print_warning "Tailscale installed but not configured. Run 'sudo tailscale up' manually."
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user