mirror of
https://github.com/buildplan/du_setup.git
synced 2025-12-29 16:14:59 +00:00
Update du_setup.sh
This commit is contained in:
@@ -1182,11 +1182,16 @@ EOF
|
|||||||
echo "$UFW_PROBES_CONFIG" > "$UFW_FILTER_PATH"
|
echo "$UFW_PROBES_CONFIG" > "$UFW_FILTER_PATH"
|
||||||
echo "$JAIL_LOCAL_CONFIG" > "$JAIL_LOCAL_PATH"
|
echo "$JAIL_LOCAL_CONFIG" > "$JAIL_LOCAL_PATH"
|
||||||
|
|
||||||
|
# --- Ensure the log file exists BEFORE restarting the service ---
|
||||||
|
if [[ ! -f /var/log/ufw.log ]]; then
|
||||||
|
touch /var/log/ufw.log
|
||||||
|
print_info "Created empty /var/log/ufw.log to ensure Fail2Ban starts correctly."
|
||||||
|
fi
|
||||||
|
|
||||||
# --- Restart and Verify Fail2ban ---
|
# --- Restart and Verify Fail2ban ---
|
||||||
print_info "Enabling and restarting Fail2Ban to apply new rules..."
|
print_info "Enabling and restarting Fail2Ban to apply new rules..."
|
||||||
systemctl enable fail2ban
|
systemctl enable fail2ban
|
||||||
systemctl restart fail2ban
|
systemctl restart fail2ban
|
||||||
sleep 2 # Give the service a moment to initialize.
|
|
||||||
|
|
||||||
if systemctl is-active --quiet fail2ban; then
|
if systemctl is-active --quiet fail2ban; then
|
||||||
print_success "Fail2Ban is active with the new configuration."
|
print_success "Fail2Ban is active with the new configuration."
|
||||||
|
|||||||
Reference in New Issue
Block a user