diff options
Diffstat (limited to 'postfix_wizard')
-rwxr-xr-x | postfix_wizard/Postfix.pm | 168 |
1 files changed, 90 insertions, 78 deletions
diff --git a/postfix_wizard/Postfix.pm b/postfix_wizard/Postfix.pm index 89ed6fbc..9b17a683 100755 --- a/postfix_wizard/Postfix.pm +++ b/postfix_wizard/Postfix.pm @@ -33,8 +33,8 @@ use Libconf qw(:functions); use Libconf::Glueconf::Postfix::Main_cf; my $postfix = new Libconf::Glueconf::Postfix::Main_cf({ filename => '/etc/postfix/main.cf', }); -#use Data::Dumper; -#print Dumper($postfix); +use Data::Dumper; +print Dumper($postfix); my $wiz = new MDK::Wizard::Wizcommon; my $wiz_domain_name = $wiz->{net}->network_get("DOMAINNAME"); @@ -52,7 +52,7 @@ my $o = { wiz_mynetworks => '', wiz_smtpd_helo_required => '', - wiz_disable_vrfy_command = '', + wiz_disable_vrfy_command => '', wiz_smtpd_recipient_restrictions => '', wiz_smtpd_data_restrictions => '', @@ -77,7 +77,7 @@ my $o = { wiz_default_destination_concurrency_limit => '', wiz_default_destination_recipient_limit => '', wiz_content_filter => '', - wiz_smtp-amavis_destination_concurrency_limit => '', + wiz_smtp_amavis_destination_concurrency_limit => '', wiz_html_directory => '', wiz_content_filter => '', wiz_receive_override_options => '', @@ -121,13 +121,13 @@ $o->{pages} = { }, post => sub { if ($o->{var}{wiz_type} == 2) { - return 'main_server' }; - else { + 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]} } }, + { label => N("What do you want to do:"), val => \$o->{var}{wiz_level}, list => [ keys %type ], format => sub { $type{$_[0]} } }, ], next => 'relay_server', }, @@ -181,27 +181,27 @@ $o->{pages} = { ], post => sub { if ($o->{var}{wiz_level} == 2) { - next => 'summaryint' } + next => 'summary' } }, next => 'summaryext', }, - summaryext => { - name => N("Configuring the external mail server") . "\n\n" . N("The wizard collected the following parameters needed to configure your external 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."), + 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 => [ { label => N("Internet mail gateway:"), fixed_val => \$o->{var}{wiz_ext_mail_relay} }, { label => N("Form of the address:"), fixed_val => \$o->{var}{wiz_mail_masquerade} }, { label => N("myorigin:"), fixed_val => \$o->{var}{wiz_myorigin} }, ], - post => \&do_it_external, - next => 'endext' + post => \&do_it_relay_server, + next => 'end_relay' }, - summaryint => { - name => N("The wizard will now configure an internal mail server."), - post => \&do_it_internal, - next => 'endext' + summary_main => { + name => N("The wizard will now configure your mail server."), + post => \&do_it_main_server, + next => 'end' }, - endext => { - name => N("Congratulations") . "\n\n" . N("The wizard successfully configured your external mail server."), + end_relay => { + name => N("Congratulations") . "\n\n" . N("The wizard successfully configured your relay mail server."), end => 1, next => 0 }, @@ -230,41 +230,53 @@ sub check_sendmail { } 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 + $o->{var}{wiz_myhostname} and $postfix->{myhostname} = $o->{var}{wiz_myhostname}; + $o->{var}{wiz_mydomain} and $postfix->{mydomain} = $o->{var}{wiz_mydomain}; + $o->{var}{wiz_myorigin} and $postfix->{myorigin} = $o->{var}{wiz_myorigin}; + $o->{var}{wiz_inet_interfaces} and $postfix->{inet_interfaces} = $o->{var}{wiz_inet_interfaces}; + $o->{var}{wiz_mydestination} and $postfix->{mydestination} = $o->{var}{wiz_mydestination}; + $o->{var}{wiz_mynetworks} and $postfix->{mynetworks} = $o->{var}{wiz_mynetworks}; + $o->{var}{wiz_smtpd_helo_required} and $postfix->{smtpd_helo_required} = $o->{vawiz_smtpd_helo_required}; + $o->{var}{wiz_disable_vrfy_command} and $postfix->{disable_vrfy_command} = $o->{var}{wiz_disable_vrfy_command}; + $o->{var}{wiz_smtpd_recipient_restrictions} and $postfix->{smtpd_recipient_restrictions} = $o->{var}{wiz_smtpd_recipient_restrictions}; + $o->{var}{wiz_smtpd_data_restrictions} and $postfix->{smtpd_data_restrictions} = $o->{var}{wiz_smtpd_data_restrictions}; + $o->{var}{wiz_maximal_queue_lifetime} and $postfix->{maximal_queue_lifetime} = $o->{var}{wiz_maximal_queue_lifetime}; + $o->{var}{wiz_message_size_limit} and $postfix->{message_size_limit} = $o->{var}{wiz_message_size_limit}; + $o->{var}{wiz_smtpd_banner} and $postfix->{smtpd_banner} = $o->{var}{wiz_smtpd_banner}; + $o->{var}{wiz_debug_peer_level} and $postfix->{debug_peer_level} = $o->{var}{wiz_debug_peer_level}; + $o->{var}{wiz_debugger_command} and $postfix->{debugger_command} = $o->{var}{wiz_debugger_command}; + $o->{var}{wiz_delay_warning_time} and $postfix->{delay_warning_time} = $o->{var}{wiz_delay_warning_time}; + $o->{var}{wiz_sendmail_path} and $postfix->{sendmail_path} = $o->{var}{wiz_sendmail_path}; + $o->{var}{wiz_newaliases_path} and $postfix->{newaliases_path} = $o->{var}{wiz_newaliases_path}; + $o->{var}{wiz_mailq_path} and $postfix->{mailq_path} = $o->{var}{wiz_mailq_path}; + $o->{var}{wiz_setgid_group} and $postfix->{setgid_group} = $o->{var}{wiz_setgid_group}; + $o->{var}{wiz_manpage_directory} and $postfix->{manpage_directory} = $o->{var}{wiz_manpage_directory}; + $o->{var}{wiz_sample_directory} and $postfix->{readme_directory} = $o->{var}{wiz_sample_directory}; + $o->{var}{wiz_readme_directory} and $postfix->{masquerade_domains} = $o->{var}{wiz_readme_directory}; + $o->{var}{wiz_masquerade_domains} and $postfix->{masquerade_domains} = $o->{var}{wiz_masquerade_domains}; + $o->{var}{wiz_default_destination_concurrency_limit} and $postfix->{default_destination_concurrency_limiwiz_default_destination_concurrency_limit} = $o->{var}{wiz_default_destination_concurrency_limit}; + $o->{var}{wiz_default_destination_recipient_limit} and $postfix->{default_destination_recipient_limit} = $o->{var}{wiz_default_destination_recipient_limit}; + $o->{var}{wiz_content_filter} and $postfix->{content_filter} = $o->{var}{wiz_content_filter}; + $o->{var}{wiz_smtp_amavis_destination_concurrency_limit} and $postfix->{wiz_smtp_amavis_destination_concurrency_limit} = $o->{var}{wiz_html_directory}; + $o->{var}{wiz_html_directory} and $postfix->{wiz_html_directory} = $o->{var}{wiz_html_directory}; + $o->{var}{wiz_content_filter} and $postfix->{wiz_content_filter} = $o->{var}{wiz_content_filter}; + $o->{var}{wiz_receive_override_options} and $postfix->{wiz_receive_override_options} = $o->{var}{wiz_receive_override_options}; + $o->{var}{wiz_mail_masquerade} and $postfix->{wiz_mail_masquerade} = $o->{var}{wiz_mail_masquerade}; + $o->{var}{wiz_ext_mail_relay} and $postfix->{wiz_ext_mail_relay} = $o->{var}{wiz_ext_mail_relay}; + $o->{var}{wiz_relayhost} and $postfix->{wiz_relayhost} = $o->{var}{wiz_relayhost}; + $o->{var}{wiz_relay_domains} and $postfix->{wiz_relay_domains} = $o->{var}{wiz_relay_domains}; +} + +sub store_samba_type { +# write config file to store Postfix type + my ($type) = @_; + output($wiz_postfix_etc, <<EOF); +# 1 = Main server +# 2 = Relay +# 3 = mail server + fetchmail +EOF + + append_to_file($wiz_postfix_etc, "type=$type\n"); } @@ -297,7 +309,7 @@ sub cmd_needed { } } -sub do_it_internal { +sub do_it_relay_server { $::testing and return; my $in = 'interactive'->vnew('su', 'postfix configuration'); my $w = $in->wait_message(N("Postfix Server"), N("Configuring your Postfix server.....")); @@ -306,26 +318,26 @@ sub do_it_internal { $o->{var}{wiz_inet_interfaces} and $postfix->{inet_interfaces} = $o->{var}{wiz_inet_interfaces}; $o->{var}{wiz_myhostname} and $postfix->{myhostname} = $o->{var}{wiz_myhostname}; $o->{var}{wiz_mydomain} and $postfix->{mydomain} = $o->{var}{wiz_mydomain}; - $postfix->{mydestination} = ; - $postfix->{alias_maps} = ; - $postfix->{alias_database} = ; - $postfix->{virtual_maps} = ; - $postfix->{canonical_maps} = ; + $postfix->{mydestination}; + $postfix->{alias_maps}; + $postfix->{alias_database}; + $postfix->{virtual_maps}; + $postfix->{canonical_maps}; $o->{var}{wiz_mail_masquerade} and $postfix->{masquerade_domains} = $o->{var}{wiz_mail_masquerade}; $o->{var}{wiz_myorigin} and $postfix->{myorigin} = $o->{var}{wiz_myorigin}; $postfix->{relayhost} and delete $postfix->{relayhost}; -$o->{var}{wiz_mail_masquerade} -$o->{var}{wiz_ext_mail_relay} -$o->{var}{wiz_myhostname} -$o->{var}{wiz_mydomain} -$o->{var}{wiz_inet_interfaces} -$o->{var}{wiz_mynetworks_style} -$o->{var}{wiz_smtpd_banner} -$o->{var}{wiz_inet_interfaces} -$o->{var}{wiz_mydestination} -$o->{var}{wiz_myorigin} + $o->{var}{wiz_mail_masquerade}; + $o->{var}{wiz_ext_mail_relay}; + $o->{var}{wiz_myhostname}; + $o->{var}{wiz_mydomain}; + $o->{var}{wiz_inet_interfaces}; + $o->{var}{wiz_mynetworks_style}; + $o->{var}{wiz_smtpd_banner}; + $o->{var}{wiz_inet_interfaces}; + $o->{var}{wiz_mydestination}; + $o->{var}{wiz_myorigin}; # example of internal mail working confoguration #myhostname = xp2400.guibland.com @@ -337,20 +349,20 @@ $o->{var}{wiz_myorigin} check_started('master'); } -sub do_it_external { +sub do_it_main_server { $::testing and return; my $in = 'interactive'->vnew('su', 'postfix configuration'); my $w = $in->wait_message(N("Postfix Server"), N("Configuring your Postfix server.....")); save_config(); - $postfix->{inet_interfaces} = ; - $postfix->{myhostname} = ; - $postfix->{mydomain} = ; - $postfix->{mydestination} = ; - $postfix->{alias_maps} = ; - $postfix->{alias_database} = ; - $postfix->{virtual_maps} = ; - $postfix->{canonical_maps} = ; + $postfix->{inet_interfaces} ; + $postfix->{myhostname}; + $postfix->{mydomain} ; + $postfix->{mydestination}; + $postfix->{alias_maps}; + $postfix->{alias_database}; + $postfix->{virtual_maps}; + $postfix->{canonical_maps}; $o->{var}{wiz_myorigin} and $postfix->{myorigin} = $o->{var}{wiz_myorigin}; $o->{var}{wiz_ext_mail_relay} and $postfix->{relayhost} = $o->{var}{relayhost}; |