summaryrefslogtreecommitdiffstats
path: root/postfix_wizard/Postfix.pm
diff options
context:
space:
mode:
Diffstat (limited to 'postfix_wizard/Postfix.pm')
-rwxr-xr-xpostfix_wizard/Postfix.pm85
1 files changed, 40 insertions, 45 deletions
diff --git a/postfix_wizard/Postfix.pm b/postfix_wizard/Postfix.pm
index 95848820..f4e4fbae 100755
--- a/postfix_wizard/Postfix.pm
+++ b/postfix_wizard/Postfix.pm
@@ -209,10 +209,10 @@ sub cmd_needed {
system("/usr/sbin/postfix check");
require services;
if (services::is_service_running('postfix')) {
- services::restart('postfix')
- } else {
- services::start('postfix')
- }
+ services::restart('postfix');
+ } else {
+ services::start('postfix');
+ }
}
sub do_it_internal {
@@ -220,31 +220,36 @@ sub do_it_internal {
my $in = 'interactive'->vnew('su', 'postfix configuration');
my $w = $in->wait_message(N("Postfix Server"), N("Configuring your Postfix server....."));
save_config();
- 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",
- "masquerade_domains = $wiz_domain_name",
- "myorigin = $o->{var}{wiz_myorigin}",
- );
- my $c = "/etc/postfix/main.cf";
- if (any { /relayhost/ } cat_($c)) {
- substInFile {
- s/relayhost.*//g;
- } $c;
- }
+
+ $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->{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}
+
# 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
- foreach (@conf) {
- system("/usr/sbin/postconf -e '$_'");
- }
cmd_needed();
undef $w;
check_started('master');
@@ -256,6 +261,17 @@ sub do_it_external {
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};
+ $o->{var}{wiz_ext_mail_relay} and $postfix->{relayhost} = $o->{var}{relayhost};
+
my @conf = ("myhostname = $wiz_host_name",
'inet_interfaces = $myhostname,localhost',
'mydestination = $myhostname, localhost.$mydomain',
@@ -264,29 +280,8 @@ sub do_it_external {
'virtual_maps = hash:/etc/postfix/virtual',
'canonical_maps = hash:/etc/postfix/canonical',
"mydomain = $wiz_domain_name",
- "relayhost = $o->{var}{wiz_ext_mail_relay}",
);
-# "myorigin = $o->{var}{wiz_myorigin}",
-# "masquerade_domains = $o->{var}{wiz_mail_masquerade}",
-
- foreach (@conf) {
- system("/usr/sbin/postconf -e '$_'");
- }
-
-# if (defined $o->{var}{wiz_ext_mail_relay}) {
-# my $file = "/etc/postfix/canonical";
-# my $canon = "\n\@$wiz_domain_name";
-# my $t;
-# foreach (cat_($file)) {
-# if (/^\s*(?!#)\s*\@$wiz_domain_name/) {
-# $t = $_;
-# last;
-# }
-# }
-# if ($t) { substInFile { s|$t|| } }
-# else { append_to_file($file, $canon) }
-# }
cmd_needed();
undef $w;
check_started('master');