-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
iptables: allow deny_action=TARPIT (#320)
* iptables: allow deny_action=TARPIT * nftables: validate deny_action (must be DROP or REJECT, default DROP) * added log.Trace for consistency
- Loading branch information
Showing
4 changed files
with
82 additions
and
12 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
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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
|
||
import json | ||
|
||
|
||
def test_backend_mode(bouncer, fw_cfg_factory): | ||
cfg = fw_cfg_factory() | ||
|
||
|
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,49 @@ | ||
|
||
def test_iptables_deny_action(bouncer, fw_cfg_factory): | ||
cfg = fw_cfg_factory() | ||
|
||
cfg['log_level'] = 'trace' | ||
cfg['mode'] = 'iptables' | ||
|
||
with bouncer(cfg) as fw: | ||
fw.wait_for_lines_fnmatch([ | ||
"*using 'DROP' as deny_action*", | ||
]) | ||
fw.proc.wait(timeout=0.2) | ||
assert not fw.proc.is_running() | ||
|
||
cfg['deny_action'] = 'drop' | ||
|
||
with bouncer(cfg) as fw: | ||
fw.wait_for_lines_fnmatch([ | ||
"*using 'DROP' as deny_action*", | ||
]) | ||
fw.proc.wait(timeout=0.2) | ||
assert not fw.proc.is_running() | ||
|
||
cfg['deny_action'] = 'reject' | ||
|
||
with bouncer(cfg) as fw: | ||
fw.wait_for_lines_fnmatch([ | ||
"*using 'REJECT' as deny_action*", | ||
]) | ||
fw.proc.wait(timeout=0.2) | ||
assert not fw.proc.is_running() | ||
|
||
cfg['deny_action'] = 'tarpit' | ||
|
||
with bouncer(cfg) as fw: | ||
fw.wait_for_lines_fnmatch([ | ||
"*using 'TARPIT' as deny_action*", | ||
]) | ||
fw.proc.wait(timeout=0.2) | ||
assert not fw.proc.is_running() | ||
|
||
cfg['deny_action'] = 'somethingelse' | ||
|
||
with bouncer(cfg) as fw: | ||
fw.wait_for_lines_fnmatch([ | ||
"*invalid deny_action 'somethingelse', must be one of DROP, REJECT, TARPIT*", | ||
]) | ||
fw.proc.wait(timeout=0.2) | ||
assert not fw.proc.is_running() |