Skip to content

Add ufw blocking action for fail2ban jail #498

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions _fail2ban_addon/action.d/nginxrepeatoffender-ufw.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# action for nginx-ultimate-bad-bot-blocker fail2ban-addon to use ufw as the blocking firewall
# works with ipv4 and ipv6
# to use this change banaction = nginxrepeatoffender in jail.local to banaction = nginxrepeatoffender-ufw
[Definition]

actionstart =
actionstop =
actioncheck =
actionban = [ -n "<application>" ] && app="app <application>"
ufw prepend <blocktype> from <ip> to <destination> $app comment "Fail2Ban Repeated Offender"

actionunban = [ -n "<application>" ] && app="app <application>"
ufw delete <blocktype> from <ip> to <destination> $app

[Init]
# Option: blocktype
# Notes.: reject or deny
blocktype = deny

# Option: destination
# Notes.: The destination address to block in the ufw rule
destination = any

# Option: application
# Notes.: application from sudo ufw app list
application =