diff options
author | Antoine Ginies <aginies@mandriva.com> | 2005-06-03 07:56:29 +0000 |
---|---|---|
committer | Antoine Ginies <aginies@mandriva.com> | 2005-06-03 07:56:29 +0000 |
commit | d58af00bbcd88137b799c7bb15cb6070e4fdfcf3 (patch) | |
tree | 9bbb0857c56e5b05eb477773bbbb8fe352ce848d | |
parent | 03eaacb92b290ec75dd31979cc9a1c1723759566 (diff) | |
download | drakwizard-d58af00bbcd88137b799c7bb15cb6070e4fdfcf3.tar drakwizard-d58af00bbcd88137b799c7bb15cb6070e4fdfcf3.tar.gz drakwizard-d58af00bbcd88137b799c7bb15cb6070e4fdfcf3.tar.bz2 drakwizard-d58af00bbcd88137b799c7bb15cb6070e4fdfcf3.tar.xz drakwizard-d58af00bbcd88137b799c7bb15cb6070e4fdfcf3.zip |
add needed var to setup a main and a relay server
-rwxr-xr-x | postfix_wizard/Postfix.pm | 148 |
1 files changed, 115 insertions, 33 deletions
diff --git a/postfix_wizard/Postfix.pm b/postfix_wizard/Postfix.pm index f4e4fbae..89ed6fbc 100755 --- a/postfix_wizard/Postfix.pm +++ b/postfix_wizard/Postfix.pm @@ -39,21 +39,53 @@ my $postfix = new Libconf::Glueconf::Postfix::Main_cf({ filename => '/etc/postfi my $wiz = new MDK::Wizard::Wizcommon; my $wiz_domain_name = $wiz->{net}->network_get("DOMAINNAME"); my $wiz_host_name = $wiz->{net}->network_get("HOSTNAME"); - +my $wiz_postfix_etc = "/etc/sysconfig/wizard_postfix"; my $o = { name => N("Postfix wizard"), var => { - wiz_mail_masquerade => '', - wiz_ext_mail_relay => '', wiz_myhostname => '', - wiz_mydomain => '', - wiz_inet_interfaces => '', - wiz_mynetworks_style => '', - wiz_smtpd_banner => '', + wiz_mydomain => '', + wiz_myorigin => '', wiz_inet_interfaces => '', wiz_mydestination => '', - wiz_myorigin => '', + wiz_mynetworks => '', + + wiz_smtpd_helo_required => '', + wiz_disable_vrfy_command = '', + + wiz_smtpd_recipient_restrictions => '', + wiz_smtpd_data_restrictions => '', + + wiz_maximal_queue_lifetime => '', + wiz_message_size_limit => '', + wiz_smtpd_banner => '', + + wiz_debug_peer_level => '', + wiz_debugger_command => '', + wiz_delay_warning_time => '', + + wiz_sendmail_path => '', + wiz_newaliases_path => '', + wiz_mailq_path => '', + wiz_setgid_group => '', + wiz_manpage_directory => '', + wiz_sample_directory => '', + wiz_readme_directory => '', + + wiz_masquerade_domains => '', + wiz_default_destination_concurrency_limit => '', + wiz_default_destination_recipient_limit => '', + wiz_content_filter => '', + wiz_smtp-amavis_destination_concurrency_limit => '', + wiz_html_directory => '', + wiz_content_filter => '', + wiz_receive_override_options => '', + + wiz_mail_masquerade => '', + wiz_ext_mail_relay => '', + wiz_relayhost => '', + wiz_relay_domains => '', }, init => sub { check_sendmail(); @@ -68,44 +100,56 @@ my $o = { }; -my %level = ( - 1 => N("External mail server"), - 2 => N("Internal mail server"), +my %type = ( + 1 => N("Main mail server"), + 2 => N("Relay mail server"), ); $o->{pages} = { welcome => { - name => N("Internet mail configuration wizard") . "\n\n" . N("This wizard will help you configure an internal mail server for your network, or configure an external mail server."), + name => N("Internet mail configuration wizard") . "\n\n" . N("This wizard will help you configure an mail server for your network, or configure an mail relay."), no_back => 1, pre => sub { - $o->{var}{wiz_level} ||= 1; - $o->{var}{wiz_mail_masquerade} ||= $postfix->{masquerade_domains}; - $o->{var}{wiz_ext_mail_relay} = $postfix->{ext_mail_relay}; - $o->{var}{wiz_myhostname} ||= $postfix->{myhostname}; - $o->{var}{wiz_mydomain} ||= $postfix->{mydomain}; - $o->{var}{wiz_inet_interfaces} ||= $postfix->{inet_interfaces}; - $o->{var}{wiz_mynetworks_style} ||= $postfix->{mynetworks_style}; - $o->{var}{wiz_smtpd_banner} ||= $postfix->{smtpd_banner}; - $o->{var}{wiz_mydestination} ||= $postfix->{mydestination}; - $o->{var}{wiz_myorigin} ||= $postfix->{myorigin}; - }, + 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 } + }, post => sub { - if ($o->{var}{wiz_level} == 2) { - return 'originext' } + if ($o->{var}{wiz_type} == 2) { + return 'main_server' }; + else { + return 'relay_server'; + } }, data => [ { label => N("What do you want to do:"), val => \$o->{var}{wiz_level}, list => [ keys %level ], format => sub { $level{$_[0]} } }, ], - next => 'external', + next => 'relay_server', }, - external => { - name => N("Outgoing mail address") . "\n\n" . N("You can select the kind of address that outgoing mail will show in the \"From:\" and \"Reply-to\" field.") . "\n\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."), - complete => sub { - if ($o->{var}{wiz_mail_masquerade} !~ /\w+\.\w+$/) { - $::in->ask_warn(N("Error"), N("Masquerade should be a valid domain name such as \"mydomain.com\"!")); - return 1; - } else { return 0; }; + main_server => { + name => N("Mail server") . "\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 { + $o->{var}{wiz_level} ||= 1; + $o->{var}{wiz_mail_masquerade} ||= $postfix->{masquerade_domains}; + $o->{var}{wiz_ext_mail_relay} = $postfix->{ext_mail_relay}; + $o->{var}{wiz_myhostname} ||= $postfix->{myhostname}; + $o->{var}{wiz_mydomain} ||= $postfix->{mydomain}; + $o->{var}{wiz_inet_interfaces} ||= $postfix->{inet_interfaces}; + $o->{var}{wiz_mynetworks_style} ||= $postfix->{mynetworks_style}; + $o->{var}{wiz_smtpd_banner} ||= $postfix->{smtpd_banner}; + $o->{var}{wiz_mydestination} ||= $postfix->{mydestination}; + $o->{var}{wiz_myorigin} ||= $postfix->{myorigin}; + }, + complete => sub { + if ($o->{var}{wiz_mail_masquerade} !~ /\w+\.\w+$/) { + $::in->ask_warn(N("Error"), N("Masquerade should be a valid domain name such as \"mydomain.com\"!")); + return 1; + } else { return 0; }; }, data => [ { label => N("Masquerade domain name:"), val => \$o->{var}{wiz_mail_masquerade} }, @@ -185,6 +229,44 @@ sub check_sendmail { undef $w; } +sub postfix_options { + $postfix->{myhostname} and $o->{var}{wiz_myhostname} = $postfix->{myhostname}; +wiz_mydomain + wiz_myorigin + wiz_inet_interfaces + wiz_mydestination + wiz_mynetworks + wiz_smtpd_helo_required + wiz_disable_vrfy_command + wiz_smtpd_recipient_restrictions + wiz_smtpd_data_restrictions + wiz_maximal_queue_lifetime + wiz_message_size_limit + wiz_smtpd_banner + wiz_debug_peer_level + wiz_debugger_command + wiz_delay_warning_time + wiz_sendmail_path + wiz_newaliases_path + wiz_mailq_path + wiz_setgid_group + wiz_manpage_directory + wiz_sample_directory + wiz_readme_directory + wiz_masquerade_domains + wiz_default_destination_concurrency_limit + wiz_default_destination_recipient_limit + wiz_content_filter + wiz_smtp-amavis_destination_concurrency_limit + wiz_html_directory + wiz_content_filter + wiz_receive_override_options + wiz_mail_masquerade + wiz_ext_mail_relay + wiz_relayhost + wiz_relay_domains +} + sub check_relay { $o->{var}{wiz_ext_mail_relay} or return 'warning'; |