]> git.proxmox.com Git - pmg-docs.git/blame - gen-pmg.conf.5-opts.pl
add info about attachment quarantine
[pmg-docs.git] / gen-pmg.conf.5-opts.pl
CommitLineData
f872534d
DM
1#!/usr/bin/perl
2
3use lib '.';
4use strict;
5use warnings;
6use PVE::RESTHandler;
7
8use Data::Dumper;
9
10use PMG::Config;
11
12my $types = PMG::Config::Base->lookup_types;
13
7608b70c
DM
14my $single_section = shift;
15my $found = 0;
16
cbb2b879
DM
17my $skiped_keys = {
18 'delete' => 1,
19 digest => 1,
20};
21
e09057ab 22my $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,
33 spf => 1,
34 hide_received => 1,
35 dwarning => 1,
36 conn_count_limit => 1,
37 conn_rate_limit => 1,
38 message_rate_limit => 1,
39 banner => 1,
40 }],
cbb2b879
DM
41 'mail-tls' => [
42 'mail' , {
43 tls => 1,
44 tlsheader => 1,
45 tlslog => 1,
46 }],
d9c56b22
DM
47 'mail-ports' => [
48 'mail' , {
49 int_port => 1,
50 ext_port => 1,
51 }],
e09057ab
DM
52 'mail-relaying' => [
53 'mail' , {
54 relay => 1,
55 relaynomx => 1,
56 relayport => 1,
57 smarthost => 1,
851283b1 58 smarthostport => 1,
e09057ab 59 }],
20522d96
SI
60 'admin-dkim' => [
61 'admin' , {
62 dkim_selector => 1,
63 dkim_sign => 1,
64 dkim_sign_all_mail => 1,
65 }],
e09057ab
DM
66};
67
cbb2b879
DM
68if (1) {
69 # verify if we document all mail settings
70 my $plugin = PMG::Config::Base->lookup('mail');
71 my $schema = $plugin->updateSchema(1);
72 my $properties = $schema->{properties};
73
74 my $found_mail_keys = {};
75 foreach my $group (keys %$key_groups) {
76 my ($sec, $hash) = @{$key_groups->{$group}};
77 next if $sec ne 'mail';
78 foreach my $k (keys %$hash) {
79 die "unknown key '$k'" if !defined($properties->{$k});
80 $found_mail_keys->{$k} = 1;
81 }
82 }
83 foreach my $k (keys %$properties) {
84 next if $skiped_keys->{$k};
85 next if $k =~ m/^max_(filters|policy|smtpd_in|smtpd_out)$/;
86 die "undocumented key '$k'" if !defined($found_mail_keys->{$k});
87 }
88}
89
90
e09057ab
DM
91my $select_keys;
92
93if ($single_section) {
94 if (my $a = $key_groups->{$single_section}) {
95 my ($sec, $hash) = @$a;
96 $single_section = $sec;
97 $select_keys = $hash;
98 }
99}
100
101
f872534d
DM
102foreach my $section (@$types) {
103 my $plugin = PMG::Config::Base->lookup($section);
104 my $schema = $plugin->updateSchema(1);
105 my $properties = $schema->{properties};
7608b70c
DM
106
107 if (defined($single_section)) {
108 next if $section ne $single_section;
109 } else {
110 print ".Section '$section'\n\n";
111 }
112
113 $found = 1;
a18c67c0
DM
114
115 my $filter = sub {
116 my ($key, $phash) = @_;
cbb2b879 117 return 1 if $skiped_keys->{$key};
e09057ab 118 return 1 if $select_keys && !$select_keys->{$key};
a18c67c0
DM
119 return 0;
120 };
f872534d 121
a18c67c0
DM
122 print PVE::RESTHandler::dump_properties(
123 $properties, 'asciidoc', 'config', $filter);
f872534d 124}
7608b70c
DM
125
126if (defined($single_section)) {
127 die "no such section '$single_section'" if !$found;
128}
f872534d
DM
129
130exit(0);