diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2023-11-25 20:21:17 +0100 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2023-11-25 20:21:17 +0100 |
commit | 9b7f4894467d8763419d8c29a49df72ee149be06 (patch) | |
tree | 49b624a19848cdab372cff55bf8d110ee72a858e /7/firewall.pl | |
parent | b239a07aa42d0fcba8cb84c554674c744d872041 (diff) | |
download | prolog-firewall-9b7f4894467d8763419d8c29a49df72ee149be06.tar.gz prolog-firewall-9b7f4894467d8763419d8c29a49df72ee149be06.tar.bz2 prolog-firewall-9b7f4894467d8763419d8c29a49df72ee149be06.tar.xz prolog-firewall-9b7f4894467d8763419d8c29a49df72ee149be06.zip |
Diffstat (limited to '7/firewall.pl')
-rw-r--r-- | 7/firewall.pl | 10 |
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)). |