From dc7aa0813f52eed4eb039a21ee13d6a5cb7f104c Mon Sep 17 00:00:00 2001
From: Till Brehm <tbrehm@ispconfig.org>
Date: Thu, 19 May 2016 05:01:32 -0400
Subject: [PATCH] Merge branch 'master' into 'stable-3.1'

---
 install/dist/conf/centos72.conf.php |  219 ++++++++++++++++++++++++++++++++++++
 install/lib/install.lib.php         |    6 +
 interface/web/dns/dns_spf_edit.php  |    6 
 install/dist/lib/centos72.lib.php   |  125 ++++++++++++++++++++
 4 files changed, 353 insertions(+), 3 deletions(-)

diff --git a/install/dist/conf/centos72.conf.php b/install/dist/conf/centos72.conf.php
new file mode 100644
index 0000000..e7ab603
--- /dev/null
+++ b/install/dist/conf/centos72.conf.php
@@ -0,0 +1,219 @@
+<?php
+
+/*
+Copyright (c) 2007, Till Brehm, projektfarm Gmbh
+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.
+*/
+
+//***  Fedora 9 default settings
+
+//* Main
+$conf['language'] = 'en';
+$conf['distname'] = 'centos72';
+$conf['hostname'] = 'server1.domain.tld'; // Full hostname
+$conf['ispconfig_install_dir'] = '/usr/local/ispconfig';
+$conf['ispconfig_config_dir'] = '/usr/local/ispconfig';
+$conf['ispconfig_log_priority'] = 2;  // 0 = Debug, 1 = Warning, 2 = Error
+$conf['ispconfig_log_dir'] = '/var/log/ispconfig';
+$conf['server_id'] = 1;
+$conf['init_scripts'] = '/etc/init.d';
+$conf['runlevel'] = '/etc';
+$conf['shells'] = '/etc/shells';
+$conf['pam'] = '/etc/pam.d';
+
+//* Services provided by this server, this selection will be overridden by the expert mode
+$conf['services']['mail'] = true;
+$conf['services']['web'] = true;
+$conf['services']['dns'] = true;
+$conf['services']['file'] = true;
+$conf['services']['db'] = true;
+$conf['services']['vserver'] = true;
+
+//* MySQL
+$conf['mysql']['installed'] = false; // will be detected automatically during installation
+$conf['mysql']['init_script'] = 'mariadb';
+$conf['mysql']['host'] = 'localhost';
+$conf['mysql']['ip'] = '127.0.0.1';
+$conf['mysql']['port'] = '3306';
+$conf['mysql']['database'] = 'dbispconfig';
+$conf['mysql']['admin_user'] = 'root';
+$conf['mysql']['admin_password'] = '';
+$conf['mysql']['charset'] = 'utf8';
+$conf['mysql']['ispconfig_user'] = 'ispconfig';
+$conf['mysql']['ispconfig_password'] = md5(uniqid(rand()));
+$conf['mysql']['master_slave_setup'] = 'n';
+$conf['mysql']['master_host'] = '';
+$conf['mysql']['master_database'] = 'dbispconfig';
+$conf['mysql']['master_admin_user'] = 'root';
+$conf['mysql']['master_admin_password'] = '';
+$conf['mysql']['master_ispconfig_user'] = '';
+$conf['mysql']['master_ispconfig_password'] = md5(uniqid(rand()));
+
+//* Apache
+$conf['apache']['installed'] = false; // will be detected automatically during installation
+$conf['apache']['user'] = 'apache';
+$conf['apache']['group'] = 'apache';
+$conf['apache']['init_script'] = 'httpd';
+$conf['apache']['version'] = '2.2';
+$conf['apache']['vhost_conf_dir'] = '/etc/httpd/conf/sites-available';
+$conf['apache']['vhost_conf_enabled_dir'] = '/etc/httpd/conf/sites-enabled';
+$conf['apache']['vhost_port'] = '8080';
+$conf['apache']['php_ini_path_apache'] = '/etc/php.ini';
+$conf['apache']['php_ini_path_cgi'] = '/etc/php.ini';
+
+//* Website base settings
+$conf['web']['website_basedir'] = '/var/www';
+$conf['web']['website_path'] = '/var/www/clients/client[client_id]/web[website_id]';
+$conf['web']['website_symlinks'] = '/var/www/[website_domain]/:/var/www/clients/client[client_id]/[website_domain]/';
+
+//* Apps base settings
+$conf['web']['apps_vhost_ip'] = '_default_';
+$conf['web']['apps_vhost_port'] = '8081';
+$conf['web']['apps_vhost_servername'] = '';
+$conf['web']['apps_vhost_user'] = 'ispapps';
+$conf['web']['apps_vhost_group'] = 'ispapps';
+
+//* Fastcgi
+$conf['fastcgi']['fastcgi_phpini_path'] = '/etc/';
+$conf['fastcgi']['fastcgi_starter_path'] = '/var/www/php-fcgi-scripts/[system_user]/';
+$conf['fastcgi']['fastcgi_bin'] = '/usr/bin/php-cgi';
+
+//* Postfix
+$conf['postfix']['installed'] = false; // will be detected automatically during installation
+$conf['postfix']['config_dir'] = '/etc/postfix';
+$conf['postfix']['init_script'] = 'postfix';
+$conf['postfix']['user'] = 'postfix';
+$conf['postfix']['group'] = 'postfix';
+$conf['postfix']['vmail_userid'] = '5000';
+$conf['postfix']['vmail_username'] = 'vmail';
+$conf['postfix']['vmail_groupid'] = '5000';
+$conf['postfix']['vmail_groupname'] = 'vmail';
+$conf['postfix']['vmail_mailbox_base'] = '/var/vmail';
+
+//* Mailman
+$conf['mailman']['installed'] = false; // will be detected automatically during installation
+$conf['mailman']['config_dir'] = '/etc/mailman';
+$conf['mailman']['init_script'] = 'mailman';
+
+//* Getmail
+$conf['getmail']['installed'] = false; // will be detected automatically during installation
+$conf['getmail']['config_dir'] = '/etc/getmail';
+$conf['getmail']['program'] = '/usr/bin/getmail';
+
+//* Courier
+$conf['courier']['installed'] = false; // will be detected automatically during installation
+$conf['courier']['config_dir'] = '/etc/authlib';
+$conf['courier']['courier-authdaemon'] = 'courier-authlib';
+$conf['courier']['courier-imap'] = 'courier-imap';
+$conf['courier']['courier-imap-ssl'] = '';
+$conf['courier']['courier-pop'] = '';
+$conf['courier']['courier-pop-ssl'] = '';
+
+//* Dovecot
+$conf['dovecot']['installed'] = false; // will be detected automatically during installation
+$conf['dovecot']['config_dir'] = '/etc/dovecot';
+$conf['dovecot']['init_script'] = 'dovecot';
+
+//* SASL
+$conf['saslauthd']['installed'] = false; // will be detected automatically during installation
+$conf['saslauthd']['config'] = '/etc/sysconfig/saslauthd';
+$conf['saslauthd']['init_script'] = 'saslauthd';
+
+//* Amavisd
+$conf['amavis']['installed'] = false; // will be detected automatically during installation
+$conf['amavis']['config_dir'] = '/etc/amavisd';
+$conf['amavis']['init_script'] = 'amavisd';
+
+//* ClamAV
+$conf['clamav']['installed'] = false; // will be detected automatically during installation
+$conf['clamav']['init_script'] = 'clamd@amavisd';
+
+//* Pureftpd
+$conf['pureftpd']['installed'] = false; // will be detected automatically during installation
+$conf['pureftpd']['config_dir'] = '/etc/pure-ftpd';
+$conf['pureftpd']['init_script'] = 'pure-ftpd';
+
+//* MyDNS
+$conf['mydns']['installed'] = false; // will be detected automatically during installation
+$conf['mydns']['config_dir'] = '/etc';
+$conf['mydns']['init_script'] = 'mydns';
+
+//* PowerDNS
+$conf['powerdns']['installed'] = false; // will be detected automatically during installation
+$conf['powerdns']['database'] = 'powerdns';
+$conf["powerdns"]["config_dir"] = '/etc/powerdns/pdns.d';
+$conf['powerdns']['init_script'] = 'pdns';
+
+//* BIND DNS Server
+$conf['bind']['installed'] = false; // will be detected automatically during installation
+$conf['bind']['bind_user'] = 'named';
+$conf['bind']['bind_group'] = 'named';
+$conf['bind']['bind_zonefiles_dir'] = '/var/named';
+$conf['bind']['named_conf_path'] = '/etc/named.conf';
+$conf['bind']['named_conf_local_path'] = '/etc/named.conf.local';
+$conf['bind']['init_script'] = 'named';
+
+//* Jailkit
+$conf['jailkit']['installed'] = false; // will be detected automatically during installation
+$conf['jailkit']['config_dir'] = '/etc/jailkit';
+$conf['jailkit']['jk_init'] = 'jk_init.ini';
+$conf['jailkit']['jk_chrootsh'] = 'jk_chrootsh.ini';
+$conf['jailkit']['jailkit_chroot_app_programs'] = '/usr/bin/groups /usr/bin/id /usr/bin/dircolors /bin/basename /usr/bin/dirname /usr/bin/nano';
+$conf['jailkit']['jailkit_chroot_cron_programs'] = '/usr/bin/php /usr/bin/perl /usr/share/perl /usr/share/php';
+
+//* Squid
+$conf['squid']['installed'] = false; // will be detected automatically during installation
+$conf['squid']['config_dir'] = '/etc/squid';
+$conf['squid']['init_script'] = 'squid';
+
+//* Nginx
+$conf['nginx']['installed'] = false; // will be detected automatically during installation
+$conf['nginx']['user'] = 'nginx';
+$conf['nginx']['group'] = 'nginx';
+$conf['nginx']['config_dir'] = '/etc/nginx';
+$conf['nginx']['vhost_conf_dir'] = '/etc/nginx/sites-available';
+$conf['nginx']['vhost_conf_enabled_dir'] = '/etc/nginx/sites-enabled';
+$conf['nginx']['init_script'] = 'nginx';
+$conf['nginx']['vhost_port'] = '8080';
+$conf['nginx']['cgi_socket'] = '/var/run/fcgiwrap.socket';
+$conf['nginx']['php_fpm_init_script'] = 'php-fpm';
+$conf['nginx']['php_fpm_ini_path'] = '/etc/php.ini';
+$conf['nginx']['php_fpm_pool_dir'] = '/etc/php-fpm.d';
+$conf['nginx']['php_fpm_start_port'] = 9010;
+$conf['nginx']['php_fpm_socket_dir'] = '/var/lib/php5-fpm';
+
+//* vlogger
+$conf['vlogger']['config_dir'] = '/etc';
+
+//* cron
+$conf['cron']['init_script'] = 'crond';
+$conf['cron']['crontab_dir'] = '/etc/cron.d';
+$conf['cron']['wget'] = '/usr/bin/wget';
+
+//* OpenVZ
+$conf['openvz']['installed'] = false;
+
+?>
diff --git a/install/dist/lib/centos72.lib.php b/install/dist/lib/centos72.lib.php
new file mode 100644
index 0000000..407a61b
--- /dev/null
+++ b/install/dist/lib/centos72.lib.php
@@ -0,0 +1,125 @@
+<?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';
+	
+	 public function configure_amavis() {
+		global $conf;
+
+		// amavisd user config file
+		$configfile = 'fedora_amavisd_conf';
+		if(!is_dir($conf["amavis"]["config_dir"])) mkdir($conf["amavis"]["config_dir"]);
+		if(is_file($conf["amavis"]["config_dir"].'/amavisd.conf')) copy($conf["amavis"]["config_dir"].'/amavisd.conf', $conf["amavis"]["config_dir"].'/amavisd.conf~');
+		if(is_file($conf["amavis"]["config_dir"].'/amavisd.conf~')) exec('chmod 400 '.$conf["amavis"]["config_dir"].'/amavisd.conf~');
+		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', "tpl/".$configfile.".master");
+		$content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content);
+		$content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
+		$content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
+		$content = str_replace('{mysql_server_port}', $conf["mysql"]["port"], $content);
+		$content = str_replace('{mysql_server_ip}', $conf['mysql']['ip'], $content);
+		$content = str_replace('{hostname}', $conf['hostname'], $content);
+		$content = str_replace('/var/spool/amavisd/clamd.sock', $this->clamav_socket, $content);
+		wf($conf["amavis"]["config_dir"].'/amavisd.conf', $content);
+		chmod($conf['amavis']['config_dir'].'/amavisd.conf', 0640);
+		exec('chgrp amavis '.$conf['amavis']['config_dir'].'/amavisd.conf');
+
+		// Adding the amavisd commands to the postfix configuration
+		$postconf_commands = array (
+			'content_filter = amavis:[127.0.0.1]:10024',
+			'receive_override_options = no_address_mappings'
+		);
+
+		// Make a backup copy of the main.cf file
+		copy($conf["postfix"]["config_dir"].'/main.cf', $conf["postfix"]["config_dir"].'/main.cf~2');
+
+		// Executing the postconf commands
+		foreach($postconf_commands as $cmd) {
+			$command = "postconf -e '$cmd'";
+			caselog($command." &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
+		}
+
+		$config_dir = $conf['postfix']['config_dir'];
+
+		// Adding amavis-services to the master.cf file if the service does not already exists
+		$add_amavis = !$this->get_postfix_service('amavis','unix');
+		$add_amavis_10025 = !$this->get_postfix_service('127.0.0.1:10025','inet');
+		$add_amavis_10027 = !$this->get_postfix_service('127.0.0.1:10027','inet');
+
+		if ($add_amavis || $add_amavis_10025 || $add_amavis_10027) {
+			//* backup master.cf
+			if(is_file($config_dir.'/master.cf')) copy($config_dir.'/master.cf', $config_dir.'/master.cf~');
+			// adjust amavis-config
+			if($add_amavis) {
+				$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis.master', 'tpl/master_cf_amavis.master');
+				af($config_dir.'/master.cf', $content);
+				unset($content);
+			}
+			if ($add_amavis_10025) {
+				$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis10025.master', 'tpl/master_cf_amavis10025.master');
+				af($config_dir.'/master.cf', $content);
+				unset($content);
+			}
+			if ($add_amavis_10027) {
+				$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis10027.master', 'tpl/master_cf_amavis10027.master');
+				af($config_dir.'/master.cf', $content);
+				unset($content);
+			}
+		}
+
+		// Create the director for DKIM-Keys
+		if(!is_dir('/var/lib/amavis/dkim')) mkdir('/var/lib/amavis/dkim', 0750, true);
+			// get shell-user for amavis
+			$amavis_user=exec('grep -o "^amavis:\|^vscan:" /etc/passwd');
+			if(!empty($amavis_user)) {
+				$amavis_user=rtrim($amavis_user, ":");
+				exec('chown '.$amavis_user.' /var/lib/amavis/dkim');
+ 			}
+			// get shell-group for amavis
+			$amavis_group=exec('grep -o "^amavis:\|^vscan:" /etc/group');
+			if(!empty($amavis_group)) {
+				$amavis_group=rtrim($amavis_group, ":");
+				exec('chgrp '.$amavis_group.' /var/lib/amavis/dkim');
+		}
+
+		removeLine('/etc/sysconfig/freshclam', 'FRESHCLAM_DELAY=disabled-warn   # REMOVE ME', 1);
+		replaceLine('/etc/freshclam.conf', 'Example', '# Example', 1);
+		replaceLine('/etc/clamd.d/scan.conf', 'Example', '# Example', 1);
+
+	}
+
+	// everything else is inherited from installer_centos class
+
+}
+
+?>
diff --git a/install/lib/install.lib.php b/install/lib/install.lib.php
index ae17a72..3afc988 100644
--- a/install/lib/install.lib.php
+++ b/install/lib/install.lib.php
@@ -300,6 +300,12 @@
 			$distid = 'centos53';
 			$distbaseid = 'fedora';
 			swriteln("Operating System: CentOS 6 or compatible\n");
