install gen-vzdump.conf.5-opts.pl
[pve-docs.git] / gen-pve-firewall-macros-adoc.pl
1 #!/usr/bin/perl
2
3 use lib '.';
4 use strict;
5 use warnings;
6
7 use PVE::Firewall;
8
9 my ($pve_fw_parsed_macros, $pve_fw_macro_descr) = PVE::Firewall::get_macros();
10
11 #use Data::Dumper;
12 #print Dumper($pve_fw_macro_descr);
13 #print Dumper($pve_fw_parsed_macros);
14
15 foreach my $name (sort keys %$pve_fw_parsed_macros) {
16 my $descr = $pve_fw_macro_descr->{$name};
17 die "no description for macro '$name'" if !defined($descr);
18 print "[horizontal]\n'$name':: $descr\n\n";
19
20 print "[width=\"100%\",options=\"header\"]\n" .
21 "|===========================================================\n" .
22 "|Action|proto|dport|sport\n";
23
24 my $rules = $pve_fw_parsed_macros->{$name};
25
26 foreach my $rule (@$rules) {
27 print "|$rule->{action}|";
28 print (($rule->{proto} || '') . '|');
29 print (($rule->{dport} || '') . '|');
30 print (($rule->{sport} || '') . "\n");
31 }
32
33 print "|===========================================================\n";
34
35 print "\n";
36 }