@@ -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
0 commit comments