echo escape
This commit is contained in:
parent
0bf8539909
commit
f0fabd4f9b
@ -10,8 +10,8 @@ services:
|
|||||||
- /bin/bash
|
- /bin/bash
|
||||||
- /etc/fail2ban/entrypoint.sh
|
- /etc/fail2ban/entrypoint.sh
|
||||||
volumes:
|
volumes:
|
||||||
- ./fail2ban/entrypoint.sh:/etc/fail2ban/entrypoint.sh
|
- ./fail2ban/entrypoint.sh:/etc/fail2ban/entrypoint.sh:ro
|
||||||
- ./fail2ban/sshd_config:/etc/ssh/sshd_config
|
- ./fail2ban/sshd_config:/etc/ssh/sshd_config:ro
|
||||||
ports:
|
ports:
|
||||||
- 22:22/tcp
|
- 22:22/tcp
|
||||||
- 2222:2222/tcp
|
- 2222:2222/tcp
|
||||||
|
@ -12,19 +12,19 @@ REMOTE_IP=\"\$1\"
|
|||||||
SENDER_MAIL=\"\$2\"
|
SENDER_MAIL=\"\$2\"
|
||||||
DEST_MAIL=\"\$3\"
|
DEST_MAIL=\"\$3\"
|
||||||
LOGFILE=\"\$4\"
|
LOGFILE=\"\$4\"
|
||||||
DATE=\$\(date\)
|
DATE=\$(date)
|
||||||
WHOIS_OUTPUT=\$\(whois \$REMOTE_IP\)
|
WHOIS_OUTPUT=\$(whois \$REMOTE_IP)
|
||||||
REVERSE_IP=\$\(echo \$REMOTE_IP | awk 'BEGIN{FS=\".\";ORS=\".\"} {for \(i = NF; i > 0; i--\){print \$i}}'\)
|
REVERSE_IP=\$(echo \$REMOTE_IP | awk 'BEGIN{FS=\".\";ORS=\".\"} {for (i = NF; i > 0; i--){print \$i}}')
|
||||||
LOG_LINES=\$\(grep \$REMOTE_IP \$LOGFILE\)
|
LOG_LINES=\$(grep \$REMOTE_IP \$LOGFILE)
|
||||||
BANNED_IP_PATH=\"/var/tmp/fail2ban_banned_ips\"
|
BANNED_IP_PATH=\"/var/tmp/fail2ban_banned_ips\"
|
||||||
|
|
||||||
# Skip sending email when an email was already sent out for that IP the last 24hours
|
# Skip sending email when an email was already sent out for that IP the last 24hours
|
||||||
if ! [ -d \$BANNED_IP_PATH ]; then mkdir \$BANNED_IP_PATH; else find \${BANNED_IP_PATH}/ -mtime +30 -type f -delete; fi
|
if ! [ -d \$BANNED_IP_PATH ]; then mkdir \$BANNED_IP_PATH; else find \${BANNED_IP_PATH}/ -mtime +30 -type f -delete; fi
|
||||||
if [ -n \"\$\(find \${BANNED_IP_PATH}/\$REMOTE_IP -mtime -1 2>/dev/null\)\" ]; then exit 0; else touch \${BANNED_IP_PATH}/\$REMOTE_IP; fi
|
if [ -n \"\$(find \${BANNED_IP_PATH}/\$REMOTE_IP -mtime -1 2>/dev/null)\" ]; then exit 0; else touch \${BANNED_IP_PATH}/\$REMOTE_IP; fi
|
||||||
|
|
||||||
# Get the Abuse email address from Abusix
|
# Get the Abuse email address from Abusix
|
||||||
if DNS_REPLY=\$\(host -t TXT \${REVERSE_IP}abuse-contacts.abusix.org\); then
|
if DNS_REPLY=\$(host -t TXT \${REVERSE_IP}abuse-contacts.abusix.org); then
|
||||||
ABUSE_ADDR=\$\(echo \$DNS_REPLY | grep -Eio '\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b' | paste -sd \",\"\)
|
ABUSE_ADDR=\$(echo \$DNS_REPLY | grep -Eio '\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b' | paste -sd \",\")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Send email
|
# Send email
|
||||||
@ -44,7 +44,7 @@ WHOIS report FYI:
|
|||||||
|
|
||||||
Thanks for your time and curiosity... take care with botnets...
|
Thanks for your time and curiosity... take care with botnets...
|
||||||
- ANTIBOTNET SYSTEM -
|
- ANTIBOTNET SYSTEM -
|
||||||
together will do a better and free world :-\)
|
together will do a better and free world :-)
|
||||||
from postmaster@$DOMAIN
|
from postmaster@$DOMAIN
|
||||||
by www.$DOMAIN\"
|
by www.$DOMAIN\"
|
||||||
fi" > fail2ban_abuse_mail.sh
|
fi" > fail2ban_abuse_mail.sh
|
||||||
|
Loading…
Reference in New Issue
Block a user