@@ -742,13 +742,23 @@ public function process_postfix_config($configfile) {
742742 if (is_file ($ full_file_name )) {
743743 copy ($ full_file_name , $ config_dir .$ configfile .'~ ' );
744744 }
745+ chmod ($ config_dir .$ configfile .'~ ' ,0600 );
746+
747+ //* Replace variables in config file template
745748 $ content = rfsel ($ conf ['ispconfig_install_dir ' ].'/server/conf-custom/install/ ' .$ configfile .'.master ' , 'tpl/ ' .$ configfile .'.master ' );
746749 $ content = str_replace ('{mysql_server_ispconfig_user} ' , $ conf ['mysql ' ]['ispconfig_user ' ], $ content );
747750 $ content = str_replace ('{mysql_server_ispconfig_password} ' , $ conf ['mysql ' ]['ispconfig_password ' ], $ content );
748751 $ content = str_replace ('{mysql_server_database} ' , $ conf ['mysql ' ]['database ' ], $ content );
749752 $ content = str_replace ('{mysql_server_ip} ' , $ conf ['mysql ' ]['ip ' ], $ content );
750753 $ content = str_replace ('{server_id} ' , $ conf ['server_id ' ], $ content );
751754 wf ($ full_file_name , $ content );
755+
756+ //* Changing mode and group of the new created config file
757+ caselog ('chmod u=rw,g=r,o= ' .$ config_dir .'/ ' .$ full_file_name .' &> /dev/null ' ,
758+ __FILE__ , __LINE__ , 'chmod on ' .$ full_file_name , 'chmod on ' .$ full_file_name .' failed ' );
759+ caselog ('chgrp ' .$ cf ['group ' ].' ' .$ config_dir .'/ ' .$ full_file_name .' &> /dev/null ' ,
760+ __FILE__ , __LINE__ , 'chgrp on ' .$ full_file_name , 'chgrp on ' .$ full_file_name .' failed ' );
761+
752762 }
753763
754764 public function configure_jailkit () {
@@ -1028,12 +1038,6 @@ public function configure_postfix($options = '') {
10281038 }
10291039 wf ($ full_file_name , $ content );
10301040
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-
10371041 //* Creating virtual mail user and group
10381042 $ command = 'groupadd -g ' .$ cf ['vmail_groupid ' ].' ' .$ cf ['vmail_groupname ' ];
10391043 if (!is_group ($ cf ['vmail_groupname ' ])) caselog ($ command .' &> /dev/null ' , __FILE__ , __LINE__ , "EXECUTED: $ command " , "Failed to execute the command $ command " );
0 commit comments