From c220da99596c4fbca3a4413dbf880dbfc8fd0121 Mon Sep 17 00:00:00 2001
From: Florian Schaal <florian@schaal-24.de>
Date: Fri, 24 Jan 2014 06:20:12 -0500
Subject: [PATCH] changed sql-query and make ure that the backup-sub-dir exists

---
 install/lib/installer_base.lib.php |   43 ++++++++++++++++++++++++++++++++++++-------
 1 files changed, 36 insertions(+), 7 deletions(-)

diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php
index 14d054a..cdb0a53 100644
--- a/install/lib/installer_base.lib.php
+++ b/install/lib/installer_base.lib.php
@@ -132,7 +132,7 @@
 		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('ufw')) $conf['ufw']['installed'] = true;
 		if(is_installed('fail2ban-server')) $conf['fail2ban']['installed'] = true;
 		if(is_installed('vzctl')) $conf['openvz']['installed'] = true;
 		if(is_dir("/etc/Bastille")) $conf['bastille']['installed'] = true;
@@ -667,6 +667,15 @@
 		//* 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',
 			__FILE__, __LINE__, 'chmod on mysql-virtual_*.cf*', 'chmod on mysql-virtual_*.cf* failed');
@@ -1041,7 +1050,20 @@
 		// Add the clamav user to the amavis group
 		exec('adduser clamav amavis');
 
-
+		// Create the director for DKIM-Keys
+		mkdir("/var/lib/amavis/dkim", 0750);
+		// 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');
+		}
 	}
 
 	public function configure_spamassassin() {
@@ -1225,6 +1247,15 @@
 			replaceLine('/etc/apache2/ports.conf', 'Listen 443', 'Listen 443', 1);
 		}
 
+		if(is_file('/etc/apache2/apache.conf')) {
+			if(hasLine('/etc/apache2/apache.conf', 'Include sites-enabled/', 1) == false) {
+				if(hasLine('/etc/apache2/apache.conf', 'IncludeOptional sites-enabled/*.conf', 1) == false) {
+					replaceLine('/etc/apache2/apache.conf', 'Include sites-enabled/', 'Include sites-enabled/', 1, 1);
+				} elseif(hasLine('/etc/apache2/apache.conf', 'IncludeOptional sites-enabled/*.vhost', 1) == false) {
+					replaceLine('/etc/apache2/apache.conf', 'IncludeOptional sites-enabled/*.vhost', 'IncludeOptional sites-enabled/*.vhost', 1, 1);
+				}
+			}
+		}
 
 		//* Copy the ISPConfig configuration include
 		$vhost_conf_dir = $conf['apache']['vhost_conf_dir'];
@@ -1368,19 +1399,17 @@
 		exec('chown root:root '.$conf["squid"]["config_dir"].'/'.$configfile);
 	}
 
-	/*
 	public function configure_ufw_firewall()
 	{
 		$configfile = 'ufw.conf';
-		if(is_file('/etc/ufw/ufw.conf')) copy('/etc/ufw/ufw.conf','/etc/ufw/ufw.conf~');
+		if(is_file('/etc/ufw/ufw.conf')) copy('/etc/ufw/ufw.conf', '/etc/ufw/ufw.conf~');
 		$content = rf("tpl/".$configfile.".master");
-		wf('/etc/ufw/ufw.conf',$content);
+		wf('/etc/ufw/ufw.conf', $content);
 		exec('chmod 600 /etc/ufw/ufw.conf');
 		exec('chown root:root /etc/ufw/ufw.conf');
 	}
-	*/
 
-	public function configure_firewall() {
+	public function configure_bastille_firewall() {
 		global $conf;
 
 		$dist_init_scripts = $conf['init_scripts'];

--
Gitblit v1.9.1