18 lines
375 B
Bash
18 lines
375 B
Bash
#!/bin/bash
|
|
# Stage a fail2ban ban for later promotion to the shared-bans repo.
|
|
# Args: <ip> <jail-name> <match-string> <staging-dir>
|
|
set -uo pipefail
|
|
|
|
IP="$1"
|
|
JAIL="$2"
|
|
MATCH="$3"
|
|
STAGING="$4"
|
|
|
|
mkdir -p "$STAGING"
|
|
ts=$(date -u +%Y-%m-%dT%H:%M:%SZ)
|
|
{
|
|
echo "# fail2ban ban at $ts jail=$JAIL match=$MATCH"
|
|
echo "$IP"
|
|
} >> "$STAGING/bans.txt"
|
|
chmod 0644 "$STAGING/bans.txt"
|