+		} elseif(stristr($content, 'CentOS Linux release 7.2')) {
+			$distname = 'CentOS';
+			$distver = 'Unknown';
+			$distid = 'centos72';
+			$distbaseid = 'fedora';
+			swriteln("Operating System: CentOS 7.2\n");
 		} elseif(stristr($content, 'CentOS Linux release 7')) {
 			$distname = 'CentOS';
 			$distver = 'Unknown';
diff --git a/interface/web/dns/dns_spf_edit.php b/interface/web/dns/dns_spf_edit.php
index ba770a9..ca10927 100644
--- a/interface/web/dns/dns_spf_edit.php
+++ b/interface/web/dns/dns_spf_edit.php
@@ -163,7 +163,7 @@
 		}
 		$spf_ip = trim($this->dataRecord['spf_ip']);
 		if (!empty($spf_ip)) {
-			$rec = split(' ', $spf_ip);
+			$rec = explode(' ', $spf_ip);
 			foreach ($rec as $ip) {
 				$temp_ip = explode('/', $ip);
 				if (filter_var($temp_ip[0], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
@@ -187,7 +187,7 @@
 		}
 		$spf_hostname = trim($this->dataRecord['spf_hostname']);
 		if (!empty($spf_hostname)) {
-			$rec = split(' ', $spf_hostname);
+			$rec = explode(' ', $spf_hostname);
 			foreach ($rec as $hostname) { 
 				if (preg_match('/^[a-zA-Z0-9\\.\\-\\*]{0,64}$/', $hostname)) 
 					$spf_record[] = 'a:' . $hostname;
@@ -200,7 +200,7 @@
 		}
 		$spf_domain = trim($this->dataRecord['spf_domain']);
 		if (!empty($spf_domain)) {
-			$rec = split(' ', $spf_domain);
+			$rec = explode(' ', $spf_domain);
 			foreach ($rec as $domain) {
 				if (preg_match('/^[_a-zA-Z0-9\\.\\-\\*]{0,64}$/', $domain))
 					$spf_record[] = 'include:' . $domain;

--
Gitblit v1.9.1