| | |
| | | |
| | | $configfile = 'sasl_smtpd.conf'; |
| | | if(is_file($conf["dist_postfix_config_dir"].'/sasl/smtpd.conf')) copy($conf["dist_postfix_config_dir"].'/sasl/smtpd.conf',$conf["dist_postfix_config_dir"].'/sasl/smtpd.conf~'); |
| | | exec('chmod 400 '.$conf["dist_postfix_config_dir"].'/sasl/smtpd.conf~'); |
| | | if(is_file($conf["dist_postfix_config_dir"].'/sasl/smtpd.conf~')) exec('chmod 400 '.$conf["dist_postfix_config_dir"].'/sasl/smtpd.conf~'); |
| | | $content = rf("tpl/".$configfile.".master"); |
| | | $content = str_replace('{mysql_server_ispconfig_user}',$conf["mysql_server_ispconfig_user"],$content); |
| | | $content = str_replace('{mysql_server_ispconfig_password}',$conf["mysql_server_ispconfig_password"],$content); |
| | |
| | | // configure pam for SMTP authentication agains the ispconfig database |
| | | $configfile = 'pamd_smtp'; |
| | | if(is_file('/etc/pam.d/smtp')) copy('/etc/pam.d/smtp','/etc/pam.d/smtp~'); |
| | | exec('chmod 400 /etc/pam.d/smtp~'); |
| | | if(is_file('/etc/pam.d/smtp~')) exec('chmod 400 /etc/pam.d/smtp~'); |
| | | $content = rf("tpl/".$configfile.".master"); |
| | | $content = str_replace('{mysql_server_ispconfig_user}',$conf["mysql_server_ispconfig_user"],$content); |
| | | $content = str_replace('{mysql_server_ispconfig_password}',$conf["mysql_server_ispconfig_password"],$content); |
| | |
| | | |
| | | // amavisd user config file |
| | | $configfile = 'amavisd_user_config'; |
| | | if(is_file($conf["dist_amavis_config_dir"].'/50-user')) copy($conf["dist_amavis_config_dir"].'/50-user',$conf["dist_courier_config_dir"].'/50-user~'); |
| | | exec('chmod 400 '.$conf["dist_courier_config_dir"].'/50-user~'); |
| | | if(is_file($conf["dist_amavis_config_dir"].'/conf.d/50-user')) copy($conf["dist_amavis_config_dir"].'/conf.d/50-user',$conf["dist_courier_config_dir"].'/50-user~'); |
| | | if(is_file($conf["dist_amavis_config_dir"].'/conf.d/50-user~')) exec('chmod 400 '.$conf["dist_amavis_config_dir"].'/conf.d/50-user~'); |
| | | $content = rf("tpl/".$configfile.".master"); |
| | | $content = str_replace('{mysql_server_ispconfig_user}',$conf["mysql_server_ispconfig_user"],$content); |
| | | $content = str_replace('{mysql_server_ispconfig_password}',$conf["mysql_server_ispconfig_password"],$content); |
| | | $content = str_replace('{mysql_server_database}',$conf["mysql_server_database"],$content); |
| | | $content = str_replace('{mysql_server_port}',$conf["mysql_server_port"],$content); |
| | | $content = str_replace('{mysql_server_ip}',$conf["mysql_server_ip"],$content); |
| | | wf($conf["dist_amavis_config_dir"].'/50-user',$content); |
| | | wf($conf["dist_amavis_config_dir"].'/conf.d/50-user',$content); |
| | | |
| | | // TODO: chmod and chown on the config file |
| | | |
| | |
| | | wf($configfile,$content); |
| | | } |
| | | |
| | | function configure_getmail() { |
| | | global $conf; |
| | | |
| | | $command = "useradd -b /etc/getmail -d /etc/getmail getmail"; |
| | | caselog($command." &> /dev/null", __FILE__, __LINE__,"EXECUTED: ".$command,"Failed to execute the command ".$command); |
| | | |
| | | $command = "chmod -R 700 /etc/getmail"; |
| | | caselog($command." &> /dev/null", __FILE__, __LINE__,"EXECUTED: ".$command,"Failed to execute the command ".$command); |
| | | } |
| | | |
| | | |
| | | function install_ispconfig() { |
| | | global $conf; |
| | |
| | | $command = "ln -s ".$conf["ispconfig_install_dir"]."/interface/web/ /var/www/ispconfig"; |
| | | caselog($command." &> /dev/null", __FILE__, __LINE__,"EXECUTED: ".$command,"Failed to execute the command ".$command); |
| | | |
| | | // Create the config file for ISPConfig |
| | | // Create the config file for ISPConfig interface |
| | | $configfile = 'config.inc.php'; |
| | | if(is_file($conf["ispconfig_install_dir"].'/interface/lib/'.$configfile)) copy($conf["ispconfig_install_dir"].'/interface/lib/'.$configfile,$conf["ispconfig_install_dir"].'/interface/lib/'.$configfile.'~'); |
| | | $content = rf("tpl/".$configfile.".master"); |
| | |
| | | $content = str_replace('{mysql_server_database}',$conf["mysql_server_database"],$content); |
| | | $content = str_replace('{mysql_server_host}',$conf["mysql_server_host"],$content); |
| | | wf($conf["ispconfig_install_dir"].'/interface/lib/'.$configfile,$content); |
| | | |
| | | // Create the config file for ISPConfig server |
| | | $configfile = 'config.inc.php'; |
| | | if(is_file($conf["ispconfig_install_dir"].'/server/lib/'.$configfile)) copy($conf["ispconfig_install_dir"].'/server/lib/'.$configfile,$conf["ispconfig_install_dir"].'/interface/lib/'.$configfile.'~'); |
| | | $content = rf("tpl/".$configfile.".master"); |
| | | $content = str_replace('{mysql_server_ispconfig_user}',$conf["mysql_server_ispconfig_user"],$content); |
| | | $content = str_replace('{mysql_server_ispconfig_password}',$conf["mysql_server_ispconfig_password"],$content); |
| | | $content = str_replace('{mysql_server_database}',$conf["mysql_server_database"],$content); |
| | | $content = str_replace('{mysql_server_host}',$conf["mysql_server_host"],$content); |
| | | wf($conf["ispconfig_install_dir"].'/server/lib/'.$configfile,$content); |
| | | |
| | | |
| | | // Chmod the files |
| | | $command = "chmod -R 750 ".$conf["ispconfig_install_dir"]; |
| | |
| | | $command = "adduser www-data ispconfig"; |
| | | caselog($command." &> /dev/null", __FILE__, __LINE__,"EXECUTED: ".$command,"Failed to execute the command ".$command); |
| | | |
| | | // Make the shell scripts executable |
| | | $command = "chmod +x ".$conf["ispconfig_install_dir"]."/server/scripts/*.sh"; |
| | | caselog($command." &> /dev/null", __FILE__, __LINE__,"EXECUTED: ".$command,"Failed to execute the command ".$command); |
| | | |
| | | } |
| | | |