diff --git a/config/action.d/ufw.conf b/config/action.d/ufw.conf index d2f731f2..b47fa7e7 100644 --- a/config/action.d/ufw.conf +++ b/config/action.d/ufw.conf @@ -13,17 +13,26 @@ actionstop = actioncheck = -actionban = [ -n "" ] && app="app " - ufw insert from to $app +# ufw does "quickly process packets for which we already have a connection" in before.rules, +# therefore all related sockets should be closed +# actionban is using `ss` to do so, this only handles IPv4 and IPv6. -actionunban = [ -n "" ] && app="app " - ufw delete from to $app +actionban = if [ -n "" ] && ufw app info "" + then + ufw prepend from to app "" comment "" + else + ufw prepend from to comment "" + fi + ss -K dst [] + +actionunban = if [ -n "" ] && ufw app info "" + then + ufw delete from to app "" + else + ufw delete from to + fi [Init] -# Option: insertpos -# Notes.: The position number in the firewall list to insert the block rule -insertpos = 1 - # Option: blocktype # Notes.: reject or deny blocktype = reject