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