| | |
| | | public $is_update = false; // true if it is an update, falsi if it is a new install |
| | | |
| | | |
| | | public function __construct() |
| | | { |
| | | public function __construct() { |
| | | global $conf; //TODO: maybe $conf should be passed to constructor |
| | | //$this->conf = $conf; |
| | | } |
| | | |
| | | //: TODO Implement the translation function and language files for the installer. |
| | | public function lng($text) |
| | | { |
| | | public function lng($text) { |
| | | return $text; |
| | | } |
| | | |
| | | public function error($msg) |
| | | { |
| | | public function error($msg) { |
| | | die("ERROR: ".$msg."\n"); |
| | | } |
| | | |
| | | public function simple_query($query, $answers, $default) |
| | | { |
| | | public function simple_query($query, $answers, $default) { |
| | | $finished = false; |
| | | do { |
| | | $answers_str = implode(',', $answers); |
| | |
| | | return $answer; |
| | | } |
| | | |
| | | public function free_query($query,$default) |
| | | { |
| | | public function free_query($query,$default) { |
| | | swrite($this->lng($query).' ['.$default.']: '); |
| | | $input = sread(); |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | public function grant_master_database_rights() |
| | | { |
| | | public function grant_master_database_rights() { |
| | | global $conf; |
| | | |
| | | if($conf['mysql']['master_slave_setup'] != 'y') return; |
| | |
| | | } |
| | | |
| | | //** writes postfix configuration files |
| | | public function process_postfix_config($configfile) |
| | | { |
| | | public function process_postfix_config($configfile) { |
| | | global $conf; |
| | | |
| | | $config_dir = $conf['postfix']['config_dir'].'/'; |
| | |
| | | wf($full_file_name, $content); |
| | | } |
| | | |
| | | public function configure_jailkit() |
| | | { |
| | | public function configure_jailkit() { |
| | | global $conf; |
| | | |
| | | $cf = $conf['jailkit']; |
| | |
| | | $jk_init = $cf['jk_init']; |
| | | $jk_chrootsh = $cf['jk_chrootsh']; |
| | | |
| | | if (is_dir($config_dir)) |
| | | { |
| | | if (is_dir($config_dir)) { |
| | | if(is_file($config_dir.'/'.$jk_init)) copy($config_dir.'/'.$jk_init, $config_dir.'/'.$jk_init.'~'); |
| | | if(is_file($config_dir.'/'.$jk_chrootsh.".master")) copy($config_dir.'/'.$jk_chrootsh.".master", $config_dir.'/'.$jk_chrootsh.'~'); |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | public function configure_postfix($options = '') |
| | | { |
| | | public function configure_postfix($options = '') { |
| | | global $conf; |
| | | $cf = $conf['postfix']; |
| | | $config_dir = $cf['config_dir']; |
| | |
| | | |
| | | } |
| | | |
| | | public function configure_pam() |
| | | { |
| | | public function configure_pam() { |
| | | global $conf; |
| | | $pam = $conf['pam']; |
| | | //* configure pam for SMTP authentication agains the ispconfig database |
| | |
| | | |
| | | } |
| | | |
| | | public function configure_courier() |
| | | { |
| | | public function configure_courier() { |
| | | global $conf; |
| | | $config_dir = $conf['courier']['config_dir']; |
| | | //* authmysqlrc |
| | |
| | | wf($configfile, $content); |
| | | } |
| | | |
| | | public function configure_dovecot() |
| | | { |
| | | public function configure_dovecot() { |
| | | global $conf; |
| | | |
| | | $config_dir = $conf['dovecot']['config_dir']; |
| | |
| | | |
| | | } |
| | | |
| | | public function configure_spamassassin() |
| | | { |
| | | public function configure_spamassassin() { |
| | | global $conf; |
| | | |
| | | //* Enable spamasasssin on debian and ubuntu |
| | |
| | | wf($configfile, $content); |
| | | } |
| | | |
| | | public function configure_getmail() |
| | | { |
| | | public function configure_getmail() { |
| | | global $conf; |
| | | |
| | | $config_dir = $conf['getmail']['config_dir']; |
| | |
| | | } |
| | | |
| | | |
| | | public function configure_pureftpd() |
| | | { |
| | | public function configure_pureftpd() { |
| | | global $conf; |
| | | |
| | | $config_dir = $conf['pureftpd']['config_dir']; |
| | |
| | | if(!is_file('/etc/pure-ftpd/conf/DontResolve')) exec("echo 'yes' > /etc/pure-ftpd/conf/DontResolve"); |
| | | } |
| | | |
| | | public function configure_mydns() |
| | | { |
| | | public function configure_mydns() { |
| | | global $conf; |
| | | |
| | | // configure pam for SMTP authentication agains the ispconfig database |
| | |
| | | |
| | | |
| | | |
| | | public function configure_apache() |
| | | { |
| | | public function configure_apache() { |
| | | global $conf; |
| | | |
| | | //* Create the logging directory for the vhost logfiles |
| | |
| | | |
| | | } |
| | | |
| | | public function configure_firewall() |
| | | { |
| | | public function configure_firewall() { |
| | | global $conf; |
| | | |
| | | $dist_init_scripts = $conf['init_scripts']; |
| | |
| | | |
| | | } |
| | | |
| | | public function configure_vlogger() |
| | | { |
| | | public function configure_vlogger() { |
| | | global $conf; |
| | | |
| | | //** Configure vlogger to use traffic logging to mysql (master) db |
| | |
| | | |
| | | } |
| | | |
| | | public function configure_apps_vhost() |
| | | { |
| | | public function configure_apps_vhost() { |
| | | global $conf; |
| | | |
| | | //* Create the ispconfig apps vhost user and group |
| | |
| | | |
| | | } |
| | | |
| | | public function install_ispconfig() |
| | | { |
| | | public function install_ispconfig() { |
| | | global $conf; |
| | | |
| | | $install_dir = $conf['ispconfig_install_dir']; |
| | |
| | | |
| | | wf("$install_dir/server/lib/$configfile", $content); |
| | | |
| | | //* Create the config file for remote-actions |
| | | $content = "<?php\n$maxid_remote_actions = 1;\n?>"; |
| | | wf("$install_dir/server/lib/remote_actions.inc.php", $content); |
| | | //* Create the config file for remote-actions (but only, if it does not exist, because |
| | | // the value is a autoinc-value and so changed by the remoteaction_core_module |
| | | if (!file_exists("$install_dir/server/lib/remote_action.inc.php")) { |
| | | $content = '<?php' . "\n" . '$maxid_remote_action = 0;' . "\n?>"; |
| | | wf("$install_dir/server/lib/remote_action.inc.php", $content); |
| | | } |
| | | |
| | | //* Enable the server modules and plugins. |
| | | // TODO: Implement a selector which modules and plugins shall be enabled. |
| | |
| | | exec("chmod 600 $install_dir/server/lib/$configfile"); |
| | | exec("chown root:root $install_dir/server/lib/$configfile"); |
| | | |
| | | exec("chmod 600 $install_dir/server/lib/remote_actions.inc.php"); |
| | | exec("chown root:root $install_dir/server/lib/remote_actions.inc.php"); |
| | | exec("chmod 600 $install_dir/server/lib/remote_action.inc.php"); |
| | | exec("chown root:root $install_dir/server/lib/remote_action.inc.php"); |
| | | |
| | | if(@is_file("$install_dir/server/lib/mysql_clientdb.conf")) { |
| | | exec("chmod 600 $install_dir/server/lib/mysql_clientdb.conf"); |
| | |
| | | } |
| | | } |
| | | |
| | | public function configure_dbserver() |
| | | { |
| | | public function configure_dbserver() { |
| | | global $conf; |
| | | |
| | | //* If this server shall act as database server for client DB's, we configure this here |
| | |
| | | |
| | | } |
| | | |
| | | public function install_crontab() |
| | | { |
| | | public function install_crontab() { |
| | | global $conf; |
| | | |
| | | //* Root Crontab |
| | |
| | | * @param bool $tDBCred |
| | | * @return string Relative path to the chosen template file |
| | | */ |
| | | protected function get_template_file($tLocal, $tRf=false, $tDBCred=false) |
| | | { |
| | | protected function get_template_file($tLocal, $tRf=false, $tDBCred=false) { |
| | | global $conf, $dist; |
| | | |
| | | $final_path = ''; |
| | |
| | | * @param $tContents |
| | | * @return bool |
| | | */ |
| | | protected function write_config_file($tConf, $tContents) |
| | | { |
| | | protected function write_config_file($tConf, $tContents) { |
| | | // Backup config file before writing new contents and stat file |
| | | if ( is_file($tConf) ) |
| | | { |
| | | if ( is_file($tConf) ) { |
| | | $stat = exec('stat -c \'%a %U %G\' '.escapeshellarg($tConf), $output, $res); |
| | | if ($res == 0) { // stat successfull |
| | | list($access, $user, $group) = split(" ", $stat); |
| | |
| | | * @param $tContents |
| | | * @return string |
| | | */ |
| | | protected function insert_db_credentials($tContents) |
| | | { |
| | | protected function insert_db_credentials($tContents) { |
| | | global $conf; |
| | | |
| | | $tContents = str_replace('{mysql_server_ispconfig_user}', $conf["mysql"]["ispconfig_user"], $tContents); |