| | |
| | | $from_host = $conf['hostname']; |
| | | } |
| | | |
| | | // Delete ISPConfig user, in case that it exists |
| | | $this->db->query("DELETE FROM mysql.user WHERE User = '".$cf['ispconfig_user']."' AND Host = '".$from_host."';"); |
| | | $this->db->query("DELETE FROM mysql.db WHERE Db = '".$cf['database']."' AND Host = '".$from_host."';"); |
| | | $this->db->query('FLUSH PRIVILEGES;'); |
| | | |
| | | //* Create the ISPConfig database user |
| | | $query = 'GRANT SELECT, INSERT, UPDATE, DELETE ON '.$cf['database'].".* " |
| | | ."TO '".$cf['ispconfig_user']."'@'".$from_host."' " |
| | | ."IDENTIFIED BY '".$cf['ispconfig_password']."';"; |
| | | if(!$this->db->query($query)) { |
| | | $this->error('Unable to create database user: '.$cf['ispconfig_user']); |
| | | $this->error('Unable to create database user: '.$cf['ispconfig_user'].' Error: '.$this->db->errorMessage); |
| | | } |
| | | |
| | | //* Reload database privelages |
| | |
| | | $this->db->dbName = $cf['database']; |
| | | |
| | | $server_ini_content = rf("tpl/server.ini.master"); |
| | | $server_ini_content = addslashes($server_ini_content); |
| | | $server_ini_content = mysql_real_escape_string($server_ini_content); |
| | | |
| | | $sql = "INSERT INTO `server` (`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_name`, `mail_server`, `web_server`, `dns_server`, `file_server`, `db_server`, `vserver_server`, `config`, `updated`, `active`) VALUES (1, 1, 'riud', 'riud', 'r', '".$conf['hostname']."', 1, 1, 1, 1, 1, 1, '$server_ini_content', 0, 1);"; |
| | | $this->db->query($sql); |
| | |
| | | |
| | | |
| | | //** writes postfix configuration files |
| | | private function process_postfix_config($configfile) |
| | | public function process_postfix_config($configfile) |
| | | { |
| | | global $conf; |
| | | |
| | |
| | | caselog($command." &> /dev/null", __FILE__, __LINE__, 'EXECUTED: '.$command, 'Failed to execute the command '.$command); |
| | | } |
| | | |
| | | // TODO: Change the master.cf file |
| | | /* |
| | | Add: |
| | | maildrop unix - n n - - pipe |
| | | flags=R user=vmail argv=/usr/bin/maildrop -d ${recipient} ${extension} ${recipient} ${user} ${nexthop} ${sender} |
| | | */ |
| | | if(!stristr($options,'dont-create-certs')) { |
| | | //* Create the SSL certificate |
| | | $command = 'cd '.$config_dir.'; ' |
| | |
| | | |
| | | } |
| | | |
| | | function configure_saslauthd() { |
| | | public function configure_saslauthd() { |
| | | global $conf; |
| | | |
| | | |
| | |
| | | wf($configfile, $content); |
| | | } |
| | | |
| | | function configure_amavis() { |
| | | public function configure_amavis() { |
| | | global $conf; |
| | | |
| | | // amavisd user config file |
| | |
| | | |
| | | // Append the configuration for amavisd to the master.cf file |
| | | if(is_file($conf["postfix"]["config_dir"].'/master.cf')) copy($conf["postfix"]["config_dir"].'/master.cf',$conf["postfix"]["config_dir"].'/master.cf~'); |
| | | $content = rf("tpl/master_cf_amavis.master"); |
| | | $content = rf($conf["postfix"]["config_dir"].'/master.cf'); |
| | | // Only add the content if we had not addded it before |
| | | if(!stristr("127.0.0.1:10025",$content)) { |
| | | if(!stristr($content,"127.0.0.1:10025")) { |
| | | unset($content); |
| | | $content = rf("tpl/master_cf_amavis.master"); |
| | | af($conf["postfix"]["config_dir"].'/master.cf',$content); |
| | | } |
| | | unset($content); |
| | | |
| | | // Add the clamav user to the amavis group |
| | | exec('adduser clamav amavis'); |