summaryrefslogtreecommitdiffstats
path: root/postfix_wizard/Postfix.pm
diff options
context:
space:
mode:
authorAntoine Ginies <aginies@mandriva.com>2005-06-06 09:05:37 +0000
committerAntoine Ginies <aginies@mandriva.com>2005-06-06 09:05:37 +0000
commit78c5af1ba86a9202c79d31faf3dbec830f254529 (patch)
tree3e3f4341382529a31fe0b1c8384637fe4650fb0e /postfix_wizard/Postfix.pm
parent0f85f4822b6c9546122b9471d14b79fbf4a57051 (diff)
downloaddrakwizard-78c5af1ba86a9202c79d31faf3dbec830f254529.tar
drakwizard-78c5af1ba86a9202c79d31faf3dbec830f254529.tar.gz
drakwizard-78c5af1ba86a9202c79d31faf3dbec830f254529.tar.bz2
drakwizard-78c5af1ba86a9202c79d31faf3dbec830f254529.tar.xz
drakwizard-78c5af1ba86a9202c79d31faf3dbec830f254529.zip
fix mydomain and myhostname, add mynetwork pre-conf
Diffstat (limited to 'postfix_wizard/Postfix.pm')
-rwxr-xr-xpostfix_wizard/Postfix.pm17
1 files changed, 11 insertions, 6 deletions
diff --git a/postfix_wizard/Postfix.pm b/postfix_wizard/Postfix.pm
index f4d16163..35ab07c5 100755
--- a/postfix_wizard/Postfix.pm
+++ b/postfix_wizard/Postfix.pm
@@ -42,6 +42,8 @@ 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 ($IPSERVER_MASQ) = `/sbin/ip addr show dev eth1` =~ /^\s*inet\s+(\d+\.\d+\.\d+)\.\d+/m;
+
my $o = {
name => N("Postfix wizard"),
var => {
@@ -134,8 +136,8 @@ $o->{pages} = {
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_myhostname} ||= $postfix->{myhostname} or $o->{var}{wiz_myhostname} = $wiz_host_name;
+ $o->{var}{wiz_mydomain} ||= $postfix->{mydomain} or $o->{var}{wiz_mydomain} = $wiz_domain_name;
$o->{var}{wiz_myorigin} ||= $postfix->{myorigin};
},
post => sub {
@@ -147,9 +149,9 @@ $o->{pages} = {
},
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_mydomain}, 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') },
+ { 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_mydomain}, 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') },
],
complete => sub {
if (!$o->{var}{wiz_smtpd_banner}) {
@@ -198,7 +200,9 @@ $o->{pages} = {
pre => sub {
$postfix->{inet_interfaces} and $o->{var}{wiz_inet_interfaces} = $postfix->{inet_interfaces} or $o->{var}{wiz_inet_interfaces} = 'all';
$postfix->{mydestination} and $o->{var}{wiz_mydestination} = $postfix->{mydestination} or $o->{var}{wiz_mydestination} = "\$myhostname, localhost.\$mydomain";
- $postfix->{mynetworks} and $o->{var}{wiz_mynetworks} = $postfix->{mynetworks};
+ my $mynetworks;
+ $IPSERVER_MASQ and $mynetworks = "127.0.0.0/32, " . $IPSERVER_MASQ . ".0/24" or $mynetworks = "127.0.0.0/32";
+ $postfix->{mynetworks} and $o->{var}{wiz_mynetworks} = $postfix->{mynetworks} or $o->{var}{wiz_mynetworks} = $mynetworks;
$o->{var}{wiz_mynetworks_style} ||= $postfix->{mynetworks_style};
},
data => [
@@ -341,6 +345,7 @@ sub cmd_needed {
system("/usr/sbin/postmap /etc/postfix/virtual");
system("/usr/sbin/postalias /etc/postfix/aliases");
system("/usr/sbin/postfix check");
+ $postfix->write_conf("/etc/postfix/main.cf");
require services;
if (services::is_service_running('postfix')) {
services::restart('postfix');