Skip to content

Instantly share code, notes, and snippets.

@lesstif
Last active April 24, 2019 17:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lesstif/13e25000cd3da46fd1852771af11668e to your computer and use it in GitHub Desktop.
Save lesstif/13e25000cd3da46fd1852771af11668e to your computer and use it in GitHub Desktop.
confluence login attacker block
#!/bin/bash
## login.action 을 호출한 IP 중에 차단 제외 ip
MYIP=180.68.199.167
## apache httpd 일 경우 변경 필요
BLACKLIST=$(grep -h login.action /var/log/nginx/*.access.log |awk '{print $1}'|grep -v ${MYIP} |sort |uniq)
## firewall zone
ZONE=dmz
for ip in ${BLACKLIST}; do
CMD="firewall-cmd --zone=${ZONE} --add-rich-rule='rule family=\"ipv4\" source address=\"${ip}\" drop'"
echo "${CMD} --permanent" | bash -x
echo ""
RELOAD="firewall-cmd --reload"
echo "${RELOAD}" | bash -x
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment