Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Workaround for ufw+docker issue: moby/moby#4737
- Loading branch information
Showing
7 changed files
with
52 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/sh | ||
# | ||
# simple shell scrip to work around problems with using ufw+docker | ||
# See https://github.com/moby/moby/issues/4737 | ||
# | ||
# This script is called by the fail2ban jails that monitor docker services. | ||
# It uses "ufw" to insert the (ineffective!) rules into the firewall, | ||
# and in addition makes changes to the DOCKER-USER table to deny the banned | ||
# IP addresses. | ||
# | ||
export PATH=/sbin:/usr/sbin:$PATH | ||
|
||
case "$1" in | ||
ban) | ||
ufw insert 1 deny from "$2" to any | ||
iptables -I DOCKER-USER -p tcp -s "$2" -j DROP | ||
;; | ||
unban) | ||
ufw delete deny from "$2" to any | ||
iptables -D DOCKER-USER -p tcp -s "$2" -j DROP | ||
;; | ||
*) | ||
echo "ERROR: unknown action: $1" | ||
;; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[Definition] | ||
actionstart = | ||
actionstop = | ||
actioncheck = | ||
actionban = /usr/local/bin/ufw-docker-hack ban <ip> | ||
actionunban = /usr/local/bin/ufw-docker-hack unban <ip> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ed6b02f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixes #1 by adding
/usr/local/bin/ufw-docker-hack
which in addition to adding and deleting ban rules byufw
, also adds the same rules to theDOCKER-USER
table.