Skip to content

Commit 1db3b18

Browse files
author
Marius Cramer
committed
Merge branch 'master' into 'master'
Master
2 parents 9893e01 + 8100f25 commit 1db3b18

File tree

10 files changed

+135
-42
lines changed

10 files changed

+135
-42
lines changed

install/dist/lib/centos52.lib.php

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,25 @@ public function configure_amavis() {
141141
}
142142

143143
// Append the configuration for amavisd to the master.cf file
144-
if(is_file($conf["postfix"]["config_dir"].'/master.cf')) copy($conf["postfix"]["config_dir"].'/master.cf', $conf["postfix"]["config_dir"].'/master.cf~');
145-
$content = rf($conf["postfix"]["config_dir"].'/master.cf');
144+
if(is_file($conf['postfix']['config_dir'].'/master.cf')) copy($conf['postfix']['config_dir'].'/master.cf', $conf['postfix']['config_dir'].'/master.cf~');
145+
$content = rf($conf['postfix']['config_dir'].'/master.cf');
146146
// Only add the content if we had not addded it before
147-
if(!stristr($content, "127.0.0.1:10025")) {
147+
if(!preg_match('/^amavis\s+/m', $content)) {
148148
unset($content);
149-
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis.master', "tpl/master_cf_amavis.master");
150-
af($conf["postfix"]["config_dir"].'/master.cf', $content);
149+
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis.master', 'tpl/master_cf_amavis.master');
150+
af($conf['postfix']['config_dir'].'/master.cf', $content);
151+
$content = rf($conf['postfix']['config_dir'].'/master.cf');
152+
}
153+
if(!preg_match('/^127.0.0.1:10025\s+/m', $content)) {
154+
unset($content);
155+
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis10025.master', 'tpl/master_cf_amavis10025.master');
156+
af($conf['postfix']['config_dir'].'/master.cf', $content);
157+
$content = rf($conf['postfix']['config_dir'].'/master.cf');
158+
}
159+
if(!preg_match('/^127.0.0.1:10027\s+/m', $content)) {
160+
unset($content);
161+
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis10027.master', 'tpl/master_cf_amavis10027.master');
162+
af($conf['postfix']['config_dir'].'/master.cf', $content);
151163
}
152164
unset($content);
153165

install/dist/lib/centos53.lib.php

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,13 +142,25 @@ public function configure_amavis() {
142142
}
143143

144144
// Append the configuration for amavisd to the master.cf file
145-
if(is_file($conf["postfix"]["config_dir"].'/master.cf')) copy($conf["postfix"]["config_dir"].'/master.cf', $conf["postfix"]["config_dir"].'/master.cf~');
146-
$content = rf($conf["postfix"]["config_dir"].'/master.cf');
145+
if(is_file($conf['postfix']['config_dir'].'/master.cf')) copy($conf['postfix']['config_dir'].'/master.cf', $conf['postfix']['config_dir'].'/master.cf~');
146+
$content = rf($conf['postfix']['config_dir'].'/master.cf');
147147
// Only add the content if we had not addded it before
148-
if(!stristr($content, "127.0.0.1:10025")) {
148+
if(!preg_match('/^amavis\s+/m', $content)) {
149149
unset($content);
150-
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis.master', "tpl/master_cf_amavis.master");
151-
af($conf["postfix"]["config_dir"].'/master.cf', $content);
150+
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis.master', 'tpl/master_cf_amavis.master');
151+
af($conf['postfix']['config_dir'].'/master.cf', $content);
152+
$content = rf($conf['postfix']['config_dir'].'/master.cf');
153+
}
154+
if(!preg_match('/^127.0.0.1:10025\s+/m', $content)) {
155+
unset($content);
156+
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis10025.master', 'tpl/master_cf_amavis10025.master');
157+
af($conf['postfix']['config_dir'].'/master.cf', $content);
158+
$content = rf($conf['postfix']['config_dir'].'/master.cf');
159+
}
160+
if(!preg_match('/^127.0.0.1:10027\s+/m', $content)) {
161+
unset($content);
162+
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis10027.master', 'tpl/master_cf_amavis10027.master');
163+
af($conf['postfix']['config_dir'].'/master.cf', $content);
152164
}
153165
unset($content);
154166

install/dist/lib/fedora.lib.php

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -497,13 +497,25 @@ public function configure_amavis() {
497497
}
498498

499499
// Append the configuration for amavisd to the master.cf file
500-
if(is_file($conf["postfix"]["config_dir"].'/master.cf')) copy($conf["postfix"]["config_dir"].'/master.cf', $conf["postfix"]["config_dir"].'/master.cf~');
501-
$content = rf($conf["postfix"]["config_dir"].'/master.cf');
500+
if(is_file($conf['postfix']['config_dir'].'/master.cf')) copy($conf['postfix']['config_dir'].'/master.cf', $conf['postfix']['config_dir'].'/master.cf~');
501+
$content = rf($conf['postfix']['config_dir'].'/master.cf');
502502
// Only add the content if we had not addded it before
503-
if(!stristr($content, "127.0.0.1:10025")) {
503+
if(!preg_match('/^amavis\s+/m', $content)) {
504+
unset($content);
505+
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis.master', 'tpl/master_cf_amavis.master');
506+
af($conf['postfix']['config_dir'].'/master.cf', $content);
507+
$content = rf($conf['postfix']['config_dir'].'/master.cf');
508+
}
509+
if(!preg_match('/^127.0.0.1:10025\s+/m', $content)) {
510+
unset($content);
511+
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis10025.master', 'tpl/master_cf_amavis10025.master');
512+
af($conf['postfix']['config_dir'].'/master.cf', $content);
513+
$content = rf($conf['postfix']['config_dir'].'/master.cf');
514+
}
515+
if(!preg_match('/^127.0.0.1:10027\s+/m', $content)) {
504516
unset($content);
505-
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis.master', "tpl/master_cf_amavis.master");
506-
af($conf["postfix"]["config_dir"].'/master.cf', $content);
517+
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis10027.master', 'tpl/master_cf_amavis10027.master');
518+
af($conf['postfix']['config_dir'].'/master.cf', $content);
507519
}
508520
unset($content);
509521

install/dist/lib/gentoo.lib.php

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -332,14 +332,25 @@ public function configure_amavis()
332332
caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
333333
}
334334

335-
//* Append the configuration for amavisd to the master.cf file
335+
// Append the configuration for amavisd to the master.cf file
336336
$content = rf($conf['postfix']['config_dir'].'/master.cf');
337-
338-
if(!stristr($content, '127.0.0.1:10025')) //* Only add the content if we had not addded it before
339-
{
337+
// Only add the content if we had not addded it before
338+
if(!preg_match('/^amavis\s+/m', $content)) {
340339
unset($content);
341340
$content = $this->get_template_file('master_cf_amavis', true);
342341
af($conf['postfix']['config_dir'].'/master.cf', $content);
342+
$content = rf($conf['postfix']['config_dir'].'/master.cf');
343+
}
344+
if(!preg_match('/^127.0.0.1:10025\s+/m', $content)) {
345+
unset($content);
346+
$content = $this->get_template_file('master_cf_amavis10025', true);
347+
af($conf['postfix']['config_dir'].'/master.cf', $content);
348+
$content = rf($conf['postfix']['config_dir'].'/master.cf');
349+
}
350+
if(!preg_match('/^127.0.0.1:10027\s+/m', $content)) {
351+
unset($content);
352+
$content = $this->get_template_file('master_cf_amavis10027', true);
353+
af($conf['postfix']['config_dir'].'/master.cf', $content);
343354
}
344355
unset($content);
345356

install/dist/lib/opensuse.lib.php

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -533,11 +533,23 @@ public function configure_amavis() {
533533
// Append the configuration for amavisd to the master.cf file
534534
if(is_file($conf["postfix"]["config_dir"].'/master.cf')) copy($conf["postfix"]["config_dir"].'/master.cf', $conf["postfix"]["config_dir"].'/master.cf~');
535535
$content = rf($conf["postfix"]["config_dir"].'/master.cf');
536-
// Only add the content if we had not addded it before
537-
if(!stristr($content, "127.0.0.1:10025")) {
536+
// Only add the content if we had not addded it before
537+
if(!preg_match('/^amavis\s+/m', $content)) {
538+
unset($content);
539+
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis.master', 'tpl/master_cf_amavis.master');
540+
af($conf['postfix']['config_dir'].'/master.cf', $content);
541+
$content = rf($conf['postfix']['config_dir'].'/master.cf');
542+
}
543+
if(!preg_match('/^127.0.0.1:10025\s+/m', $content)) {
544+
unset($content);
545+
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis10025.master', 'tpl/master_cf_amavis10025.master');
546+
af($conf['postfix']['config_dir'].'/master.cf', $content);
547+
$content = rf($conf['postfix']['config_dir'].'/master.cf');
548+
}
549+
if(!preg_match('/^127.0.0.1:10027\s+/m', $content)) {
538550
unset($content);
539-
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis.master', "tpl/master_cf_amavis.master");
540-
af($conf["postfix"]["config_dir"].'/master.cf', $content);
551+
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis10027.master', 'tpl/master_cf_amavis10027.master');
552+
af($conf['postfix']['config_dir'].'/master.cf', $content);
541553
}
542554
unset($content);
543555

install/install.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,8 @@
344344
if($conf['nginx']['installed'] == true && $conf['nginx']['init_script'] != '') system($inst->getinitcommand($conf['nginx']['init_script'], 'restart').' &> /dev/null');
345345
if($conf['ufw']['installed'] == true && $conf['ufw']['init_script'] != '') system($inst->getinitcommand($conf['ufw']['init_script'], 'restart').' &> /dev/null');
346346

347+
} else {
348+
347349
//* In expert mode, we select the services in the following steps, only db is always available
348350
$conf['services']['mail'] = false;
349351
$conf['services']['web'] = false;

install/lib/installer_base.lib.php

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -669,11 +669,11 @@ public function configure_postfix($options = '') {
669669

670670
//* postfix-dkim
671671
$full_file_name=$config_dir.'/tag_as_originating.re';
672-
if(is_file($full_file_name)) copy($full_file_name, $config_dir.$configfile.'~');
672+
if(is_file($full_file_name)) copy($full_file_name, $full_file_name.'~');
673673
wf($full_file_name, '/^/ FILTER amavis:[127.0.0.1]:10026');
674674

675675
$full_file_name=$config_dir.'/tag_as_foreign.re';
676-
if(is_file($full_file_name)) copy($full_file_name, $config_dir.$configfile.'~');
676+
if(is_file($full_file_name)) copy($full_file_name, $full_file_name.'~');
677677
wf($full_file_name, '/^/ FILTER amavis:[127.0.0.1]:10024');
678678

679679
//* Changing mode and group of the new created config files.
@@ -1040,29 +1040,41 @@ public function configure_amavis() {
10401040
if(is_file($conf['postfix']['config_dir'].'/master.cf')) copy($conf['postfix']['config_dir'].'/master.cf', $conf['postfix']['config_dir'].'/master.cf~');
10411041
$content = rf($conf['postfix']['config_dir'].'/master.cf');
10421042
// Only add the content if we had not addded it before
1043-
if(!stristr($content, '127.0.0.1:10025')) {
1043+
if(!preg_match('/^amavis\s+unix\s+/m', $content)) {
10441044
unset($content);
10451045
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis.master', 'tpl/master_cf_amavis.master');
10461046
af($conf['postfix']['config_dir'].'/master.cf', $content);
1047+
$content = rf($conf['postfix']['config_dir'].'/master.cf');
1048+
}
1049+
if(!preg_match('/^127.0.0.1:10025\s+/m', $content)) {
1050+
unset($content);
1051+
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis10025.master', 'tpl/master_cf_amavis10025.master');
1052+
af($conf['postfix']['config_dir'].'/master.cf', $content);
1053+
$content = rf($conf['postfix']['config_dir'].'/master.cf');
1054+
}
1055+
if(!preg_match('/^127.0.0.1:10027\s+/m', $content)) {
1056+
unset($content);
1057+
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis10027.master', 'tpl/master_cf_amavis10027.master');
1058+
af($conf['postfix']['config_dir'].'/master.cf', $content);
10471059
}
10481060
unset($content);
10491061

10501062
// Add the clamav user to the amavis group
10511063
exec('adduser clamav amavis');
10521064

10531065
// Create the director for DKIM-Keys
1054-
mkdir("/var/lib/amavis/dkim", 0750);
1066+
if(!is_dir('/var/lib/amavis/dkim')) mkdir('/var/lib/amavis/dkim', 0750, true);
10551067
// get shell-user for amavis
10561068
$amavis_user=exec('grep -o "^amavis:\|^vscan:" /etc/passwd');
10571069
if(!empty($amavis_user)) {
10581070
$amavis_user=rtrim($amavis_user, ":");
1059-
exec('chown '.$amavis_user.'/var/lib/amavis/dkim');
1071+
exec('chown '.$amavis_user.' /var/lib/amavis/dkim');
10601072
}
10611073
// get shell-group for amavis
10621074
$amavis_group=exec('grep -o "^amavis:\|^vscan:" /etc/group');
10631075
if(!empty($amavis_group)) {
10641076
$amavis_group=rtrim($amavis_group, ":");
1065-
exec('chgrp '.$amavis_group.'/var/lib/amavis/dkim');
1077+
exec('chgrp '.$amavis_group.' /var/lib/amavis/dkim');
10661078
}
10671079
}
10681080

install/tpl/master_cf_amavis.master

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,3 @@ amavis unix - - - - 2 smtp
33
-o smtp_data_done_timeout=1200
44
-o smtp_send_xforward_command=yes
55

6-
127.0.0.1:10025 inet n - - - - smtpd
7-
-o content_filter=
8-
-o local_recipient_maps=
9-
-o relay_recipient_maps=
10-
-o smtpd_restriction_classes=
11-
-o smtpd_client_restrictions=
12-
-o smtpd_helo_restrictions=
13-
-o smtpd_sender_restrictions=
14-
-o smtpd_recipient_restrictions=permit_mynetworks,reject
15-
-o mynetworks=127.0.0.0/8
16-
-o strict_rfc821_envelopes=yes
17-
-o receive_override_options=no_unknown_recipient_checks,no_header_body_checks
18-
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
127.0.0.1:10025 inet n - n - - smtpd
3+
-o content_filter=
4+
-o local_recipient_maps=
5+
-o relay_recipient_maps=
6+
-o smtpd_restriction_classes=
7+
-o smtpd_client_restrictions=
8+
-o smtpd_helo_restrictions=
9+
-o smtpd_sender_restrictions=
10+
-o smtpd_recipient_restrictions=permit_mynetworks,reject
11+
-o mynetworks=127.0.0.0/8
12+
-o strict_rfc821_envelopes=yes
13+
-o receive_override_options=no_unknown_recipient_checks,no_header_body_checks
14+
-o smtp_send_xforward_command=yes
15+
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
2+
127.0.0.1:10027 inet n - n - - smtpd
3+
-o content_filter=
4+
-o local_recipient_maps=
5+
-o relay_recipient_maps=
6+
-o smtpd_restriction_classes=
7+
-o smtpd_client_restrictions=
8+
-o smtpd_helo_restrictions=
9+
-o smtpd_sender_restrictions=
10+
-o smtpd_recipient_restrictions=permit_mynetworks,reject
11+
-o mynetworks=127.0.0.0/8
12+
-o strict_rfc821_envelopes=yes
13+
-o receive_override_options=no_unknown_recipient_checks,no_header_body_checks
14+
-o smtp_send_xforward_command=yes
15+
-o milter_default_action=accept
16+
-o milter_macro_daemon_name=ORIGINATING
17+
-o smtpd_milters=inet:127.0.0.1:4445
18+

0 commit comments

Comments
 (0)