]>
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, | |
73 | }], | |
e09057ab DM |
74 | }; |
75 | ||
cbb2b879 DM |
76 | if (1) { |
77 | # verify if we document all mail settings | |
78 | my $plugin = PMG::Config::Base->lookup('mail'); | |
79 | my $schema = $plugin->updateSchema(1); | |
80 | my $properties = $schema->{properties}; | |
81 | ||
82 | my $found_mail_keys = {}; | |
83 | foreach my $group (keys %$key_groups) { | |
84 | my ($sec, $hash) = @{$key_groups->{$group}}; | |
85 | next if $sec ne 'mail'; | |
86 | foreach my $k (keys %$hash) { | |
f475c3fa TL |
87 | if (!defined($properties->{$k})) { |
88 | warn "\n WARNING: unknown key '$k'"; | |
89 | next; | |
90 | } | |
cbb2b879 DM |
91 | $found_mail_keys->{$k} = 1; |
92 | } | |
93 | } | |
94 | foreach my $k (keys %$properties) { | |
95 | next if $skiped_keys->{$k}; | |
96 | next if $k =~ m/^max_(filters|policy|smtpd_in|smtpd_out)$/; | |
f475c3fa TL |
97 | |
98 | if (!defined($found_mail_keys->{$k})) { | |
99 | die "undocumented key '$k'" if !$ENV{PMG_DOCS_IGNORE_MISSING_KEY}; | |
100 | warn "WARNING: undocumented key '$k'\n"; | |
101 | } | |
cbb2b879 DM |
102 | } |
103 | } | |
104 | ||
105 | ||
e09057ab DM |
106 | my $select_keys; |
107 | ||
108 | if ($single_section) { | |
109 | if (my $a = $key_groups->{$single_section}) { | |
110 | my ($sec, $hash) = @$a; | |
111 | $single_section = $sec; | |
112 | $select_keys = $hash; | |
113 | } | |
114 | } | |
115 | ||
116 | ||
f872534d DM |
117 | foreach my $section (@$types) { |
118 | my $plugin = PMG::Config::Base->lookup($section); | |
119 | my $schema = $plugin->updateSchema(1); | |
120 | my $properties = $schema->{properties}; | |
7608b70c DM |
121 | |
122 | if (defined($single_section)) { | |
123 | next if $section ne $single_section; | |
124 | } else { | |
125 | print ".Section '$section'\n\n"; | |
126 | } | |
127 | ||
128 | $found = 1; | |
a18c67c0 DM |
129 | |
130 | my $filter = sub { | |
131 | my ($key, $phash) = @_; | |
cbb2b879 | 132 | return 1 if $skiped_keys->{$key}; |
e09057ab | 133 | return 1 if $select_keys && !$select_keys->{$key}; |
a18c67c0 DM |
134 | return 0; |
135 | }; | |
2b6070e7 | 136 | |
a18c67c0 DM |
137 | print PVE::RESTHandler::dump_properties( |
138 | $properties, 'asciidoc', 'config', $filter); | |
f872534d | 139 | } |
7608b70c DM |
140 | |
141 | if (defined($single_section)) { | |
142 | die "no such section '$single_section'" if !$found; | |
143 | } | |
2b6070e7 | 144 | |
f872534d | 145 | exit(0); |