From 8e5493520583b94f633da582fd543b754805d306 Mon Sep 17 00:00:00 2001
From: Till Brehm <tbrehm@ispconfig.org>
Date: Thu, 21 Apr 2016 12:32:27 -0400
Subject: [PATCH] Changed behaviour of UFW installation. Do not enable it by deafult as the firewall will get enabled autmatically when a firewall record gets added in ispconfig. Enabling it without that record, the Firewall would lock out the user on next reboot.

---
 install/lib/installer_base.lib.php |   14 ++++++++------
 install/tpl/ufw.conf.master        |    2 +-
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php
index 5794355..720d85e 100644
--- a/install/lib/installer_base.lib.php
+++ b/install/lib/installer_base.lib.php
@@ -1842,12 +1842,14 @@
 
 	public function configure_ufw_firewall()
 	{
-		$configfile = '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);
-		exec('chmod 600 /etc/ufw/ufw.conf');
-		exec('chown root:root /etc/ufw/ufw.conf');
+		if($this->is_update == false) {
+			$configfile = '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);
+			exec('chmod 600 /etc/ufw/ufw.conf');
+			exec('chown root:root /etc/ufw/ufw.conf');
+		}
 	}
 
 	public function configure_bastille_firewall() {
diff --git a/install/tpl/ufw.conf.master b/install/tpl/ufw.conf.master
index caae14f..6b5f46f 100644
--- a/install/tpl/ufw.conf.master
+++ b/install/tpl/ufw.conf.master
@@ -2,7 +2,7 @@
 # 
 
 # set to yes to start on boot
-ENABLED=yes
+ENABLED=no
 
 # set to one of 'off', 'low', 'medium', 'high'
 LOGLEVEL=low

--
Gitblit v1.9.1