summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xpostfix_wizard/Postfix.pm130
1 files changed, 81 insertions, 49 deletions
diff --git a/postfix_wizard/Postfix.pm b/postfix_wizard/Postfix.pm
index a659d4bb..65147a83 100755
--- a/postfix_wizard/Postfix.pm
+++ b/postfix_wizard/Postfix.pm
@@ -45,7 +45,7 @@ my $o = {
name => N("Postfix wizard"),
var => {
wiz_myhostname => '',
- wiz_mydomain => '',
+ wiz_mydomain => '',
wiz_myorigin => '',
wiz_inet_interfaces => '',
wiz_mydestination => '',
@@ -75,7 +75,6 @@ my $o = {
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 => '',
@@ -123,68 +122,101 @@ $o->{pages} = {
$o->{var}{wiz_type} = chomp_($old_type);
} else { $o->{var}{wiz_type} = 2 }
},
- post => sub {
- if ($o->{var}{wiz_type} == 2) {
- return 'understanding' ;
- } else {
- return 'relay_server';
- }
- },
data => [
- { label => N("What do you want to do:"), val => \$o->{var}{wiz_level}, list => [ keys %type ], format => sub { $type{$_[0]} } },
+ { label => N("What do you want to do:"), val => \$o->{var}{wiz_type}, list => [ keys %type ], format => sub { $type{$_[0]} } },
],
next => 'understanding',
},
understanding => {
- name => N('Now i need to know your undestanding in Samba server configuration'),
+ 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]} } },
],
- next => 'main_server',
+ next => 'global_config',
+ },
+ global_config => {
+ name => N('Global postfix configuration'),
+ pre => sub {
+ $o->{var}{wiz_smtpd_banner} ||= $postfix->{smtpd_banner};
+ $o->{var}{wiz_myhostname} ||= $postfix->{myhostname} or $o->{var}{wiz_myhostname} = "\$myhostname";
+ $o->{var}{wiz_mydomain} ||= $postfix->{mydomain} or $o->{var}{wiz_mydomain} = "\$mydomain";
+ $o->{var}{wiz_myorigin} ||= $postfix->{myorigin};
+ },
+ post => sub {
+ if ($o->{var}{wiz_type} == 2) {
+ 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') },
+ ],
},
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} },
- ],
- next => 'isp',
- },
- warning => {
- name => N("Warning:") . "\n\n" . N("You entered an empty address for the mail gateway.") . "\n\n" . N("Your choice can be accepted, but this will not allow you to send mail outside your local network. Press next to continue, or back to enter a value."),
- next => 'summaryext',
- },
+ data => [
+
+ ],
+ next => 'network_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 {
+ 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};
+ },
+ data => [
+ { label => N('inet interfaces:'), val => \$o->{var}{wiz_inet_interfaces}, help => N('all') },
+ { label => N('my destination:'), val => \$o->{var}{wiz_mydestination}, help => N('$myhostname, localhost.$mydomain, /etc/postfix/destinations') },
+ { label => N('my networks:'), val => \$o->{var}{wiz_mynetworks}, help => N('127.0.0.0/32, 192.168.1.0/24') },
+ ],
+ next => 'message_config',
+ },
+ message_config => {
+ name => N('Message options'),
+ pre => sub {
+ $postfix->{maximal_queue_lifetime} and $o->{var}{wiz_maximal_queue_lifetime} = $postfix->{maximal_queue_lifetime};
+ $postfix->{message_size_limit} and $o->{var}{wiz_message_size_limit} = $postfix->{message_size_limit};
+ },
+ data => [
+ { label => N('Maximal queue life'), val => \$o->{var}{wiz_maximal_queue_lifetime} },
+ { label => N('Message size limit'), val => \$o->{var}{wiz_message_size_limit} },
+ { label => N('Default destination concurrency limit'), val => \$o->{var}{wiz_default_destination_concurrency_limit}, help => N('How many parallel deliveries to the same user or domain ?') },
+ ],
+ next => 'summary_main',
+ },
error_sendmail => {
name => N("Error, sendmail is installed. Please remove it before installing or configuring Postfix"),
no_back => 1,
next => 0,
end => 1,
},
- isp => {
- name => N("Internet mail gateway") . "\n\n" . N("Your server will send the outgoing through a mail gateway, that will take care of the final delivery.") . "\n\n" . N("Internet host names must be in the form \"host.domain.domaintype\"; for example, if your provider is \"provider.com\", the Internet mail server is usually \"smtp.provider.com\"."),
- post => \&check_relay,
- data => [
- { label => N("Mail server name:"), val => \$o->{var}{wiz_ext_mail_relay} },
- ],
- next => 'originext',
- },
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 => [
@@ -244,6 +276,10 @@ 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};
@@ -265,12 +301,8 @@ sub postfix_options {
$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};