| | |
| | | $from_ip = gethostbyname($conf['hostname']); |
| | | |
| | | //* username for the ispconfig user |
| | | $conf['mysql']['master_ispconfig_user'] = 'ispconfigserver'.$conf['server_id']; |
| | | $conf['mysql']['master_ispconfig_user'] = 'ispcsrv'.$conf['server_id']; |
| | | |
| | | //* Delete ISPConfig user in the master database, in case that it exists |
| | | $this->dbmaster->query("DELETE FROM mysql.user WHERE User = '".$conf['mysql']['master_ispconfig_user']."' AND Host = '".$from_host."';"); |
| | |
| | | 'virtual_gid_maps = static:'.$cf['vmail_groupid'], |
| | | 'smtpd_sasl_auth_enable = yes', |
| | | 'broken_sasl_auth_clients = yes', |
| | | 'smtpd_sasl_authenticated_header = yes', |
| | | 'smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, check_recipient_access mysql:'.$config_dir.'/mysql-virtual_recipient.cf, reject_unauth_destination', |
| | | 'smtpd_use_tls = yes', |
| | | 'smtpd_tls_security_level = may', |
| | |
| | | 'transport_maps = proxy:mysql:'.$config_dir.'/mysql-virtual_transports.cf', |
| | | 'relay_domains = mysql:'.$config_dir.'/mysql-virtual_relaydomains.cf', |
| | | 'virtual_create_maildirsize = yes', |
| | | 'virtual_mailbox_extended = yes', |
| | | 'virtual_maildir_extended = yes', |
| | | 'virtual_mailbox_limit_maps = proxy:mysql:'.$config_dir.'/mysql-virtual_mailbox_limit_maps.cf', |
| | | 'virtual_mailbox_limit_override = yes', |
| | | 'virtual_maildir_limit_message = "The user you are trying to reach is over quota."', |
| | |
| | | } |
| | | $configfile = $config_dir.'/master.cf'; |
| | | $content = rf($configfile); |
| | | $content = str_replace(' flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}', |
| | | ' flags=R user='.$cf['vmail_username'].' argv=/usr/bin/maildrop -d ${recipient} ${extension} ${recipient} ${user} ${nexthop} ${sender}', |
| | | $content = str_replace('flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}', |
| | | 'flags=R user='.$cf['vmail_username'].' argv=/usr/bin/maildrop -d ${recipient} ${extension} ${recipient} ${user} ${nexthop} ${sender}', |
| | | $content); |
| | | wf($configfile, $content); |
| | | |
| | |
| | | // **enable chrooting |
| | | //exec('mkdir -p '.$config_dir.'/conf/ChrootEveryone'); |
| | | exec('echo "yes" > '.$config_dir.'/conf/ChrootEveryone'); |
| | | exec('echo "yes" > '.$config_dir.'/conf/BrokenClientsCompatibility'); |
| | | } |
| | | |
| | | public function configure_mydns() |
| | |
| | | replaceLine('/etc/suphp/suphp.conf','docroot=','docroot=/var/clients',0); |
| | | } |
| | | |
| | | if(is_file('/etc/apache2/sites-enabled/000-default')) { |
| | | replaceLine('/etc/apache2/sites-available/000-default','NameVirtualHost *','NameVirtualHost *:80',1); |
| | | replaceLine('/etc/apache2/sites-available/000-default','<VirtualHost *>','<VirtualHost *:80>',1); |
| | | } |
| | | |
| | | if(is_file('/etc/apache2/ports.conf')) { |
| | | // add a line "Listen 443" to ports conf if line does not exist |
| | | replaceLine('/etc/apache2/ports.conf','Listen 443','Listen 443',1); |
| | | } |
| | | |
| | | |
| | | //* Copy the ISPConfig configuration include |
| | | $vhost_conf_dir = $conf['apache']['vhost_conf_dir']; |
| | | $vhost_conf_enabled_dir = $conf['apache']['vhost_conf_enabled_dir']; |
| | | |
| | | copy('tpl/apache_ispconfig.conf.master',$vhost_conf_dir.'/ispconfig.conf'); |
| | | if(!@is_link($vhost_conf_enabled_dir."/000-ispconfig.conf")) { |
| | | exec("ln -s ".$vhost_conf_dir."/ispconfig.conf ".$vhost_conf_enabled_dir."/000-ispconfig.conf"); |
| | | } |
| | | |
| | | } |
| | | |
| | | public function configure_firewall() |
| | |
| | | $tcp_public_services = trim(str_replace(',',' ',$row["tcp_port"])); |
| | | $udp_public_services = trim(str_replace(',',' ',$row["udp_port"])); |
| | | } else { |
| | | $tcp_public_services = '21 22 25 53 80 110 443 3306 8080 10000'; |
| | | $tcp_public_services = '21 22 25 53 80 110 143 443 3306 8080 10000'; |
| | | $udp_public_services = '53'; |
| | | } |
| | | |
| | | if(!stristr($tcp_public_services, $conf['apache']['vhost_port'])) { |
| | | $tcp_public_services .= ' '.intval($conf['apache']['vhost_port']); |
| | | if($row["tcp_port"] != '') $this->db->query("UPDATE firewall SET tcp_port = tcp_port + ',".intval($conf['apache']['vhost_port'])."' WHERE server_id = ".intval($conf['server_id'])); |
| | | } |
| | | |
| | | $content = str_replace("{TCP_PUBLIC_SERVICES}", $tcp_public_services, $content); |
| | | $content = str_replace("{UDP_PUBLIC_SERVICES}", $udp_public_services, $content); |
| | | |
| | |
| | | include_once($install_dir.'/server/plugins-available/'.$file); |
| | | $plugin_name = substr($file,0,-8); |
| | | $tmp = new $plugin_name; |
| | | if($tmp->onInstall()) { |
| | | if(method_exists($tmp,'onInstall') && $tmp->onInstall()) { |
| | | if(!@is_link($install_dir.'/server/plugins-enabled/'.$file)) @symlink($install_dir.'/server/plugins-available/'.$file, $install_dir.'/server/plugins-enabled/'.$file); |
| | | if (strpos($file, '_core_plugin') !== false) { |
| | | if(!@is_link($install_dir.'/server/plugins-core/'.$file)) @symlink($install_dir.'/server/plugins-available/'.$file, $install_dir.'/server/plugins-core/'.$file); |
| | |
| | | |
| | | if($conf['mysql']['master_slave_setup'] == 'y') { |
| | | $this->dbmaster->query($sql); |
| | | $this->db->query($sql); |
| | | } else { |
| | | $this->db->query($sql); |
| | | } |
| | |
| | | if(!@is_link("$vhost_conf_enabled_dir/000-ispconfig.vhost")) { |
| | | exec("ln -s $vhost_conf_dir/ispconfig.vhost $vhost_conf_enabled_dir/000-ispconfig.vhost"); |
| | | } |
| | | |
| | | exec('mkdir -p /var/www/php-fcgi-scripts/ispconfig'); |
| | | exec('cp tpl/apache_ispconfig_fcgi_starter.master /var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter'); |
| | | exec('chmod +x /var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter'); |
| | | exec('ln -s /usr/local/ispconfig/interface/web /var/www/ispconfig'); |
| | | exec('chown -R ispconfig:ispconfig /var/www/php-fcgi-scripts/ispconfig'); |
| | | |
| | | } |
| | | |
| | | // Make the Clamav log files readable by ISPConfig |
| | |
| | | exec('cp ../helper_scripts/update_from_svn.sh /usr/local/bin/ispconfig_update_from_svn.sh'); |
| | | exec('chown root /usr/local/bin/ispconfig_update_from_svn.sh'); |
| | | exec('chmod 700 /usr/local/bin/ispconfig_update_from_svn.sh'); |
| | | |
| | | //set the fast cgi starter script to executable |
| | | exec('chmod 755 '.$install_dir.'/interface/bin/php-fcgi'); |
| | | |
| | | //* Make the logs readable for the ispconfig user |
| | | if(@is_file('/var/log/mail.log')) exec('chmod +r /var/log/mail.log'); |
| | |
| | | } |
| | | |
| | | $root_cron_jobs = array( |
| | | '* * * * * /usr/local/ispconfig/server/server.sh > /dev/null', |
| | | '30 00 * * * /usr/local/ispconfig/server/cron_daily.sh > /dev/null' |
| | | '* * * * * /usr/local/ispconfig/server/server.sh > /dev/null 2>> /var/log/ispconfig/cron.log', |
| | | '30 00 * * * /usr/local/ispconfig/server/cron_daily.sh > /dev/null 2>> /var/log/ispconfig/cron.log' |
| | | ); |
| | | foreach($root_cron_jobs as $cron_job) { |
| | | if(!in_array($cron_job."\n", $existing_root_cron_jobs)) { |
| | |
| | | exec('crontab -u getmail -l > crontab.txt'); |
| | | $existing_cron_jobs = file('crontab.txt'); |
| | | |
| | | $cron_jobs = array('*/5 * * * * '.$cf['program'].' -g '.$cf['config_dir'].' -r '.$cf['config_dir'].'/*.conf > /dev/null'); |
| | | $cron_jobs = array( |
| | | '*/5 * * * * '.$cf['program'].' -n -g '.$cf['config_dir'].' -r '.$cf['config_dir'].'/*.conf > /dev/null 2>> /var/log/ispconfig/cron.log' |
| | | ); |
| | | |
| | | // remove existing ispconfig cronjobs, in case the syntax has changed |
| | | foreach($cron_jobs as $key => $val) { |
| | | if(stristr($val,$cf['program'])) unset($cron_jobs[$key]); |
| | | if(stristr($val,$cf['program'])) unset($existing_cron_jobs[$key]); |
| | | } |
| | | |
| | | foreach($cron_jobs as $cron_job) { |
| | |
| | | exec('crontab -u getmail crontab.txt &> /dev/null'); |
| | | unlink('crontab.txt'); |
| | | } |
| | | |
| | | exec('touch /var/log/ispconfig/cron.log'); |
| | | exec('chmod 666 /var/log/ispconfig/cron.log'); |
| | | |
| | | } |
| | | |
| | | } |