]>
Commit | Line | Data |
---|---|---|
f872534d DM |
1 | #!/usr/bin/perl |
2 | ||
3 | use lib '.'; | |
2b6070e7 | 4 | |
f872534d DM |
5 | use strict; |
6 | use warnings; | |
2b6070e7 | 7 | |
f872534d DM |
8 | use PVE::RESTHandler; |
9 | ||
f872534d DM |
10 | use PMG::Config; |
11 | ||
12 | my $types = PMG::Config::Base->lookup_types; | |
13 | ||
7608b70c DM |
14 | my $single_section = shift; |
15 | my $found = 0; | |
16 | ||
cbb2b879 DM |
17 | my $skiped_keys = { |
18 | 'delete' => 1, | |
19 | digest => 1, | |
20 | }; | |
21 | ||
e09057ab | 22 | my $key_groups = { |
e3d778e0 DM |
23 | 'mail-options' => [ |
24 | 'mail' , { | |
25 | maxsize => 1, | |
26 | rejectunknown => 1, | |
27 | rejectunknownsender => 1, | |
28 | helotests => 1, | |
29 | dnsbl_sites => 1, | |
f7bc1420 | 30 | dnsbl_threshold => 1, |
e3d778e0 DM |
31 | verifyreceivers => 1, |
32 | greylist => 1, | |
47f7e1d6 SI |
33 | greylistmask4 => 1, |
34 | greylist6 => 1, | |
35 | greylistmask6 => 1, | |
e3d778e0 DM |
36 | spf => 1, |
37 | hide_received => 1, | |
38 | dwarning => 1, | |
39 | conn_count_limit => 1, | |
40 | conn_rate_limit => 1, | |
41 | message_rate_limit => 1, | |
42 | banner => 1, | |
4ea3a203 SI |
43 | before_queue_filtering => 1, |
44 | ndr_on_block => 1, | |
8682cc57 | 45 | smtputf8 => 1, |
fc3a8a45 | 46 | 'filter-timeout' => 1, |
e3d778e0 | 47 | }], |
cbb2b879 DM |
48 | 'mail-tls' => [ |
49 | 'mail' , { | |
50 | tls => 1, | |
51 | tlsheader => 1, | |
52 | tlslog => 1, | |
53 | }], | |
d9c56b22 DM |
54 | 'mail-ports' => [ |
55 | 'mail' , { | |
56 | int_port => 1, | |
57 | ext_port => 1, | |
58 | }], | |
e09057ab DM |
59 | 'mail-relaying' => [ |
60 | 'mail' , { | |
61 | relay => 1, | |
62 | relaynomx => 1, | |
63 | relayport => 1, | |
2b6070e7 | 64 | relayprotocol => 1, |
e09057ab | 65 | smarthost => 1, |
851283b1 | 66 | smarthostport => 1, |
e09057ab | 67 | }], |
20522d96 SI |
68 | 'admin-dkim' => [ |
69 | 'admin' , { | |
70 | dkim_selector => 1, | |
71 | dkim_sign => 1, | |
72 | dkim_sign_all_mail => 1, | |
0091b1c8 | 73 | 'dkim-use-domain' => 1, |
20522d96 | 74 | }], |
e09057ab DM |
75 | }; |
76 | ||
cbb2b879 DM |
77 | if (1) { |
78 | # verify if we document all mail settings | |
79 | my $plugin = PMG::Config::Base->lookup('mail'); | |
80 | my $schema = $plugin->updateSchema(1); | |
81 | my $properties = $schema->{properties}; | |
82 | ||
83 | my $found_mail_keys = {}; | |
84 | foreach my $group (keys %$key_groups) { | |
85 | my ($sec, $hash) = @{$key_groups->{$group}}; | |
86 | next if $sec ne 'mail'; | |
87 | foreach my $k (keys %$hash) { | |
f475c3fa TL |
88 | if (!defined($properties->{$k})) { |
89 | warn "\n WARNING: unknown key '$k'"; | |
90 | next; | |
91 | } | |
cbb2b879 DM |
92 | $found_mail_keys->{$k} = 1; |
93 | } | |
94 | } | |
95 | foreach my $k (keys %$properties) { | |
96 | next if $skiped_keys->{$k}; | |
97 | next if $k =~ m/^max_(filters|policy|smtpd_in|smtpd_out)$/; | |
f475c3fa TL |
98 | |
99 | if (!defined($found_mail_keys->{$k})) { | |
100 | die "undocumented key '$k'" if !$ENV{PMG_DOCS_IGNORE_MISSING_KEY}; | |
101 | warn "WARNING: undocumented key '$k'\n"; | |
102 | } | |
cbb2b879 DM |
103 | } |
104 | } | |
105 | ||
106 | ||
e09057ab DM |
107 | my $select_keys; |
108 | ||
109 | if ($single_section) { | |
110 | if (my $a = $key_groups->{$single_section}) { | |
111 | my ($sec, $hash) = @$a; | |
112 | $single_section = $sec; | |
113 | $select_keys = $hash; | |
114 | } | |
115 | } | |
116 | ||
117 | ||
f872534d DM |
118 | foreach my $section (@$types) { |
119 | my $plugin = PMG::Config::Base->lookup($section); | |
120 | my $schema = $plugin->updateSchema(1); | |
121 | my $properties = $schema->{properties}; | |
7608b70c DM |
122 | |
123 | if (defined($single_section)) { | |
124 | next if $section ne $single_section; | |
125 | } else { | |
126 | print ".Section '$section'\n\n"; | |
127 | } | |
128 | ||
129 | $found = 1; | |
a18c67c0 DM |
130 | |
131 | my $filter = sub { | |
132 | my ($key, $phash) = @_; | |
cbb2b879 | 133 | return 1 if $skiped_keys->{$key}; |
e09057ab | 134 | return 1 if $select_keys && !$select_keys->{$key}; |
a18c67c0 DM |
135 | return 0; |
136 | }; | |
2b6070e7 | 137 | |
a18c67c0 DM |
138 | print PVE::RESTHandler::dump_properties( |
139 | $properties, 'asciidoc', 'config', $filter); | |
f872534d | 140 | } |
7608b70c DM |
141 | |
142 | if (defined($single_section)) { | |
143 | die "no such section '$single_section'" if !$found; | |
144 | } | |
2b6070e7 | 145 | |
f872534d | 146 | exit(0); |