]> git.proxmox.com Git - pmg-docs.git/blame - gen-pmg.conf.5-opts.pl
update screenshots for PMG 6.1
[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,
4ea3a203
SI
40 before_queue_filtering => 1,
41 ndr_on_block => 1,
e3d778e0 42 }],
cbb2b879
DM
43 'mail-tls' => [
44 'mail' , {
45 tls => 1,
46 tlsheader => 1,
47 tlslog => 1,
48 }],
d9c56b22
DM
49 'mail-ports' => [
50 'mail' , {
51 int_port => 1,
52 ext_port => 1,
53 }],
e09057ab
DM
54 'mail-relaying' => [
55 'mail' , {
56 relay => 1,
57 relaynomx => 1,
58 relayport => 1,
59 smarthost => 1,
851283b1 60 smarthostport => 1,
e09057ab 61 }],
20522d96
SI
62 'admin-dkim' => [
63 'admin' , {
64 dkim_selector => 1,
65 dkim_sign => 1,
66 dkim_sign_all_mail => 1,
67 }],
e09057ab
DM
68};
69
cbb2b879
DM
70if (1) {
71 # verify if we document all mail settings
72 my $plugin = PMG::Config::Base->lookup('mail');
73 my $schema = $plugin->updateSchema(1);
74 my $properties = $schema->{properties};
75
76 my $found_mail_keys = {};
77 foreach my $group (keys %$key_groups) {
78 my ($sec, $hash) = @{$key_groups->{$group}};
79 next if $sec ne 'mail';
80 foreach my $k (keys %$hash) {
81 die "unknown key '$k'" if !defined($properties->{$k});
82 $found_mail_keys->{$k} = 1;
83 }
84 }
85 foreach my $k (keys %$properties) {
86 next if $skiped_keys->{$k};
87 next if $k =~ m/^max_(filters|policy|smtpd_in|smtpd_out)$/;
88 die "undocumented key '$k'" if !defined($found_mail_keys->{$k});
89 }
90}
91
92
e09057ab
DM
93my $select_keys;
94
95if ($single_section) {
96 if (my $a = $key_groups->{$single_section}) {
97 my ($sec, $hash) = @$a;
98 $single_section = $sec;
99 $select_keys = $hash;
100 }
101}
102
103
f872534d
DM
104foreach my $section (@$types) {
105 my $plugin = PMG::Config::Base->lookup($section);
106 my $schema = $plugin->updateSchema(1);
107 my $properties = $schema->{properties};
7608b70c
DM
108
109 if (defined($single_section)) {
110 next if $section ne $single_section;
111 } else {
112 print ".Section '$section'\n\n";
113 }
114
115 $found = 1;
a18c67c0
DM
116
117 my $filter = sub {
118 my ($key, $phash) = @_;
cbb2b879 119 return 1 if $skiped_keys->{$key};
e09057ab 120 return 1 if $select_keys && !$select_keys->{$key};
a18c67c0
DM
121 return 0;
122 };
f872534d 123
a18c67c0
DM
124 print PVE::RESTHandler::dump_properties(
125 $properties, 'asciidoc', 'config', $filter);
f872534d 126}
7608b70c
DM
127
128if (defined($single_section)) {
129 die "no such section '$single_section'" if !$found;
130}
f872534d
DM
131
132exit(0);