From f8688a89e1670fe2304d620c8b2db06cc9f9ac4e Mon Sep 17 00:00:00 2001 From: Antoine Ginies Date: Mon, 6 Jun 2005 05:40:45 +0000 Subject: various fix --- postfix_wizard/Postfix.pm | 81 ++++++++++++++++++++++++++--------------------- 1 file changed, 45 insertions(+), 36 deletions(-) (limited to 'postfix_wizard') diff --git a/postfix_wizard/Postfix.pm b/postfix_wizard/Postfix.pm index 65147a83..e0c745ba 100755 --- a/postfix_wizard/Postfix.pm +++ b/postfix_wizard/Postfix.pm @@ -114,24 +114,26 @@ $o->{pages} = { name => N("Internet mail configuration wizard") . "\n\n" . N("This wizard will help you configure an Postifx mail server for your network, or a Postfix mail relay."), no_back => 1, pre => sub { + $postfix->{relayhost} and $o->{var}{wiz_type} = 2; if (-f $wiz_postfix_etc) { $::in->ask_warn(N("Information"), N("It seems you previously setup a Postfix server. This wizard will re-read your old configuration, and show you the Postfix server type you choose")); my $data = cat_($wiz_postfix_etc); # detect old Postfix type my ($old_type) = $data =~ /type=(\d)/; $o->{var}{wiz_type} = chomp_($old_type); - } else { $o->{var}{wiz_type} = 2 } + } else { $o->{var}{wiz_type} = 1 } }, data => [ { label => N("What do you want to do:"), val => \$o->{var}{wiz_type}, list => [ keys %type ], format => sub { $type{$_[0]} } }, ], - next => 'understanding', + next => 'global_config', }, understanding => { name => N('Now i need to know your undestanding in Postfix server configuration'), data => [ { label => N("What kind of user are you:"), val => \$o->{var}{wiz_understanding}, list => [ keys %understanding ], format => sub { $understanding{$_[0]} } }, ], + no_back => 1, next => 'global_config', }, global_config => { @@ -143,29 +145,53 @@ $o->{pages} = { $o->{var}{wiz_myorigin} ||= $postfix->{myorigin}; }, post => sub { - if ($o->{var}{wiz_type} == 2) { + if ($o->{var}{wiz_type} == 1) { return 'main_server' ; } else { return 'relay_server'; } }, data => [ - { label => N('Smtpd banner:'), val => $o->{var}{wiz_smtpd_banner}, help => 'You MUST specify $myhostname at the start of the text. That is an RFC requirement. ie: $myhostname ESMTP $mail_name ($mail_version) (Mandriva Linux)' }, - { label => N('Hostname:'), val => $o->{var}{wiz_myhostname}, help => N('The myhostname parameter specifies the internet hostname of this mail system. ie: myhostname = $myhostname') }, - { label => N('Domain:'), val => $o->{var}{wiz_domain}, help => N('The mydomain parameter specifies the local internet domain name. ie: mydomain = $mydomain') }, - { label => N('Origin:'), val => $o->{var}{wiz_myorigin}, help => N('The myorigin parameter specifies the domain that locally-posted mail appears to come from. ie: myorigin = $myhostname') }, + { label => N('Smtpd banner:'), val => \$o->{var}{wiz_smtpd_banner}, help => 'You MUST specify $myhostname at the start of the text. That is an RFC requirement. ie: $myhostname ESMTP $mail_name ($mail_version) (Mandriva Linux)' }, + { label => N('Hostname:'), val => \$o->{var}{wiz_myhostname}, help => N('The myhostname parameter specifies the internet hostname of this mail system. ie: myhostname = $myhostname') }, + { label => N('Domain:'), val => \$o->{var}{wiz_mydomain}, help => N('The mydomain parameter specifies the local internet domain name. ie: mydomain = $mydomain') }, + { label => N('Origin:'), val => \$o->{var}{wiz_myorigin}, help => N('The myorigin parameter specifies the domain that locally-posted mail appears to come from. ie: myorigin = $myhostname') }, ], + complete => sub { + if (!$o->{var}{wiz_smtpd_banner}) { + $::in->ask_warn(N('Error'), N('Please provide an Smtpd banner.')); return 1; } + if (!$o->{var}{wiz_myhostname}) { + $::in->ask_warn(N('Error'), N('You must provide an internet hostname of this mail system.')); return 1; } + if (!$o->{var}{wiz_domain_name}) { + $::in->ask_warn(N('Error'), N('You must specifies the local internet domain name.')); return 1; } + }, }, main_server => { - pre => sub { - $o->{var}{wiz_ext_mail_relay} = $postfix->{ext_mail_relay}; - - }, + name => N('Main Postfix server'), + pre => sub { + $o->{var}{wiz_smtpd_helo_required} ||= $postfix->{smtpd_helo_required}; + $o->{var}{wiz_disable_vrfy_command} ||= $postfix->{disable_vrfy_command}; + smtpd_recipient_restrictions + smtpd_data_restrictions + }, data => [ - + { label => N('helo required:'), val => \$o->{var}{wiz_smtpd_helo_required}, fixed_list => \@yesrorno, help => '' }, + { label => N('Disable verify command:'), val => \$o->{var}{wiz_disable_vrfy_command}, fixed_list => \@yesrorno, help => '' }, ], - next => 'network_config', + next => 'message_config', }, + relay_server => { + name => N('Relay server'), + pre => sub { + $o->{var}{wiz_relayhost} ||= $postfix->{relayhost}; + $postfix->{relay_domains} and $o->{var}{wiz_relay_domains} = $postfix->{relay_domains} or $o->{var}{wiz_relay_domains} = "mydomain.com"; + }, + data => [ + { label => N('Relay host:'), val => \$o->{var}{wiz_relayhost}, help => '192.168.10.13' }, + { label => N('Relay domains:'), val => \$o->{var}{wiz_relay_domains}, help => 'mydomain.com' }, + ], + next => 'message_config', + }, masquerade => { name => N("Masquerade") . "\n" . N("This should be chosen consistently with the address you use for incoming mail.") . "\n\n" . N("Address masquerading is a method to hide all hosts inside a domain behind their mail gateway, and to make it appear as if the mail comes from the gateway itself, instead of from individual machines."), pre => sub { @@ -185,8 +211,11 @@ $o->{pages} = { network_config => { name => N('Network config'), pre => sub { - if ($postfix->{inet_interfaces}) { $o->{var}{wiz_inet_interfaces} = $postfix->{inet_interfaces}; } else { - $o->{var}{wiz_inet_interfaces} = 'all'; } + if ($postfix->{inet_interfaces}) { + $o->{var}{wiz_inet_interfaces} = $postfix->{inet_interfaces}; + } else { + $o->{var}{wiz_inet_interfaces} = 'all'; + } $postfix->{mydestination} and $o->{var}{wiz_mydestination} = $postfix->{mydestination}; $postfix->{mynetworks} and $o->{var}{wiz_mynetworks} = $postfix->{mynetworks}; $o->{var}{wiz_mynetworks_style} ||= $postfix->{mynetworks_style}; @@ -217,17 +246,6 @@ $o->{pages} = { next => 0, end => 1, }, - originext => { - name => N("The myorigin parameter specifies the domain that locally-posted mail appears to come from.") . "\n\n" . N("The default is to append myhostname which is fine for small sites."), - data => [ - { label => N("myorigin:"), val => \$o->{var}{wiz_myorigin} }, - ], - post => sub { - if ($o->{var}{wiz_level} == 2) { - next => 'summary' } - }, - next => 'summaryext', - }, summary_relay => { name => N("Configuring your relay mail server") . "\n\n" . N("The wizard collected the following parameters needed to configure your relay mail server:") . "\n\n" . N("To accept these values, and configure your server, click the next button or use the back button to correct them."), data => [ @@ -244,7 +262,7 @@ $o->{pages} = { next => 'end' }, end => { - name => N("Congratulations") . "\n\n" . N("The wizard successfully configured your Mail server."), + name => N("Congratulations") . "\n\n" . N("The wizard successfully configured your Postfix Mail server."), post => sub { store_postfix_type($o->{var}{wiz_type}); }, @@ -276,10 +294,6 @@ sub check_sendmail { undef $w; } -sub pre_defined_optiosn { - -} - sub postfix_options { $o->{var}{wiz_myhostname} and $postfix->{myhostname} = $o->{var}{wiz_myhostname}; $o->{var}{wiz_mydomain} and $postfix->{mydomain} = $o->{var}{wiz_mydomain}; @@ -326,11 +340,6 @@ EOF append_to_file($wiz_postfix_etc, "type=$type\n"); } -sub check_relay { - $o->{var}{wiz_ext_mail_relay} or return 'warning'; - $o->{var}{wiz_ext_mail_relay} =~ /(\S+)\.(\S+)$/ or return 'warning'; -} - sub save_config { my @conf = qw(/etc/postfix/aliases /etc/postfix/canonical -- cgit v1.2.1