| | |
| | | include_once $cmd_opt['autoinstall']; |
| | | } elseif($path_parts['extension'] == 'ini') { |
| | | $tmp = ini_to_array(file_get_contents('autoinstall.ini')); |
| | | if(!is_array($tmp['install'])) $tmp['install'] = array(); |
| | | if(!is_array($tmp['ssl_cert'])) $tmp['ssl_cert'] = array(); |
| | | if(!is_array($tmp['expert'])) $tmp['expert'] = array(); |
| | | if(!is_array($tmp['update'])) $tmp['update'] = array(); |
| | | $autoinstall = $tmp['install'] + $tmp['ssl_cert'] + $tmp['expert'] + $tmp['update']; |
| | | unset($tmp); |
| | | } |
| | |
| | | //** Installer Interface |
| | | //**************************************************************************************************** |
| | | $inst = new installer(); |
| | | if (!$inst->get_php_version()) die('ISPConfig requieres PHP '.$inst->min_php."\n"); |
| | | $retval=shell_exec("which which"); |
| | | if (empty($retval)) die ("ISPConfig requieres which \n"); |
| | | |
| | | swriteln($inst->lng(' Following will be a few questions for primary configuration so be careful.')); |
| | | swriteln($inst->lng(' Default values are in [brackets] and can be accepted with <ENTER>.')); |
| | |
| | | } while (!$check); |
| | | |
| | | // Check if the mysql functions are loaded in PHP |
| | | if(!function_exists('mysql_connect')) die('No PHP MySQL functions available. Please ensure that the PHP MySQL module is loaded.'); |
| | | if(!function_exists('mysqli_connect')) die('No PHP MySQLi functions available. Please ensure that the PHP MySQL module is loaded.'); |
| | | |
| | | //** Get MySQL root credentials |
| | | $finished = false; |
| | |
| | | } |
| | | |
| | | //* Initialize the MySQL server connection |
| | | if(@mysql_connect($tmp_mysql_server_host . ':' . (int)$tmp_mysql_server_port, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password)) { |
| | | if(@mysqli_connect($tmp_mysql_server_host, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password, '', (int)$tmp_mysql_server_port)) { |
| | | $conf['mysql']['host'] = $tmp_mysql_server_host; |
| | | $conf['mysql']['port'] = $tmp_mysql_server_port; |
| | | $conf['mysql']['admin_user'] = $tmp_mysql_server_admin_user; |
| | |
| | | $conf['mysql']['charset'] = $tmp_mysql_server_charset; |
| | | $finished = true; |
| | | } else { |
| | | swriteln($inst->lng('Unable to connect to the specified MySQL server').' '.mysql_error()); |
| | | swriteln($inst->lng('Unable to connect to the specified MySQL server').' '.mysqli_connect_error()); |
| | | } |
| | | } while ($finished == false); |
| | | unset($finished); |
| | |
| | | |
| | | if($install_mode == 'standard') { |
| | | |
| | | $inst->dbmaster = $inst->db; |
| | | |
| | | //* Create the MySQL database |
| | | $inst->configure_database(); |
| | | |
| | |
| | | } else swriteln('[ERROR] Postfix not installed - skipping Mail'); |
| | | |
| | | //* Check for DNS |
| | | if(!$conf['powerdns']['installed'] && !$conf['bind']['installed'] && !$conf['mydns']['installed']) { |
| | | $conf['powerdns']['installed'] = $inst->force_configure_app('PowerDNS', false); |
| | | // if(!$conf['powerdns']['installed'] && !$conf['bind']['installed'] && !$conf['mydns']['installed']) { |
| | | if(!$conf['bind']['installed'] && !$conf['mydns']['installed']) { |
| | | // $conf['powerdns']['installed'] = $inst->force_configure_app('PowerDNS', false); |
| | | $conf['bind']['installed'] = $inst->force_configure_app('BIND', false); |
| | | $conf['mydns']['installed'] = $inst->force_configure_app('MyDNS', false); |
| | | } |
| | | //* Configure PowerDNS |
| | | /* |
| | | if($conf['powerdns']['installed']) { |
| | | swriteln('Configuring PowerDNS'); |
| | | $inst->configure_powerdns(); |
| | | $conf['services']['dns'] = true; |
| | | } |
| | | */ |
| | | |
| | | //* Configure Bind |
| | | if($conf['bind']['installed']) { |
| | | swriteln('Configuring BIND'); |
| | | $inst->configure_bind(); |
| | | $conf['services']['dns'] = true; |
| | | if(!is_installed('haveged')) { |
| | | swriteln("[INFO] haveged not detected - DNSSEC can fail"); |
| | | } |
| | | } |
| | | //* Configure MyDNS |
| | | if($conf['mydns']['installed']) { |
| | |
| | | swriteln('Configuring Bastille Firewall'); |
| | | $inst->configure_bastille_firewall(); |
| | | $conf['services']['firewall'] = true; |
| | | $conf['bastille']['installed'] = true; |
| | | } |
| | | |
| | | //* Configure Fail2ban |
| | |
| | | $inst->install_crontab(); |
| | | } else swriteln('[ERROR] Cron not found'); |
| | | |
| | | swriteln('Detect IP addresses'); |
| | | $inst->detect_ips(); |
| | | |
| | | swriteln('Restarting services ...'); |
| | | if($conf['mysql']['installed'] == true && $conf['mysql']['init_script'] != '') system($inst->getinitcommand($conf['mysql']['init_script'], 'restart').' >/dev/null 2>&1'); |
| | | if($conf['postfix']['installed'] == true && $conf['postfix']['init_script'] != '') system($inst->getinitcommand($conf['postfix']['init_script'], 'restart')); |
| | |
| | | $tmp_mysql_server_database = $inst->free_query('MySQL master server database name', $conf['mysql']['master_database'],'mysql_master_database'); |
| | | |
| | | //* Initialize the MySQL server connection |
| | | if(@mysql_connect($tmp_mysql_server_host . ':' . (int)$tmp_mysql_server_port, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password)) { |
| | | if(@mysqli_connect($tmp_mysql_server_host, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password, $tmp_mysql_server_database, (int)$tmp_mysql_server_port)) { |
| | | $conf['mysql']['master_host'] = $tmp_mysql_server_host; |
| | | $conf['mysql']['master_port'] = $tmp_mysql_server_port; |
| | | $conf['mysql']['master_admin_user'] = $tmp_mysql_server_admin_user; |
| | |
| | | $conf['mysql']['master_database'] = $tmp_mysql_server_database; |
| | | $finished = true; |
| | | } else { |
| | | swriteln($inst->lng('Unable to connect to mysql server').' '.mysql_error()); |
| | | swriteln($inst->lng('Unable to connect to mysql server').' '.mysqli_connect_error()); |
| | | } |
| | | } while ($finished == false); |
| | | unset($finished); |
| | |
| | | swriteln('Configuring Pureftpd'); |
| | | $inst->configure_pureftpd(); |
| | | } |
| | | |
| | | |
| | | //** Configure DNS |
| | | if(strtolower($inst->simple_query('Configure DNS Server', array('y', 'n'), 'y','configure_dns')) == 'y') { |
| | | $conf['services']['dns'] = true; |
| | |
| | | swriteln('Configuring BIND'); |
| | | $inst->configure_bind(); |
| | | $conf['services']['dns'] = true; |
| | | if(!is_installed('haveged')) { |
| | | swriteln("[INFO] haveged not detected - DNSSEC can fail"); |
| | | } |
| | | } |
| | | //* Configure MyDNS |
| | | if($conf['mydns']['installed']) { |
| | |
| | | } |
| | | } |
| | | |
| | | if($conf['openvz']['installed'] = true && strtolower($inst->simple_query('Enable Openvz-Server', array('y', 'n'), 'y','configure_openvz')) == 'y') |
| | | $conf['services']['vserver'] = true; |
| | | //* Configure OpenVZ |
| | | $force = @($conf['openvz']['installed']) ? true : $inst->force_configure_app('OpenVZ'); |
| | | if($force) { |
| | | $conf['services']['vserver'] = true; |
| | | swriteln('Configuring OpenVZ'); |
| | | } |
| | | |
| | | if(strtolower($inst->simple_query('Configure Firewall Server', array('y', 'n'), 'y','configure_firewall')) == 'y') { |
| | | //* Check for Firewall |
| | |
| | | if($conf['nginx']['php_fpm_init_script'] != '') system($inst->getinitcommand($conf['nginx']['php_fpm_init_script'], 'reload')); |
| | | if($conf['nginx']['init_script'] != '') system($inst->getinitcommand($conf['nginx']['init_script'], 'reload')); |
| | | } |
| | | |
| | | swriteln('Detect IP addresses'); |
| | | $inst->detect_ips(); |
| | | |
| | | |
| | | |