summaryrefslogtreecommitdiff
path: root/7/firewall.pl
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2023-11-25 20:21:17 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2023-11-25 20:21:17 +0100
commit9b7f4894467d8763419d8c29a49df72ee149be06 (patch)
tree49b624a19848cdab372cff55bf8d110ee72a858e /7/firewall.pl
parentb239a07aa42d0fcba8cb84c554674c744d872041 (diff)
downloadprolog-firewall-main.tar.gz
prolog-firewall-main.tar.bz2
prolog-firewall-main.tar.xz
prolog-firewall-main.zip
Diffstat (limited to '7/firewall.pl')
-rw-r--r--7/firewall.pl10
1 files changed, 6 insertions, 4 deletions
diff --git a/7/firewall.pl b/7/firewall.pl
index 7e7b7e7..b1c2a14 100644
--- a/7/firewall.pl
+++ b/7/firewall.pl
@@ -22,7 +22,7 @@
warning(Msg) :-
fw_rule(Host, Attr),
- \+ get_assoc("from", Attr, _),
+ \+ get_assoc(from, Attr, _),
format("Missing 'from' on fw_rule for host '~w', ~w", [Host, Attr], Msg).
rules_from(From, Rules) :-
@@ -30,7 +30,7 @@ rules_from(From, Rules) :-
fw_rule(H, Attr),
(
fw_rule(H, Attr),
- get_assoc("from", Attr, From)
+ get_assoc(from, Attr, From)
),
Rules).
@@ -62,10 +62,12 @@ to_csv(Host, Attrs, Row) :-
get_opt(family, Attrs, Family),
get_opt(src, Attrs, Src),
get_opt(dst, Attrs, Dst),
- Row = [Host, Family, Src, Dst].
+ get_opt(proto, Attrs, Proto),
+ get_opt(port, Attrs, Port),
+ Row = [Host, Family, Src, Dst, Proto, Port].
ansible_firewall(File, Host) :-
format("ansible_firewall: ~s~n", [File]),
findall(Attrs, fw_rule(Host, Attrs), Rules),
maplist(to_csv(Host), Rules, Rows),
- write_csv(File, frame(['host','family','src','dst'], Rows)).
+ write_csv(File, frame(['host','family','src','dst', 'port'], Rows)).