| | |
| | | //** 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'); |
| | | $conf['hostname'] = @$tmp_out[0]; |
| | | unset($tmp_out); |
| | | //** 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.'); |
| | |
| | | $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(@mysql_connect($tmp_mysql_server_host . ':' . (int)$tmp_mysql_server_port, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password)) { |
| | | $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; |
| | |
| | | $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'] = @($conf['dovecot']['installed']) ? false : $inst->force_configure_app('Dovecot'); |
| | | $conf['courier']['installed'] = @($conf['couier']['installed']) ? false : $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(); |
| | |
| | | |
| | | //* 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'); |
| | | $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']) { |
| | |
| | | } |
| | | |
| | | //* 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']) { |
| | |
| | | } |
| | | |
| | | //* 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'); |
| | |
| | | |
| | | //** Customize the port ISPConfig runs on |
| | | $ispconfig_vhost_port = $inst->free_query('ISPConfig Port', '8080','ispconfig_port'); |
| | | $conf['interface_password'] = $inst->free_query('Admin password', 'admin'); |
| | | if($conf['interface_password'] != 'admin') { |
| | | $check = false; |
| | | do { |
| | | unset($temp_password); |
| | | $temp_password = $inst->free_query('Re-enter admin password', ''); |
| | | $check = @($temp_password == $conf['interface_password'])?true:false; |
| | | if(!$check) swriteln('Passwords do not match.'); |
| | | } while (!$check); |
| | | } |
| | | unset($check); |
| | | unset($temp_password); |
| | | if($conf['apache']['installed'] == true) $conf['apache']['vhost_port'] = $ispconfig_vhost_port; |
| | | if($conf['nginx']['installed'] == true) $conf['nginx']['vhost_port'] = $ispconfig_vhost_port; |
| | | unset($ispconfig_vhost_port); |
| | |
| | | $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(@mysql_connect($tmp_mysql_server_host . ':' . (int)$tmp_mysql_server_port, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password)) { |
| | | $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; |
| | |
| | | |
| | | //* Check for Dovecot and Courier |
| | | if(!$conf['dovecot']['installed'] && !$conf['courier']['installed']) { |
| | | $conf['dovecot']['installed'] = @($conf['dovecot']['installed']) ? false : $inst->force_configure_app('Dovecot'); |
| | | $conf['courier']['installed'] = @($conf['couier']['installed']) ? false : $inst->force_configure_app('Courier'); |
| | | $conf['dovecot']['installed'] = $inst->force_configure_app('Dovecot'); |
| | | $conf['courier']['installed'] = $inst->force_configure_app('Courier'); |
| | | } |
| | | //* Configure Mailserver - Dovecot or Courier |
| | | if($conf['dovecot']['installed'] && $conf['courier']['installed']) { |
| | |
| | | |
| | | //** Customise the port ISPConfig runs on |
| | | $ispconfig_vhost_port = $inst->free_query('ISPConfig Port', '8080','ispconfig_port'); |
| | | $conf['interface_password'] = $inst->free_query('Admin password', 'admin'); |
| | | if($conf['interface_password'] != 'admin') { |
| | | $check = false; |
| | | do { |
| | | unset($temp_password); |
| | | $temp_password = $inst->free_query('Re-enter admin password', ''); |
| | | $check = @($temp_password == $conf['interface_password'])?true:false; |
| | | if(!$check) swriteln('Passwords do not match.'); |
| | | } while (!$check); |
| | | } |
| | | unset($check); |
| | | unset($temp_password); |
| | | if($conf['apache']['installed'] == true) $conf['apache']['vhost_port'] = $ispconfig_vhost_port; |
| | | if($conf['nginx']['installed'] == true) $conf['nginx']['vhost_port'] = $ispconfig_vhost_port; |
| | | unset($ispconfig_vhost_port); |