Sergio Cambra
2014-07-04 aee9d677f5cf1c2c9dfa73b72e48bb95fba7264a
install/dist/lib/opensuse.lib.php
@@ -29,7 +29,23 @@
*/
class installer_dist extends installer_base {
   public function __construct() {
      //** check apache modules */
      $mods = getapachemodules();
      if(in_array('authz_compat', $mods, true)) {
         swriteln($inst->lng('    WARNING! You are using mod_authz_compat.'));
         swriteln($inst->lng('    Please make sure that your apache config uses the new auth syntax:'));
         swriteln($inst->lng('    <Directory />'));
         swriteln($inst->lng('    Options None'));
         swriteln($inst->lng('    AllowOverride None'));
         swriteln($inst->lng('    Require all denied'));
         swriteln($inst->lng('    </Directory>'."\n"));
         swriteln($inst->lng('    If it uses the old syntax (deny from all) ISPConfig would fail to work.'));
      }
   }
   public function configure_mailman($status = 'insert') {
      global $conf;
@@ -150,6 +166,19 @@
      //* mysql-virtual_relayrecipientmaps.cf
      $this->process_postfix_config('mysql-virtual_relayrecipientmaps.cf');
      //* postfix-dkim
      $full_file_name=$config_dir.'/tag_as_originating.re';
      if(is_file($full_file_name)) {
         copy($full_file_name, $config_dir.$configfile.'~');
      }
      wf($full_file_name, '/^/ FILTER amavis:[127.0.0.1]:10026');
      $full_file_name=$config_dir.'/tag_as_foreign.re';
      if(is_file($full_file_name)) {
         copy($full_file_name, $config_dir.$configfile.'~');
      }
      wf($full_file_name, '/^/ FILTER amavis:[127.0.0.1]:10024');
      //* Changing mode and group of the new created config files.
      caselog('chmod o= '.$config_dir.'/mysql-virtual_*.cf* &> /dev/null',
@@ -424,10 +453,9 @@
      // Adding the amavisd commands to the postfix configuration
      $postconf_commands = array (
         'dovecot_destination_recipient_limit = 1',
         'virtual_transport = dovecot',
         'virtual_transport = lmtp:unix:private/dovecot-lmtp',
         'smtpd_sasl_type = dovecot',
         'smtpd_sasl_path = private/auth',
         'receive_override_options = no_address_mappings'
      );
      // Make a backup copy of the main.cf file
@@ -485,7 +513,7 @@
      exec("chown root:root $config_dir/$configfile");
      
      // Dovecot shall ignore mounts in website directory
      exec("doveadm mount add '/srv/www/*' ignore");
      if(is_installed('doveadm')) exec("doveadm mount add '/srv/www/*' ignore > /dev/null 2> /dev/null");
   }
@@ -523,11 +551,23 @@
      // 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($conf["postfix"]["config_dir"].'/master.cf');
      // Only add the content if we had not addded it before
      if(!stristr($content, "127.0.0.1:10025")) {
        // Only add the content if we had not addded it before
      if(!preg_match('/^amavis\s+unix\s+/m', $content)) {
         unset($content);
         $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis.master', "tpl/master_cf_amavis.master");
         af($conf["postfix"]["config_dir"].'/master.cf', $content);
         $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis.master', 'tpl/master_cf_amavis.master');
         af($conf['postfix']['config_dir'].'/master.cf', $content);
         $content = rf($conf['postfix']['config_dir'].'/master.cf');
      }
      if(!preg_match('/^127.0.0.1:10025\s+/m', $content)) {
         unset($content);
         $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis10025.master', 'tpl/master_cf_amavis10025.master');
         af($conf['postfix']['config_dir'].'/master.cf', $content);
         $content = rf($conf['postfix']['config_dir'].'/master.cf');
      }
      if(!preg_match('/^127.0.0.1:10027\s+/m', $content)) {
         unset($content);
         $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis10027.master', 'tpl/master_cf_amavis10027.master');
         af($conf['postfix']['config_dir'].'/master.cf', $content);
      }
      unset($content);
@@ -1078,6 +1118,9 @@
            $command = 'usermod -a -G ispapps '.$conf['nginx']['user'];
            caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
         }
         // add nobody user to www group, as the default php-fpm pool from opensuse runs as nobody
         $command = 'usermod -a -G www nobody';
         caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
      }
      //* Make the shell scripts executable
@@ -1116,7 +1159,9 @@
         
         $tpl->setVar('apache_version',getapacheversion());
         wf($vhost_conf_dir.'/ispconfig.vhost', $tpl->grab());
         $content = $tpl->grab();
         $content = str_replace('/var/www/', '/srv/www/', $content);
         wf($vhost_conf_dir.'/ispconfig.vhost', $content);
         //if(!is_file('/srv/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter')) {
         $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/apache_ispconfig_fcgi_starter.master', 'tpl/apache_ispconfig_fcgi_starter.master');
@@ -1253,6 +1298,9 @@
      //* Remove Domain module as its functions are available in the client module now
      if(@is_dir('/usr/local/ispconfig/interface/web/domain')) exec('rm -rf /usr/local/ispconfig/interface/web/domain');
      // Add symlink for patch tool
      if(!is_link('/usr/local/bin/ispconfig_patch')) exec('ln -s /usr/local/ispconfig/server/scripts/ispconfig_patch /usr/local/bin/ispconfig_patch');
   }