Commit 615a0a96 authored by tbrehm's avatar tbrehm

Merged revisions 3960-4065 from stable branch.

parent bdbad50c
...@@ -41,7 +41,7 @@ class installer extends installer_dist { ...@@ -41,7 +41,7 @@ class installer extends installer_dist {
} }
// load files // load files
$content = rf('tpl/mm_cfg.py.master'); $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/mm_cfg.py.master', 'tpl/mm_cfg.py.master');
$old_file = rf($full_file_name); $old_file = rf($full_file_name);
$old_options = array(); $old_options = array();
...@@ -67,7 +67,11 @@ class installer extends installer_dist { ...@@ -67,7 +67,11 @@ class installer extends installer_dist {
copy($full_file_name, $config_dir.'virtual_to_transport.sh~'); copy($full_file_name, $config_dir.'virtual_to_transport.sh~');
} }
copy('tpl/mailman-virtual_to_transport.sh',$full_file_name); if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/mailman-virtual_to_transport.sh')) {
copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/mailman-virtual_to_transport.sh', $full_file_name);
} else {
copy('tpl/mailman-virtual_to_transport.sh',$full_file_name);
}
chgrp($full_file_name,'mailman'); chgrp($full_file_name,'mailman');
chmod($full_file_name,0750); chmod($full_file_name,0750);
...@@ -110,7 +114,7 @@ class installer extends installer_dist { ...@@ -110,7 +114,7 @@ class installer extends installer_dist {
$configfile = 'fedora_amavisd_conf'; $configfile = 'fedora_amavisd_conf';
if(is_file($conf["amavis"]["config_dir"].'/amavisd.conf')) copy($conf["amavis"]["config_dir"].'/amavisd.conf',$conf["amavis"]["config_dir"].'/amavisd.conf~'); if(is_file($conf["amavis"]["config_dir"].'/amavisd.conf')) copy($conf["amavis"]["config_dir"].'/amavisd.conf',$conf["amavis"]["config_dir"].'/amavisd.conf~');
if(is_file($conf["amavis"]["config_dir"].'/amavisd.conf~')) exec('chmod 400 '.$conf["amavis"]["config_dir"].'/amavisd.conf~'); if(is_file($conf["amavis"]["config_dir"].'/amavisd.conf~')) exec('chmod 400 '.$conf["amavis"]["config_dir"].'/amavisd.conf~');
$content = rf("tpl/".$configfile.".master"); $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', "tpl/".$configfile.".master");
$content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content); $content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content);
$content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content); $content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content);
$content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content); $content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content);
...@@ -142,7 +146,7 @@ class installer extends installer_dist { ...@@ -142,7 +146,7 @@ class installer extends installer_dist {
// Only add the content if we had not addded it before // Only add the content if we had not addded it before
if(!stristr($content,"127.0.0.1:10025")) { if(!stristr($content,"127.0.0.1:10025")) {
unset($content); unset($content);
$content = rf("tpl/master_cf_amavis.master"); $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis.master', "tpl/master_cf_amavis.master");
af($conf["postfix"]["config_dir"].'/master.cf',$content); af($conf["postfix"]["config_dir"].'/master.cf',$content);
} }
unset($content); unset($content);
......
...@@ -41,7 +41,7 @@ class installer extends installer_dist { ...@@ -41,7 +41,7 @@ class installer extends installer_dist {
} }
// load files // load files
$content = rf('tpl/mm_cfg.py.master'); $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/mm_cfg.py.master', 'tpl/mm_cfg.py.master');
$old_file = rf($full_file_name); $old_file = rf($full_file_name);
$old_options = array(); $old_options = array();
...@@ -67,7 +67,11 @@ class installer extends installer_dist { ...@@ -67,7 +67,11 @@ class installer extends installer_dist {
copy($full_file_name, $config_dir.'virtual_to_transport.sh~'); copy($full_file_name, $config_dir.'virtual_to_transport.sh~');
} }
copy('tpl/mailman-virtual_to_transport.sh',$full_file_name); if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/mailman-virtual_to_transport.sh')) {
copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/mailman-virtual_to_transport.sh', $full_file_name);
} else {
copy('tpl/mailman-virtual_to_transport.sh',$full_file_name);
}
chgrp($full_file_name,'mailman'); chgrp($full_file_name,'mailman');
chmod($full_file_name,0750); chmod($full_file_name,0750);
...@@ -111,7 +115,7 @@ class installer extends installer_dist { ...@@ -111,7 +115,7 @@ class installer extends installer_dist {
if(is_file($conf["amavis"]["config_dir"].'/amavisd.conf')) copy($conf["amavis"]["config_dir"].'/amavisd.conf',$conf["amavis"]["config_dir"].'/amavisd.conf~'); if(is_file($conf["amavis"]["config_dir"].'/amavisd.conf')) copy($conf["amavis"]["config_dir"].'/amavisd.conf',$conf["amavis"]["config_dir"].'/amavisd.conf~');
if(is_file($conf["amavis"]["config_dir"].'/amavisd.conf~')) exec('chmod 400 '.$conf["amavis"]["config_dir"].'/amavisd.conf~'); if(is_file($conf["amavis"]["config_dir"].'/amavisd.conf~')) exec('chmod 400 '.$conf["amavis"]["config_dir"].'/amavisd.conf~');
if(!is_dir($conf["amavis"]["config_dir"])) mkdir($conf["amavis"]["config_dir"]); if(!is_dir($conf["amavis"]["config_dir"])) mkdir($conf["amavis"]["config_dir"]);
$content = rf("tpl/".$configfile.".master"); $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', "tpl/".$configfile.".master");
$content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content); $content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content);
$content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content); $content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content);
$content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content); $content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content);
...@@ -143,7 +147,7 @@ class installer extends installer_dist { ...@@ -143,7 +147,7 @@ class installer extends installer_dist {
// Only add the content if we had not addded it before // Only add the content if we had not addded it before
if(!stristr($content,"127.0.0.1:10025")) { if(!stristr($content,"127.0.0.1:10025")) {
unset($content); unset($content);
$content = rf("tpl/master_cf_amavis.master"); $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis.master', "tpl/master_cf_amavis.master");
af($conf["postfix"]["config_dir"].'/master.cf',$content); af($conf["postfix"]["config_dir"].'/master.cf',$content);
} }
unset($content); unset($content);
......
...@@ -86,9 +86,17 @@ class installer extends installer_base { ...@@ -86,9 +86,17 @@ class installer extends installer_base {
//* Copy dovecot configuration file //* Copy dovecot configuration file
if($dovecot_version == 2) { if($dovecot_version == 2) {
copy('tpl/debian6_dovecot2.conf.master',$config_dir.'/'.$configfile); if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/debian6_dovecot2.conf.master')) {
copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/debian6_dovecot2.conf.master', $config_dir.'/'.$configfile);
} else {
copy('tpl/debian6_dovecot2.conf.master',$config_dir.'/'.$configfile);
}
} else { } else {
copy('tpl/debian6_dovecot.conf.master',$config_dir.'/'.$configfile); if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/debian6_dovecot.conf.master')) {
copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/debian6_dovecot.conf.master', $config_dir.'/'.$configfile);
} else {
copy('tpl/debian6_dovecot.conf.master',$config_dir.'/'.$configfile);
}
} }
//* dovecot-sql.conf //* dovecot-sql.conf
...@@ -97,7 +105,7 @@ class installer extends installer_base { ...@@ -97,7 +105,7 @@ class installer extends installer_base {
copy($config_dir.'/'.$configfile, $config_dir.'/'.$configfile.'~'); copy($config_dir.'/'.$configfile, $config_dir.'/'.$configfile.'~');
chmod($config_dir.'/'.$configfile.'~', 0400); chmod($config_dir.'/'.$configfile.'~', 0400);
} }
$content = rf('tpl/debian6_dovecot-sql.conf.master'); $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/debian6_dovecot-sql.conf.master', 'tpl/debian6_dovecot-sql.conf.master');
$content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content); $content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content);
$content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content); $content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content);
$content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content); $content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content);
......
...@@ -41,7 +41,7 @@ class installer_dist extends installer_base { ...@@ -41,7 +41,7 @@ class installer_dist extends installer_base {
} }
// load files // load files
$content = rf('tpl/mm_cfg.py.master'); $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/mm_cfg.py.master', 'tpl/mm_cfg.py.master');
$old_file = rf($full_file_name); $old_file = rf($full_file_name);
$old_options = array(); $old_options = array();
...@@ -98,7 +98,11 @@ class installer_dist extends installer_base { ...@@ -98,7 +98,11 @@ class installer_dist extends installer_base {
} }
if(is_dir('/etc/mailman')) { if(is_dir('/etc/mailman')) {
copy('tpl/mailman-virtual_to_transport.sh',$full_file_name); if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/mailman-virtual_to_transport.sh')) {
copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/mailman-virtual_to_transport.sh', $full_file_name);
} else {
copy('tpl/mailman-virtual_to_transport.sh',$full_file_name);
}
chgrp($full_file_name,'mailman'); chgrp($full_file_name,'mailman');
chmod($full_file_name,0750); chmod($full_file_name,0750);
} }
...@@ -162,38 +166,16 @@ class installer_dist extends installer_base { ...@@ -162,38 +166,16 @@ class installer_dist extends installer_base {
if(!is_user($cf['vmail_username'])) caselog("$command &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); if(!is_user($cf['vmail_username'])) caselog("$command &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
//* These postconf commands will be executed on installation and update //* These postconf commands will be executed on installation and update
$postconf_commands = array ( $postconf_placeholders = array('{config_dir}' => $config_dir,
'virtual_alias_domains =', '{vmail_mailbox_base}' => $cf['vmail_mailbox_base'],
'virtual_alias_maps = proxy:mysql:'.$config_dir.'/mysql-virtual_forwardings.cf, mysql:'.$config_dir.'/mysql-virtual_email2email.cf', '{vmail_userid}' => $cf['vmail_userid'],
'virtual_mailbox_domains = proxy:mysql:'.$config_dir.'/mysql-virtual_domains.cf', '{vmail_groupid}' => $cf['vmail_groupid'],
'virtual_mailbox_maps = proxy:mysql:'.$config_dir.'/mysql-virtual_mailboxes.cf', '{rbl_list}' => $rbl_list);
'virtual_mailbox_base = '.$cf['vmail_mailbox_base'],
'virtual_uid_maps = static:'.$cf['vmail_userid'], $postconf_tpl = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/fedora_postfix.conf.master', 'tpl/fedora_postfix.conf.master');
'virtual_gid_maps = static:'.$cf['vmail_groupid'], $postconf_tpl = strtr($postconf_tpl, $postconf_placeholders);
'smtpd_sasl_auth_enable = yes', $postconf_commands = array_filter(explode("\n", $postconf_tpl)); // read and remove empty lines
'broken_sasl_auth_clients = yes',
'smtpd_sasl_authenticated_header = yes',
'smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, check_recipient_access mysql:'.$config_dir.'/mysql-virtual_recipient.cf, reject_unauth_destination',
'smtpd_use_tls = yes',
'smtpd_tls_security_level = may',
'smtpd_tls_cert_file = '.$config_dir.'/smtpd.cert',
'smtpd_tls_key_file = '.$config_dir.'/smtpd.key',
'transport_maps = hash:/var/lib/mailman/data/transport-mailman, proxy:mysql:'.$config_dir.'/mysql-virtual_transports.cf',
'relay_domains = mysql:'.$config_dir.'/mysql-virtual_relaydomains.cf',
'relay_recipient_maps = mysql:'.$config_dir.'/mysql-virtual_relayrecipientmaps.cf',
'proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps',
'smtpd_sender_restrictions = check_sender_access mysql:'.$config_dir.'/mysql-virtual_sender.cf',
'smtpd_client_restrictions = check_client_access mysql:'.$config_dir.'/mysql-virtual_client.cf',
'maildrop_destination_concurrency_limit = 1',
'maildrop_destination_recipient_limit = 1',
'virtual_transport = maildrop',
'header_checks = regexp:'.$config_dir.'/header_checks',
'mime_header_checks = regexp:'.$config_dir.'/mime_header_checks',
'nested_header_checks = regexp:'.$config_dir.'/nested_header_checks',
'body_checks = regexp:'.$config_dir.'/body_checks',
'inet_interfaces = all'
);
//* These postconf commands will be executed on installation only //* These postconf commands will be executed on installation only
if($this->is_update == false) { if($this->is_update == false) {
$postconf_commands = array_merge($postconf_commands,array( $postconf_commands = array_merge($postconf_commands,array(
...@@ -278,7 +260,7 @@ class installer_dist extends installer_base { ...@@ -278,7 +260,7 @@ class installer_dist extends installer_base {
if(is_file($cf['vmail_mailbox_base'].'/.'.$configfile)){ if(is_file($cf['vmail_mailbox_base'].'/.'.$configfile)){
copy($cf['vmail_mailbox_base'].'/.'.$configfile, $cf['vmail_mailbox_base'].'/.'.$configfile.'~'); copy($cf['vmail_mailbox_base'].'/.'.$configfile, $cf['vmail_mailbox_base'].'/.'.$configfile.'~');
} }
$content = rf("tpl/$configfile.master"); $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', "tpl/$configfile.master");
$content = str_replace('{dist_postfix_vmail_mailbox_base}', $cf['vmail_mailbox_base'], $content); $content = str_replace('{dist_postfix_vmail_mailbox_base}', $cf['vmail_mailbox_base'], $content);
wf($cf['vmail_mailbox_base'].'/.'.$configfile, $content); wf($cf['vmail_mailbox_base'].'/.'.$configfile, $content);
...@@ -299,7 +281,7 @@ class installer_dist extends installer_base { ...@@ -299,7 +281,7 @@ class installer_dist extends installer_base {
global $conf; global $conf;
$configfile = 'tpl/fedora_saslauthd_smtpd_conf.master'; $configfile = 'tpl/fedora_saslauthd_smtpd_conf.master';
$content = rf($configfile); $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/fedora_saslauthd_smtpd_conf.master', $configfile);
wf('/usr/lib/sasl2/smtpd.conf',$content); wf('/usr/lib/sasl2/smtpd.conf',$content);
if(is_dir('/usr/lib64')) wf('/usr/lib64/sasl/smtpd.conf',$content); if(is_dir('/usr/lib64')) wf('/usr/lib64/sasl/smtpd.conf',$content);
if(is_dir('/usr/lib64')) wf('/usr/lib64/sasl2/smtpd.conf',$content); if(is_dir('/usr/lib64')) wf('/usr/lib64/sasl2/smtpd.conf',$content);
...@@ -315,7 +297,7 @@ class installer_dist extends installer_base { ...@@ -315,7 +297,7 @@ class installer_dist extends installer_base {
if(is_file("$pam/smtp")) copy("$pam/smtp", "$pam/smtp~"); if(is_file("$pam/smtp")) copy("$pam/smtp", "$pam/smtp~");
if(is_file("$pam/smtp~")) exec("chmod 400 $pam/smtp~"); if(is_file("$pam/smtp~")) exec("chmod 400 $pam/smtp~");
$content = rf("tpl/$configfile.master"); $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', "tpl/$configfile.master");
$content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content); $content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content);
$content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content); $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
$content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content); $content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
...@@ -338,7 +320,7 @@ class installer_dist extends installer_base { ...@@ -338,7 +320,7 @@ class installer_dist extends installer_base {
copy("$config_dir/$configfile", "$config_dir/$configfile~"); copy("$config_dir/$configfile", "$config_dir/$configfile~");
} }
exec("chmod 400 $config_dir/$configfile~"); exec("chmod 400 $config_dir/$configfile~");
$content = rf("tpl/$configfile.master"); $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', "tpl/$configfile.master");
$content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content); $content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content);
$content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content); $content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content);
$content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content); $content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content);
...@@ -421,11 +403,19 @@ class installer_dist extends installer_base { ...@@ -421,11 +403,19 @@ class installer_dist extends installer_base {
//* Copy dovecot configuration file //* Copy dovecot configuration file
if($dovecot_version == 2) { if($dovecot_version == 2) {
copy('tpl/fedora_dovecot2.conf.master',$config_dir.'/'.$configfile); if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/fedora_dovecot2.conf.master')) {
copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/fedora_dovecot2.conf.master', $config_dir.'/'.$configfile);
} else {
copy('tpl/fedora_dovecot2.conf.master',$config_dir.'/'.$configfile);
}
} else { } else {
copy('tpl/fedora_dovecot.conf.master',$config_dir.'/'.$configfile); if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/fedora_dovecot.conf.master')) {
copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/fedora_dovecot.conf.master', $config_dir.'/'.$configfile);
} else {
copy('tpl/fedora_dovecot.conf.master',$config_dir.'/'.$configfile);
}
} }
//* dovecot-sql.conf //* dovecot-sql.conf
$configfile = 'dovecot-sql.conf'; $configfile = 'dovecot-sql.conf';
if(is_file("$config_dir/$configfile")){ if(is_file("$config_dir/$configfile")){
...@@ -433,7 +423,7 @@ class installer_dist extends installer_base { ...@@ -433,7 +423,7 @@ class installer_dist extends installer_base {
exec("chmod 400 $config_dir/$configfile~"); exec("chmod 400 $config_dir/$configfile~");
} }
$content = rf("tpl/fedora_dovecot-sql.conf.master"); $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/fedora_dovecot-sql.conf.master', "tpl/fedora_dovecot-sql.conf.master");
$content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content); $content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content);
$content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content); $content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content);
$content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content); $content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content);
...@@ -452,7 +442,7 @@ class installer_dist extends installer_base { ...@@ -452,7 +442,7 @@ class installer_dist extends installer_base {
$configfile = 'fedora_amavisd_conf'; $configfile = 'fedora_amavisd_conf';
if(is_file($conf["amavis"]["config_dir"].'/amavisd.conf')) copy($conf["amavis"]["config_dir"].'/amavisd.conf',$conf["amavis"]["config_dir"].'/amavisd.conf~'); if(is_file($conf["amavis"]["config_dir"].'/amavisd.conf')) copy($conf["amavis"]["config_dir"].'/amavisd.conf',$conf["amavis"]["config_dir"].'/amavisd.conf~');
if(is_file($conf["amavis"]["config_dir"].'/amavisd.conf~')) exec('chmod 400 '.$conf["amavis"]["config_dir"].'/amavisd.conf~'); if(is_file($conf["amavis"]["config_dir"].'/amavisd.conf~')) exec('chmod 400 '.$conf["amavis"]["config_dir"].'/amavisd.conf~');
$content = rf("tpl/".$configfile.".master"); $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', "tpl/".$configfile.".master");
$content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content); $content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content);
$content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content); $content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content);
$content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content); $content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content);
...@@ -483,7 +473,7 @@ class installer_dist extends installer_base { ...@@ -483,7 +473,7 @@ class installer_dist extends installer_base {
// Only add the content if we had not addded it before // Only add the content if we had not addded it before
if(!stristr($content,"127.0.0.1:10025")) { if(!stristr($content,"127.0.0.1:10025")) {
unset($content); unset($content);
$content = rf("tpl/master_cf_amavis.master"); $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis.master', "tpl/master_cf_amavis.master");
af($conf["postfix"]["config_dir"].'/master.cf',$content); af($conf["postfix"]["config_dir"].'/master.cf',$content);
} }
unset($content); unset($content);
...@@ -546,7 +536,7 @@ class installer_dist extends installer_base { ...@@ -546,7 +536,7 @@ class installer_dist extends installer_base {
if(is_file("$config_dir/$configfile~")){ if(is_file("$config_dir/$configfile~")){
exec("chmod 400 $config_dir/$configfile~"); exec("chmod 400 $config_dir/$configfile~");
} }
$content = rf('tpl/pureftpd_mysql.conf.master'); $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/pureftpd_mysql.conf.master', 'tpl/pureftpd_mysql.conf.master');
$content = str_replace('{mysql_server_ispconfig_user}', $conf["mysql"]["ispconfig_user"], $content); $content = str_replace('{mysql_server_ispconfig_user}', $conf["mysql"]["ispconfig_user"], $content);
$content = str_replace('{mysql_server_ispconfig_password}', $conf["mysql"]["ispconfig_password"], $content); $content = str_replace('{mysql_server_ispconfig_password}', $conf["mysql"]["ispconfig_password"], $content);
$content = str_replace('{mysql_server_database}', $conf["mysql"]["database"], $content); $content = str_replace('{mysql_server_database}', $conf["mysql"]["database"], $content);
...@@ -557,7 +547,11 @@ class installer_dist extends installer_base { ...@@ -557,7 +547,11 @@ class installer_dist extends installer_base {
exec("chown root:root $config_dir/$configfile"); exec("chown root:root $config_dir/$configfile");
// copy our customized copy of pureftpd.conf to the pure-ftpd config directory // copy our customized copy of pureftpd.conf to the pure-ftpd config directory
exec("cp tpl/fedora_pureftpd_conf.master $config_dir/pure-ftpd.conf"); if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/fedora_pureftpd_conf.master')) {
exec("cp " . $conf['ispconfig_install_dir'].'/server/conf-custom/install/fedora_pureftpd_conf.master ' . "$config_dir/pure-ftpd.conf");
}else {
exec("cp tpl/fedora_pureftpd_conf.master $config_dir/pure-ftpd.conf");
}
} }
...@@ -569,7 +563,7 @@ class installer_dist extends installer_base { ...@@ -569,7 +563,7 @@ class installer_dist extends installer_base {
$configfile = 'mydns.conf'; $configfile = 'mydns.conf';
if(is_file($conf["mydns"]["config_dir"].'/'.$configfile)) copy($conf["mydns"]["config_dir"].'/'.$configfile,$conf["mydns"]["config_dir"].'/'.$configfile.'~'); if(is_file($conf["mydns"]["config_dir"].'/'.$configfile)) copy($conf["mydns"]["config_dir"].'/'.$configfile,$conf["mydns"]["config_dir"].'/'.$configfile.'~');
if(is_file($conf["mydns"]["config_dir"].'/'.$configfile.'~')) exec('chmod 400 '.$conf["mydns"]["config_dir"].'/'.$configfile.'~'); if(is_file($conf["mydns"]["config_dir"].'/'.$configfile.'~')) exec('chmod 400 '.$conf["mydns"]["config_dir"].'/'.$configfile.'~');
$content = rf("tpl/".$configfile.".master"); $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', "tpl/".$configfile.".master");
$content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content); $content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content);
$content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content); $content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content);
$content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content); $content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content);
...@@ -633,7 +627,7 @@ class installer_dist extends installer_base { ...@@ -633,7 +627,7 @@ class installer_dist extends installer_base {
$vhost_conf_enabled_dir = $conf['apache']['vhost_conf_enabled_dir']; $vhost_conf_enabled_dir = $conf['apache']['vhost_conf_enabled_dir'];
// copy('tpl/apache_ispconfig.conf.master',$vhost_conf_dir.'/ispconfig.conf'); // copy('tpl/apache_ispconfig.conf.master',$vhost_conf_dir.'/ispconfig.conf');
$content = rf('tpl/apache_ispconfig.conf.master'); $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/apache_ispconfig.conf.master', 'tpl/apache_ispconfig.conf.master');
$records = $this->db->queryAllRecords('SELECT * FROM '.$conf['mysql']['master_database'].'.server_ip WHERE server_id = '.$conf['server_id']." AND virtualhost = 'y'"); $records = $this->db->queryAllRecords('SELECT * FROM '.$conf['mysql']['master_database'].'.server_ip WHERE server_id = '.$conf['server_id']." AND virtualhost = 'y'");
if(is_array($records) && count($records) > 0) { if(is_array($records) && count($records) > 0) {
...@@ -727,7 +721,11 @@ class installer_dist extends installer_base { ...@@ -727,7 +721,11 @@ class installer_dist extends installer_base {
if(is_dir("/etc/Bastille")) caselog("mv -f /etc/Bastille /etc/Bastille.backup", __FILE__, __LINE__); if(is_dir("/etc/Bastille")) caselog("mv -f /etc/Bastille /etc/Bastille.backup", __FILE__, __LINE__);
@mkdir("/etc/Bastille", octdec($directory_mode)); @mkdir("/etc/Bastille", octdec($directory_mode));
if(is_dir("/etc/Bastille.backup/firewall.d")) caselog("cp -pfr /etc/Bastille.backup/firewall.d /etc/Bastille/", __FILE__, __LINE__); if(is_dir("/etc/Bastille.backup/firewall.d")) caselog("cp -pfr /etc/Bastille.backup/firewall.d /etc/Bastille/", __FILE__, __LINE__);
caselog("cp -f tpl/bastille-firewall.cfg.master /etc/Bastille/bastille-firewall.cfg", __FILE__, __LINE__); if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/bastille-firewall.cfg.master')) {
caselog("cp -f " . $conf['ispconfig_install_dir']."/server/conf-custom/install/bastille-firewall.cfg.master /etc/Bastille/bastille-firewall.cfg", __FILE__, __LINE__);
} else {
caselog("cp -f tpl/bastille-firewall.cfg.master /etc/Bastille/bastille-firewall.cfg", __FILE__, __LINE__);
}
caselog("chmod 644 /etc/Bastille/bastille-firewall.cfg", __FILE__, __LINE__); caselog("chmod 644 /etc/Bastille/bastille-firewall.cfg", __FILE__, __LINE__);
$content = rf("/etc/Bastille/bastille-firewall.cfg"); $content = rf("/etc/Bastille/bastille-firewall.cfg");
$content = str_replace("{DNS_SERVERS}", "", $content); $content = str_replace("{DNS_SERVERS}", "", $content);
...@@ -815,7 +813,7 @@ class installer_dist extends installer_base { ...@@ -815,7 +813,7 @@ class installer_dist extends installer_base {
if(is_file($install_dir.'/interface/lib/'.$configfile)){ if(is_file($install_dir.'/interface/lib/'.$configfile)){
copy("$install_dir/interface/lib/$configfile", "$install_dir/interface/lib/$configfile~"); copy("$install_dir/interface/lib/$configfile", "$install_dir/interface/lib/$configfile~");
} }
$content = rf("tpl/$configfile.master"); $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', "tpl/$configfile.master");
$content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content); $content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content);
$content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content); $content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content);
$content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content); $content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
...@@ -839,7 +837,7 @@ class installer_dist extends installer_base { ...@@ -839,7 +837,7 @@ class installer_dist extends installer_base {
if(is_file($install_dir.'/server/lib/'.$configfile)){ if(is_file($install_dir.'/server/lib/'.$configfile)){
copy("$install_dir/server/lib/$configfile", "$install_dir/interface/lib/$configfile~"); copy("$install_dir/server/lib/$configfile", "$install_dir/interface/lib/$configfile~");
} }
$content = rf("tpl/$configfile.master"); $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', "tpl/$configfile.master");
$content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content); $content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content);
$content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content); $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
$content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content); $content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
...@@ -1014,7 +1012,7 @@ class installer_dist extends installer_base { ...@@ -1014,7 +1012,7 @@ class installer_dist extends installer_base {
// Dont just copy over the virtualhost template but add some custom settings // Dont just copy over the virtualhost template but add some custom settings
$content = rf("tpl/apache_ispconfig.vhost.master"); $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/apache_ispconfig.vhost.master', "tpl/apache_ispconfig.vhost.master");
$content = str_replace('{vhost_port}', $conf['apache']['vhost_port'], $content); $content = str_replace('{vhost_port}', $conf['apache']['vhost_port'], $content);
// comment out the listen directive if port is 80 or 443 // comment out the listen directive if port is 80 or 443
...@@ -1055,7 +1053,7 @@ class installer_dist extends installer_base { ...@@ -1055,7 +1053,7 @@ class installer_dist extends installer_base {
replaceLine('/var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter','PHPRC=','PHPRC=/etc/',0,0); replaceLine('/var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter','PHPRC=','PHPRC=/etc/',0,0);
*/ */
//if(!is_file('/var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter')) {