@@ -737,18 +737,29 @@ public function process_postfix_config($configfile) {
737737 global $ conf ;
738738
739739 $ config_dir = $ conf ['postfix ' ]['config_dir ' ].'/ ' ;
740+ $ postfix_group = $ conf ['postfix ' ]['group ' ];
740741 $ full_file_name = $ config_dir .$ configfile ;
741742 //* Backup exiting file
742743 if (is_file ($ full_file_name )) {
743744 copy ($ full_file_name , $ config_dir .$ configfile .'~ ' );
744745 }
746+ chmod ($ config_dir .$ configfile .'~ ' ,0600 );
747+
748+ //* Replace variables in config file template
745749 $ content = rfsel ($ conf ['ispconfig_install_dir ' ].'/server/conf-custom/install/ ' .$ configfile .'.master ' , 'tpl/ ' .$ configfile .'.master ' );
746750 $ content = str_replace ('{mysql_server_ispconfig_user} ' , $ conf ['mysql ' ]['ispconfig_user ' ], $ content );
747751 $ content = str_replace ('{mysql_server_ispconfig_password} ' , $ conf ['mysql ' ]['ispconfig_password ' ], $ content );
748752 $ content = str_replace ('{mysql_server_database} ' , $ conf ['mysql ' ]['database ' ], $ content );
749753 $ content = str_replace ('{mysql_server_ip} ' , $ conf ['mysql ' ]['ip ' ], $ content );
750754 $ content = str_replace ('{server_id} ' , $ conf ['server_id ' ], $ content );
751755 wf ($ full_file_name , $ content );
756+
757+ //* Changing mode and group of the new created config file
758+ caselog ('chmod u=rw,g=r,o= ' .escapeshellarg ($ full_file_name ).' &> /dev/null ' ,
759+ __FILE__ , __LINE__ , 'chmod on ' .$ full_file_name , 'chmod on ' .$ full_file_name .' failed ' );
760+ caselog ('chgrp ' .escapeshellarg ($ postfix_group ).' ' .escapeshellarg ($ full_file_name ).' &> /dev/null ' ,
761+ __FILE__ , __LINE__ , 'chgrp on ' .$ full_file_name , 'chgrp on ' .$ full_file_name .' failed ' );
762+
752763 }
753764
754765 public function configure_jailkit () {
@@ -1028,12 +1039,6 @@ public function configure_postfix($options = '') {
10281039 }
10291040 wf ($ full_file_name , $ content );
10301041
1031- //* Changing mode and group of the new created config files.
1032- caselog ('chmod u=rw,g=r,o= ' .$ config_dir .'/mysql-virtual_*.cf* &> /dev/null ' ,
1033- __FILE__ , __LINE__ , 'chmod on mysql-virtual_*.cf* ' , 'chmod on mysql-virtual_*.cf* failed ' );
1034- caselog ('chgrp ' .$ cf ['group ' ].' ' .$ config_dir .'/mysql-virtual_*.cf* &> /dev/null ' ,
1035- __FILE__ , __LINE__ , 'chgrp on mysql-virtual_*.cf* ' , 'chgrp on mysql-virtual_*.cf* failed ' );
1036-
10371042 //* Creating virtual mail user and group
10381043 $ command = 'groupadd -g ' .$ cf ['vmail_groupid ' ].' ' .$ cf ['vmail_groupname ' ];
10391044 if (!is_group ($ cf ['vmail_groupname ' ])) caselog ($ command .' &> /dev/null ' , __FILE__ , __LINE__ , "EXECUTED: $ command " , "Failed to execute the command $ command " );
0 commit comments