From 2b3dfac5e54e56fa05f98cb00d1df42110d6b896 Mon Sep 17 00:00:00 2001
From: Till Brehm <tbrehm@ispconfig.org>
Date: Wed, 22 Jun 2016 09:00:35 -0400
Subject: [PATCH] CentOS 7.2 related fixes in installer and apache vhost template.

---
 server/conf/vhost.conf.master      |   13 ++++--
 install/lib/installer_base.lib.php |   13 ++++--
 install/dist/lib/fedora.lib.php    |   11 +++++
 install/lib/install.lib.php        |    2 
 install/dist/lib/centos72.lib.php  |   40 ++++++++++++++++++++
 5 files changed, 70 insertions(+), 9 deletions(-)

diff --git a/install/dist/lib/centos72.lib.php b/install/dist/lib/centos72.lib.php
new file mode 100644
index 0000000..3dcd749
--- /dev/null
+++ b/install/dist/lib/centos72.lib.php
@@ -0,0 +1,40 @@
+<?php
+
+/*
+Copyright (c) 2014, Till Brehm, ISPConfig UG
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice,
+      this list of conditions and the following disclaimer in the documentation
+      and/or other materials provided with the distribution.
+    * Neither the name of ISPConfig nor the names of its contributors
+      may be used to endorse or promote products derived from this software without
+      specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+require_once realpath(dirname(__FILE__)) . '/centos_base.lib.php';
+
+class installer extends installer_centos {
+
+	protected $clamav_socket = '/var/run/clamd.amavisd/clamd.sock';
+	
+	// everything else is inherited from installer_centos class
+}
+
+?>
diff --git a/install/dist/lib/fedora.lib.php b/install/dist/lib/fedora.lib.php
index 11ce420..f7e7fa3 100644
--- a/install/dist/lib/fedora.lib.php
+++ b/install/dist/lib/fedora.lib.php
@@ -89,6 +89,9 @@
 
 		//* mysql-virtual_relayrecipientmaps.cf
 		$this->process_postfix_config('mysql-virtual_relayrecipientmaps.cf');
+		
+		//* mysql-virtual_outgoing_bcc.cf
+		$this->process_postfix_config('mysql-virtual_outgoing_bcc.cf');
 
 		//* mysql-virtual_policy_greylist.cf
 		$this->process_postfix_config('mysql-virtual_policy_greylist.cf');
@@ -179,6 +182,7 @@
 		//if(!is_file('/var/lib/mailman/data/aliases')) touch('/var/lib/mailman/data/aliases');
 		if(is_file('/var/lib/mailman/data/aliases')) unlink('/var/lib/mailman/data/aliases');
 		if(!is_link('/var/lib/mailman/data/aliases')) symlink('/etc/mailman/aliases', '/var/lib/mailman/data/aliases');
+		if(!is_file('/etc/mailman/aliases')) touch('/etc/mailman/aliases');
 		exec('postalias /var/lib/mailman/data/aliases');
 		if(!is_file('/etc/mailman/virtual-mailman')) touch('/etc/mailman/virtual-mailman');
 		exec('postmap /etc/mailman/virtual-mailman');
@@ -491,6 +495,13 @@
 		$content = str_replace('{hostname}', $conf['hostname'], $content);
 		wf($conf["amavis"]["config_dir"].'/amavisd.conf', $content);
 		chmod($conf['amavis']['config_dir'].'/amavisd.conf', 0640);
+		
+		// for CentOS 7.2 only
+		$distname = get_distname();
+		if($distname['confid'] == 'centos72') {
+			chmod($conf['amavis']['config_dir'].'/amavisd.conf', 0750);
+			chgrp($conf['amavis']['config_dir'].'/amavisd.conf', 'amavis');
+		}
 
 
 		// Adding the amavisd commands to the postfix configuration
diff --git a/install/lib/install.lib.php b/install/lib/install.lib.php
index f670261..c19736a 100644
--- a/install/lib/install.lib.php
+++ b/install/lib/install.lib.php
@@ -296,7 +296,7 @@
 		} elseif(stristr($content, 'CentOS Linux release 7.2')) {
 			$distname = 'CentOS';
 			$distver = 'Unknown';
-			$distid = 'centos70';
+			$distid = 'centos72';
 			$distconfid = 'centos72';
 			$distbaseid = 'fedora';
 			swriteln("Operating System: CentOS 7.2\n");
diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php
index 49b0e3d..4f13ff3 100644
--- a/install/lib/installer_base.lib.php
+++ b/install/lib/installer_base.lib.php
@@ -171,14 +171,19 @@
 		if(is_installed('named') || is_installed('bind') || is_installed('bind9')) $conf['bind']['installed'] = true;
 		if(is_installed('squid')) $conf['squid']['installed'] = true;
 		if(is_installed('nginx')) $conf['nginx']['installed'] = true;
-		if(is_installed('iptables') && is_installed('ufw')) $conf['ufw']['installed'] = true;
-		if(is_installed('iptables') && is_installed('bastille-netfilter')) $conf['firewall']['installed'] = true;
+		if(is_installed('iptables') && is_installed('ufw')) {
+			$conf['ufw']['installed'] = true;
+		} elseif(is_installed('iptables')) {
+			$conf['firewall']['installed'] = true;
+		}
 		if(is_installed('fail2ban-server')) $conf['fail2ban']['installed'] = true;
 		if(is_installed('vzctl')) $conf['openvz']['installed'] = true;
 		if(is_installed('metronome') && is_installed('metronomectl')) $conf['xmpp']['installed'] = true;
 		if(is_installed('spamassassin')) $conf['spamassassin']['installed'] = true;
-		if(is_installed('vlogger')) $conf['vlogger']['installed'] = true;
-		if(is_installed('cron')) $conf['cron']['installed'] = true;
+		// if(is_installed('vlogger')) $conf['vlogger']['installed'] = true;
+		// ISPConfig ships with vlogger, so it is always installed.
+		$conf['vlogger']['installed'] = true;
+		if(is_installed('cron') || is_installed('anacron')) $conf['cron']['installed'] = true;
 
 		if ($conf['services']['web'] && (($conf['apache']['installed'] && is_file($conf['apache']["vhost_conf_enabled_dir"]."/000-ispconfig.vhost")) || ($conf['nginx']['installed'] && is_file($conf['nginx']["vhost_conf_enabled_dir"]."/000-ispconfig.vhost")))) $this->ispconfig_interface_installed = true;
 	}
diff --git a/server/conf/vhost.conf.master b/server/conf/vhost.conf.master
index 62ef151..bb2d71d 100644
--- a/server/conf/vhost.conf.master
+++ b/server/conf/vhost.conf.master
@@ -350,15 +350,20 @@
                 Action php5-fcgi /php5-fcgi virtual
 				Alias /php5-fcgi {tmpl_var name='document_root'}/cgi-bin/php5-fcgi-{tmpl_var name='ip_address'}-{tmpl_var name='port'}-{tmpl_var name='domain'}
 <tmpl_if name='use_tcp'>
-                FastCgiExternalServer {tmpl_var name='document_root'}/cgi-bin/php5-fcgi-{tmpl_var name='ip_address'}-{tmpl_var name='port'}-{tmpl_var name='domain'} -idle-timeout 300 -host 127.0.0.1:<tmpl_var name='fpm_port'> -pass-header Authorization
-                <IfModule mod_proxy_fcgi.c>
-			ProxyPassMatch ^/(.*\.php[345]?(/.*)?)$ fcgi://127.0.0.1:<tmpl_var name='fpm_port'><tmpl_var name='web_document_root'>/$1
-                </IfModule>
+                FastCgiExternalServer {tmpl_var name='document_root'}/cgi-bin/php5-fcgi-{tmpl_var name='ip_address'}-{tmpl_var name='port'}-{tmpl_var name='domain'} -idle-timeout 300 -host 127.0.0.1:<tmpl_var name='fpm_port'> -pass-header Authorization             
 </tmpl_if>
 <tmpl_if name='use_socket'>
                 FastCgiExternalServer {tmpl_var name='document_root'}/cgi-bin/php5-fcgi-{tmpl_var name='ip_address'}-{tmpl_var name='port'}-{tmpl_var name='domain'} -idle-timeout 300 -socket <tmpl_var name='fpm_socket'> -pass-header Authorization
 </tmpl_if>
 		</IfModule>
+		<IfModule mod_proxy_fcgi.c>
+<tmpl_if name='use_tcp'>
+			ProxyPassMatch ^/(.*\.php[345]?(/.*)?)$ fcgi://127.0.0.1:<tmpl_var name='fpm_port'><tmpl_var name='web_document_root'>/$1
+</tmpl_if>
+<tmpl_if name='use_socket'>
+			ProxyPassMatch ^/(.*\.php[345]?(/.*)?)$ unix://<tmpl_var name='fpm_socket'>|fcgi://localhost/<tmpl_var name='web_document_root'>/$1
+</tmpl_if>
+			</IfModule>
 </tmpl_if>
 
 <tmpl_if name='php' op='==' value='hhvm'>

--
Gitblit v1.9.1