diff options
Diffstat (limited to 'postfix_wizard/Postfix.pm')
-rwxr-xr-x | postfix_wizard/Postfix.pm | 114 |
1 files changed, 56 insertions, 58 deletions
diff --git a/postfix_wizard/Postfix.pm b/postfix_wizard/Postfix.pm index 20fd9af7..12567d8d 100755 --- a/postfix_wizard/Postfix.pm +++ b/postfix_wizard/Postfix.pm @@ -41,61 +41,61 @@ my $o = { }; $o->{pages} = { - welcome => { - name => N("Internet Mail Configuration Wizard") . "\n\n" . N("This wizard will help you configuring the Internet Mail services for your network."), - no_back => 1, - next => 'config' - }, - config => { - name => N("Outgoing Mail Address") . "\n\n" . N("You can select the kind of address that outgoing mail will show in the \qFrom:\q and \qReply-to\q field.") . "\n\n" . N("This should be chosen consistently with the address you use for incoming mail."), - pre => sub { - $o->{var}{wiz_mail_masquerade} ||= get_mail_masquerade(); - }, - post => \&check_masquerade, - data => [ - { label => N("Mail Address:"), val => \$o->{var}{wiz_mail_masquerade} }, - ], - next => 'isp' - }, - warning => { - name => N("Warning:"), - data => [ - { label => N("You entered an empty address for the mail gateway.") }, - { label => 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 => 'summary' - }, - masquerade_not_good => { - name => N("Error."), - data => [ { label => N("Masquerade not good!") } ], - next => 'config' - }, - 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 \qhost.domain.domaintype\q; for example, if your provider is \qprovider.com\q, the internet mail server is usually \qsmtp.provider.com\q."), - pre => sub { - $o->{var}{wiz_ext_mail_relay} ||= get_mail_relay(); - }, - post => \&check_relay, - data => [ - { label => N("Mail Server Name:"), val => \$o->{var}{wiz_ext_mail_relay} }, - ], - next => 'summary' - }, - summary => { - name => N("Configuring the Internet Mail") . "\n\n" . N("The wizard collected the following parameters needed to configure your Internet Mail Service:") . "\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} }, - ], - post => \&do_it, - next => 'end' - }, - end => { - name => N("Congratulations"), - data => [ { label => N("The wizard successfully configured your Internet Mail service of your server.") } ], - end => 1, - next => 0 + welcome => { + name => N("Internet Mail Configuration Wizard") . "\n\n" . N("This wizard will help you configuring the Internet Mail services for your network."), + no_back => 1, + next => 'config' + }, + config => { + name => N("Outgoing Mail Address") . "\n\n" . N("You can select the kind of address that outgoing mail will show in the \qFrom:\q and \qReply-to\q field.") . "\n\n" . N("This should be chosen consistently with the address you use for incoming mail."), + pre => sub { + $o->{var}{wiz_mail_masquerade} ||= get_mail_masquerade(); }, + post => \&check_masquerade, + data => [ + { label => N("Masquerade domain name:"), val => \$o->{var}{wiz_mail_masquerade} }, + ], + next => 'isp' + }, + warning => { + name => N("Warning:"), + data => [ + { label => N("You entered an empty address for the mail gateway.") }, + { label => 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 => 'summary' + }, + masquerade_not_good => { + name => N("Error."), + data => [ { label => N("Masquerade not good!") } ], + next => 'config' + }, + 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 \qhost.domain.domaintype\q; for example, if your provider is \qprovider.com\q, the internet mail server is usually \qsmtp.provider.com\q."), + pre => sub { + $o->{var}{wiz_ext_mail_relay} ||= get_mail_relay(); + }, + post => \&check_relay, + data => [ + { label => N("Mail Server Name:"), val => \$o->{var}{wiz_ext_mail_relay} }, + ], + next => 'summary' + }, + summary => { + name => N("Configuring the Internet Mail") . "\n\n" . N("The wizard collected the following parameters needed to configure your Internet Mail Service:") . "\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} }, + ], + post => \&do_it, + next => 'end' + }, + end => { + name => N("Congratulations"), + data => [ { label => N("The wizard successfully configured your Internet Mail service of your server.") } ], + end => 1, + next => 0 + }, }; sub new { @@ -107,7 +107,7 @@ sub new { sub check_masquerade { $o->{var}{wiz_mail_masquerade} or return 'masquerade_not_good'; - $o->{var}{wiz_mail_masquerade} =~ /@(\S+)$/ or return 'masquerade_not_good'; + $o->{var}{wiz_mail_masquerade} =~ /\w+\.\w+$/ or return 'masquerade_not_good'; } sub check_relay { @@ -116,13 +116,11 @@ sub check_relay { } sub get_mail_masquerade { - my $login = `logname`; my $relayhost = `/usr/sbin/postconf -h relayhost`; chomp($relayhost); ($relayhost) = $relayhost =~ /.*\.(.*\..*)/; !length $relayhost and $relayhost = $wiz_domain_name; - chomp($login); - "$login\@$relayhost"; + $relayhost } sub get_mail_relay { |