From 0f85f4822b6c9546122b9471d14b79fbf4a57051 Mon Sep 17 00:00:00 2001 From: Antoine Ginies Date: Mon, 6 Jun 2005 08:37:39 +0000 Subject: test release --- postfix_wizard/Postfix.pm | 150 +++++++++++++++++----------------------------- 1 file changed, 55 insertions(+), 95 deletions(-) (limited to 'postfix_wizard') diff --git a/postfix_wizard/Postfix.pm b/postfix_wizard/Postfix.pm index 074908f1..f4d16163 100755 --- a/postfix_wizard/Postfix.pm +++ b/postfix_wizard/Postfix.pm @@ -55,9 +55,6 @@ my $o = { 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 => '', @@ -73,12 +70,9 @@ my $o = { wiz_manpage_directory => '', wiz_sample_directory => '', wiz_readme_directory => '', + wiz_html_directory => '', wiz_masquerade_domains => '', - wiz_content_filter => '', - wiz_html_directory => '', - wiz_content_filter => '', - wiz_receive_override_options => '', wiz_mail_masquerade => '', wiz_relayhost => '', @@ -171,41 +165,34 @@ $o->{pages} = { pre => sub { $o->{var}{wiz_smtpd_helo_required} ||= $postfix->{smtpd_helo_required}; $o->{var}{wiz_disable_vrfy_command} ||= $postfix->{disable_vrfy_command}; + $postfix->{masquerade_domains} and $o->{var}{wiz_masquerade_domains}; }, data => [ { label => N('helo required:'), val => \$o->{var}{wiz_smtpd_helo_required}, fixed_list => \@yesorno }, { label => N('Disable verify command:'), val => \$o->{var}{wiz_disable_vrfy_command}, fixed_list => \@yesorno }, + { label => N('Masquerade domains'), val => \$o->{var}{wiz_masquerade_domains}, help => N('This should be chosen consistently with the address you use for incoming mail. 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_masquerade_domains} !~ /\w+\.\w+$/ and $o->{var}{wiz_masquerade_domains}) { + $::in->ask_warn(N("Error"), N("Masquerade should be a valid domain name such as \"mydomain.com\"!")); + return 1; + } else { return 0; }; + }, next => 'message_config', }, relay_server => { - name => N('Relay server') . N(''), + name => N('Relay server') . N('Relay domains: what destination domains (and subdomains thereof) this system will relay mail to.') . "\n" . N(''), 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} = $wiz_domain_name; }, data => [ - { label => N('Relay host:'), val => \$o->{var}{wiz_relayhost}, help => 'ie: 192.168.10.13' }, - { label => N('Relay domains:'), val => \$o->{var}{wiz_relay_domains}, help => 'mydomain.com' }, + { label => N('Relay host:'), val => \$o->{var}{wiz_relayhost}, help => 'The default host to send non-local mail to when no entry is matched in the optional transport(5) table. ie: relayhost = [gateway.my.domain], relayhost = uucphost, relayhost = [an.ip.add.ress].' }, + { label => N('Relay domains:'), val => \$o->{var}{wiz_relay_domains}, help => N('What destination domains (and subdomains thereof) this system will relay mail to. ie: mydomain.com') }, ], + complete => sub { if (!$o->{var}{wiz_relayhost}) { $::in->ask_warn(N('Error'), N('Need a relayhost.')); return 1; } else { return 0; }; }, 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 { - $o->{var}{wiz_mail_masquerade} ||= $postfix->{masquerade_domains}; - }, - 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} }, - ], - next => 'isp', - }, network_config => { name => N('Network config'), pre => sub { @@ -219,8 +206,15 @@ $o->{pages} = { { label => N('my destination:'), val => \$o->{var}{wiz_mydestination}, help => N('The list of domains that are delivered via the $local_transport mail delivery transport. ie: $myhostname, localhost.$mydomain, /etc/postfix/destinations') }, { label => N('my networks:'), val => \$o->{var}{wiz_mynetworks}, help => N('The list of trusted SMTP clients. ie: 127.0.0.0/32, 192.168.1.0/24') }, ], - next => 'message_config', - }, + complete => sub { if (!$o->{var}{wiz_mynetworks}) { $::in->ask_warn(N('Error'), N('This is the list of trusted SMTP clients. For securty reason, please provide one. ie: 127.0.0.0/32, 192.168.1.0/24')); return 1; } else { return 0; }; }, + post => sub { + if ($o->{var}{wiz_type} == 1) { + return 'summary_main' ; + } else { + return 'summary_relay'; + } + } + }, message_config => { name => N('Message options') . N('Various options to configure your message queue, delay, size...'), pre => sub { @@ -294,36 +288,29 @@ sub check_sendmail { } sub postfix_options { + # global $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_masquerade_domains} and $postfix->{masquerade_domains} = $o->{var}{wiz_masquerade_domains}; - $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_relayhost} and $postfix->{wiz_relayhost} = $o->{var}{wiz_relayhost}; - $o->{var}{wiz_relay_domains} and $postfix->{wiz_relay_domains} = $o->{var}{wiz_relay_domains}; + # not defined but wanted + $postfix->{debug_peer_level} or $postfix->{debug_peer_level} = "1"; + #$postfix->{debugger_command} or $postfix->{debugger_command} = "PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin xxgdb $daemon_directory/$process_name $process_id & sleep 5"; + $postfix->{sendmail_path} or $postfix->{sendmail_path} = "/usr/sbin/sendmail.postfix"; + $postfix->{newaliases_path} or $postfix->{newaliases_path} = "/usr/bin/newaliases.postfix"; + $postfix->{mailq_path} or $postfix->{mailq_path} = "/usr/bin/mailq.postfix"; + $postfix->{setgid_group} or $postfix->{setgid_group} = "postdrop"; + $postfix->{alias_maps} or $postfix->{alias_maps} = "hash:/etc/postfix/aliases"; + $postfix->{mail_spool_directory} or $postfix->{mail_spool_directory} = "/var/spool/mail"; + $postfix->{alias_database} or $postfix->{alias_database} = "hash:/etc/postfix/aliases"; + $postfix->{command_directory} or $postfix->{command_directory} = "/usr/sbin"; + $postfix->{queue_directory} or $postfix->{queue_directory} = "/var/spool/postfix"; + $postfix->{daemon_directory} or $postfix->{daemon_directory} = "/usr/lib/postfix"; + $postfix->{mail_owner} or $postfix->{mail_owner} = "postfix"; } sub store_postfix_type { @@ -368,34 +355,15 @@ sub do_it_relay_server { my $w = $in->wait_message(N("Postfix Server"), N("Configuring your Postfix server.....")); save_config(); - $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}; - $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_options(); + $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}; + + # remove server unwanted options + $postfix->{smtpd_helo_required} and delete $postfix->{smtpd_helo_required}; + $postfix->{disable_vrfy_command} and delete $postfix->{disable_vrfy_command}; + $postfix->{masquerade_domains} and delete $postfix->{masquerade_domains}; - $postfix->{relayhost} and delete $postfix->{relayhost}; - - $o->{var}{wiz_mail_masquerade}; - $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 - #virtual_maps = hash:/etc/postfix/virtual - #canonical_maps = hash:/etc/postfix/canonical - #masquerade_domains = guibland.com cmd_needed(); undef $w; check_started('master'); @@ -407,25 +375,17 @@ sub do_it_main_server { 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}; - $o->{var}{wiz_myorigin} and $postfix->{myorigin} = $o->{var}{wiz_myorigin}; + postfix_options(); + $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_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_masquerade_domains} and $postfix->{masquerade_domains} = $o->{var}{wiz_masquerade_domains}; + $o->{var}{wiz_delay_warning_time} and $postfix->{delay_warning_time} = $o->{var}{wiz_delay_warning_time}; - my @conf = ("myhostname = $wiz_host_name", - 'inet_interfaces = $myhostname,localhost', - 'mydestination = $myhostname, localhost.$mydomain', - 'alias_maps = hash:/etc/postfix/aliases', - 'alias_database = hash:/etc/postfix/aliases', - 'virtual_maps = hash:/etc/postfix/virtual', - 'canonical_maps = hash:/etc/postfix/canonical', - "mydomain = $wiz_domain_name", - ); + # remove relay options + $o->{var}{wiz_relay_domains} and delete $o->{var}{wiz_relay_domains}; + $o->{var}{wiz_relayhost} and delete $o->{var}{wiz_relayhost}; cmd_needed(); undef $w; -- cgit v1.2.1