| | |
| | | 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>.')); |
| | |
| | | //** Get the hostname |
| | | $tmp_out = array(); |
| | | exec('hostname -f', $tmp_out); |
| | | $conf['hostname'] = $inst->free_query('Full qualified hostname (FQDN) of the server, eg server1.domain.tld ', @$tmp_out[0],'hostname'); |
| | | |
| | | //** Prevent empty hostname |
| | | $conf['hostname']=trim(@$tmp_out[0]); |
| | | $conf['hostname'] = @$tmp_out[0]; |
| | | unset($tmp_out); |
| | | |
| | | if($conf['hostname'] === '') { |
| | | $check = false; |
| | | do { |
| | | swriteln('Hostname may not be empty.'); |
| | | $conf['hostname'] = $inst->free_query('Full qualified hostname (FQDN) of the server, eg server1.domain.tld ', '', 'hostname'); |
| | | $conf['hostname']=trim($conf['hostname']); |
| | | $check = @($conf['hostname'] !== '')?true:false; |
| | | } while (!$check); |
| | | } |
| | | //** Prevent empty hostname |
| | | $check = false; |
| | | do { |
| | | $conf['hostname'] = $inst->free_query('Full qualified hostname (FQDN) of the server, eg server1.domain.tld ', $conf['hostname'], 'hostname'); |
| | | $conf['hostname']=trim($conf['hostname']); |
| | | $check = @($conf['hostname'] !== '')?true:false; |
| | | if(!$check) swriteln('Hostname may not be empty.'); |
| | | } 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; |
| | | do { |
| | | $tmp_mysql_server_host = $inst->free_query('MySQL server hostname', $conf['mysql']['host'],'mysql_hostname'); |
| | | $tmp_mysql_server_port = $inst->free_query('MySQL server port', $conf['mysql']['port'],'mysql_port'); |
| | | $tmp_mysql_server_admin_user = $inst->free_query('MySQL root username', $conf['mysql']['admin_user'],'mysql_root_user'); |
| | | $tmp_mysql_server_admin_password = $inst->free_query('MySQL root password', $conf['mysql']['admin_password'],'mysql_root_password'); |
| | | $tmp_mysql_server_database = $inst->free_query('MySQL database to create', $conf['mysql']['database'],'mysql_database'); |
| | |
| | | } |
| | | |
| | | //* Initialize the MySQL server connection |
| | | if(@mysql_connect($tmp_mysql_server_host, $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']['admin_password'] = $tmp_mysql_server_admin_password; |
| | | $conf['mysql']['database'] = $tmp_mysql_server_database; |
| | | $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(); |
| | | |
| | |
| | | $inst->add_database_server_record(); |
| | | |
| | | //* Configure Postgrey |
| | | $force = @($conf['postgrey']['installed']) ? true : $inst->force_configure_app('Postgrey'); |
| | | $force = @($conf['postgrey']['installed']) ? true : $inst->force_configure_app('Postgrey', false); |
| | | if($force) swriteln('Configuring Postgrey'); |
| | | |
| | | //* Configure Postfix |
| | | $force = @($conf['postfix']['installed']) ? true : $inst->force_configure_app('Postfix'); |
| | | $force = @($conf['postfix']['installed']) ? true : $inst->force_configure_app('Postfix', false); |
| | | if($force) { |
| | | swriteln('Configuring Postfix'); |
| | | $inst->configure_postfix(); |
| | |
| | | if($conf['services']['mail']) { |
| | | |
| | | //* Configure Mailman |
| | | $force = @($conf['mailman']['installed']) ? true : $inst->force_configure_app('Mailman'); |
| | | $force = @($conf['mailman']['installed']) ? true : $inst->force_configure_app('Mailman', false); |
| | | if($force) { |
| | | swriteln('Configuring Mailman'); |
| | | $inst->configure_mailman(); |
| | |
| | | |
| | | //* Check for Dovecot and Courier |
| | | if(!$conf['dovecot']['installed'] && !$conf['courier']['installed']) { |
| | | $conf['dovecot']['installed'] = $inst->force_configure_app('Dovecot'); |
| | | $conf['courier']['installed'] = $inst->force_configure_app('Courier'); |
| | | $conf['dovecot']['installed'] = $inst->force_configure_app('Dovecot', false); |
| | | $conf['courier']['installed'] = $inst->force_configure_app('Courier', false); |
| | | } |
| | | //* Configure Mailserver - Dovecot or Courier |
| | | if($conf['dovecot']['installed'] && $conf['courier']['installed']) { |
| | |
| | | } |
| | | |
| | | //* Configure Spamasassin |
| | | $force = @($conf['spamassassin']['installed']) ? true : $inst->force_configure_app('Spamassassin'); |
| | | $force = @($conf['spamassassin']['installed']) ? true : $inst->force_configure_app('Spamassassin', false); |
| | | if($force) { |
| | | swriteln('Configuring Spamassassin'); |
| | | $inst->configure_spamassassin(); |
| | | } |
| | | |
| | | //* Configure Amavis |
| | | $force = @($conf['amavis']['installed']) ? true : $inst->force_configure_app('Amavisd'); |
| | | $force = @($conf['amavis']['installed']) ? true : $inst->force_configure_app('Amavisd', false); |
| | | if($force) { |
| | | swriteln('Configuring Amavisd'); |
| | | $inst->configure_amavis(); |
| | | } |
| | | |
| | | //* Configure Getmail |
| | | $force = @($conf['getmail']['installed']) ? true : $inst->force_configure_app('Getmail'); |
| | | $force = @($conf['getmail']['installed']) ? true : $inst->force_configure_app('Getmail', false); |
| | | if($force) { |
| | | swriteln('Configuring Getmail'); |
| | | $inst->configure_getmail(); |
| | |
| | | } 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'); |
| | | $conf['bind']['installed'] = $inst->force_configure_app('BIND'); |
| | | $conf['mydns']['installed'] = $inst->force_configure_app('MyDNS'); |
| | | // 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']) { |
| | |
| | | } |
| | | |
| | | //* Configure Jailkit |
| | | $force = @($conf['jailkit']['installed']) ? true : $inst->force_configure_app('Jailkit'); |
| | | $force = @($conf['jailkit']['installed']) ? true : $inst->force_configure_app('Jailkit', false); |
| | | if($force) { |
| | | swriteln('Configuring Jailkit'); |
| | | $inst->configure_jailkit(); |
| | | } |
| | | |
| | | //* Configure Pureftpd |
| | | $force = @($conf['pureftpd']['installed']) ? true : $inst->force_configure_app('pureftpd'); |
| | | $force = @($conf['pureftpd']['installed']) ? true : $inst->force_configure_app('pureftpd', false); |
| | | if($force) { |
| | | swriteln('Configuring Pureftpd'); |
| | | $inst->configure_pureftpd(); |
| | |
| | | |
| | | //* Check for Web-Server |
| | | if(!$conf['apache']['installed'] && !$conf['nginx']['installed']) { |
| | | $conf['apache']['installed'] = $inst->force_configure_app('Apache'); |
| | | $conf['nginx']['installed'] = $inst->force_configure_app('nginx'); |
| | | $conf['apache']['installed'] = $inst->force_configure_app('Apache', false); |
| | | $conf['nginx']['installed'] = $inst->force_configure_app('nginx', false); |
| | | } |
| | | |
| | | //* Configure Webserver - Apache or nginx |
| | |
| | | $conf['services']['web'] = true; |
| | | $conf['services']['file'] = true; |
| | | //* Configure Vlogger |
| | | $force = @($conf['vlogger']['installed']) ? true : $inst->force_configure_app('vlogger'); |
| | | $force = @($conf['vlogger']['installed']) ? true : $inst->force_configure_app('vlogger', false); |
| | | if($force) { |
| | | swriteln('Configuring vlogger'); |
| | | $inst->configure_vlogger(); |
| | |
| | | } |
| | | |
| | | //* Configure XMPP |
| | | $force = @($conf['xmpp']['installed']) ? true : $inst->force_configure_app('Metronome XMPP Server'); |
| | | $force = @($conf['xmpp']['installed']) ? true : $inst->force_configure_app('Metronome XMPP Server', false); |
| | | if($force) { |
| | | swriteln('Configuring Metronome XMPP Server'); |
| | | $inst->configure_xmpp(); |
| | |
| | | |
| | | //* Check for Firewall |
| | | if(!$conf['ufw']['installed'] && !$conf['firewall']['installed']) { |
| | | $conf['ufw']['installed'] = $inst->force_configure_app('Ubuntu Firewall'); |
| | | $conf['firewall']['installed'] = $inst->force_configure_app('Bastille Firewall'); |
| | | $conf['ufw']['installed'] = $inst->force_configure_app('Ubuntu Firewall', false); |
| | | $conf['firewall']['installed'] = $inst->force_configure_app('Bastille Firewall', false); |
| | | } |
| | | //* Configure Firewall - Ubuntu or Bastille |
| | | if($conf['ufw']['installed'] && $conf['firewall']['installed']) { |
| | |
| | | swriteln('Configuring Bastille Firewall'); |
| | | $inst->configure_bastille_firewall(); |
| | | $conf['services']['firewall'] = true; |
| | | $conf['bastille']['installed'] = true; |
| | | } |
| | | |
| | | //* Configure Fail2ban |
| | | $force = @($conf['fail2ban']['installed']) ? true : $inst->force_configure_app('Fail2ban'); |
| | | $force = @($conf['fail2ban']['installed']) ? true : $inst->force_configure_app('Fail2ban', false); |
| | | if($force) { |
| | | swriteln('Configuring Fail2ban'); |
| | | $inst->configure_fail2ban(); |
| | | } |
| | | |
| | | //* Configure OpenVZ |
| | | $force = @($conf['openvz']['installed']) ? true : $inst->force_configure_app('OpenVZ'); |
| | | $force = @($conf['openvz']['installed']) ? true : $inst->force_configure_app('OpenVZ', false); |
| | | if($force) { |
| | | $conf['services']['vserver'] = true; |
| | | swriteln('Configuring OpenVZ'); |
| | |
| | | $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')); |
| | |
| | | $finished = false; |
| | | do { |
| | | $tmp_mysql_server_host = $inst->free_query('MySQL master server hostname', $conf['mysql']['master_host'],'mysql_master_hostname'); |
| | | $tmp_mysql_server_port = $inst->free_query('MySQL master server port', $conf['mysql']['master_port'],'mysql_master_port'); |
| | | $tmp_mysql_server_admin_user = $inst->free_query('MySQL master server root username', $conf['mysql']['master_admin_user'],'mysql_master_root_user'); |
| | | $tmp_mysql_server_admin_password = $inst->free_query('MySQL master server root password', $conf['mysql']['master_admin_password'],'mysql_master_root_password'); |
| | | $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, $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_admin_password'] = $tmp_mysql_server_admin_password; |
| | | $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(); |
| | | |
| | | |
| | | |