From 8662c5bdf4ab42b5db5af61ba1719c3eb4c03dee Mon Sep 17 00:00:00 2001
From: mcramer <m.cramer@pixcept.de>
Date: Wed, 30 Jan 2013 11:34:49 -0500
Subject: [PATCH] - Fixed:  FS#2621 - OS update 

---
 install/lib/installer_base.lib.php |   49 +++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 41 insertions(+), 8 deletions(-)

diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php
index dd55a54..9c74364 100644
--- a/install/lib/installer_base.lib.php
+++ b/install/lib/installer_base.lib.php
@@ -423,7 +423,7 @@
 				$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
 			}
 
-			$query = "GRANT SELECT, UPDATE (`ssl_request`, `ssl_cert`, `ssl_action`) ON ".$value['db'].".`web_domain` TO '".$value['user']."'@'".$host."' ";
+			$query = "GRANT SELECT, UPDATE (`ssl_request`, `ssl_cert`, `ssl_action`, `ssl_key`) ON ".$value['db'].".`web_domain` TO '".$value['user']."'@'".$host."' ";
 			if ($verbose){
 				echo $query ."\n";
 			}
@@ -472,6 +472,14 @@
 			}
 
 			$query = "GRANT SELECT, UPDATE ON ".$value['db'].".`aps_instances` TO '".$value['user']."'@'".$host."' ";
+			if ($verbose){
+				echo $query ."\n";
+			}
+			if(!$this->dbmaster->query($query)) {
+				$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
+			}
+			
+			$query = "GRANT SELECT, INSERT, DELETE ON ".$value['db'].".`web_backup` TO '".$value['user']."'@'".$host."' ";
 			if ($verbose){
 				echo $query ."\n";
 			}
@@ -724,7 +732,7 @@
 		if(!stristr($options,'dont-create-certs')) {
 			//* Create the SSL certificate
 			$command = 'cd '.$config_dir.'; '
-					.'openssl req -new -outform PEM -out smtpd.cert -newkey rsa:2048 -nodes -keyout smtpd.key -keyform PEM -days 3650 -x509';
+					.'openssl req -new -outform PEM -out smtpd.cert -newkey rsa:4096 -nodes -keyout smtpd.key -keyform PEM -days 3650 -x509';
 			exec($command);
 
 			$command = 'chmod o= '.$config_dir.'/smtpd.key';
@@ -1555,6 +1563,16 @@
 			//$content = str_replace('{fpm_port}', ($conf['nginx']['php_fpm_start_port']+1), $content);
 			$content = str_replace('{fpm_socket}', $fpm_socket, $content);
 			$content = str_replace('{cgi_socket}', $cgi_socket, $content);
+			
+			if(file_exists('/var/run/php5-fpm.sock')){
+				$use_tcp = '#';
+				$use_socket = '';
+			} else {
+				$use_tcp = '';
+				$use_socket = '#';
+			}
+			$content = str_replace('{use_tcp}', $use_tcp, $content);
+			$content = str_replace('{use_socket}', $use_socket, $content);
 
 			wf($vhost_conf_dir.'/apps.vhost', $content);
 
@@ -1798,9 +1816,14 @@
 		exec("chmod -R 770 $install_dir/server/aps_packages");
 
 		//* make sure that the server config file (not the interface one) is only readable by the root user
-		chmod($install_dir.'/server/lib/'.$configfile, 0600);
-		chown($install_dir.'/server/lib/'.$configfile, 'root');
-		chgrp($install_dir.'/server/lib/'.$configfile, 'root');
+		chmod($install_dir.'/server/lib/config.inc.php', 0600);
+		chown($install_dir.'/server/lib/config.inc.php', 'root');
+		chgrp($install_dir.'/server/lib/config.inc.php', 'root');
+		
+		//* Make sure thet the interface config file is readable by user ispconfig only
+		chmod($install_dir.'/interface/lib/config.inc.php', 0600);
+		chown($install_dir.'/interface/lib/config.inc.php', 'ispconfig');
+		chgrp($install_dir.'/interface/lib/config.inc.php', 'ispconfig');
 
 		chmod($install_dir.'/server/lib/remote_action.inc.php', 0600);
 		chown($install_dir.'/server/lib/remote_action.inc.php', 'root');
@@ -1861,6 +1884,11 @@
 				$content = str_replace('{ssl_comment}', '', $content);
 			} else {
 				$content = str_replace('{ssl_comment}', '#', $content);
+			}
+			if(is_file($install_dir.'/interface/ssl/ispserver.crt') && is_file($install_dir.'/interface/ssl/ispserver.key') && is_file($install_dir.'/interface/ssl/ispserver.bundle')) {
+				$content = str_replace('{ssl_bundle_comment}', '', $content);
+			} else {
+				$content = str_replace('{ssl_bundle_comment}', '#', $content);
 			}
 
 			wf($vhost_conf_dir.'/ispconfig.vhost', $content);
@@ -1962,9 +1990,9 @@
 		//* Create the ispconfig auth log file and set uid/gid
 		if(!is_file($conf['ispconfig_log_dir'].'/auth.log')) {
 			touch($conf['ispconfig_log_dir'].'/auth.log');
-			exec('chown ispconfig:ispconfig '. $conf['ispconfig_log_dir'].'/auth.log');
-			exec('chmod 660 '. $conf['ispconfig_log_dir'].'/auth.log');
 		}
+		exec('chown ispconfig:ispconfig '. $conf['ispconfig_log_dir'].'/auth.log');
+		exec('chmod 660 '. $conf['ispconfig_log_dir'].'/auth.log');
 
 		if(is_user('getmail')) {
 			rename($install_dir.'/server/scripts/run-getmail.sh','/usr/local/bin/run-getmail.sh');
@@ -1995,6 +2023,11 @@
 			fclose($fh);
 			*/
 		}
+		
+		//* 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');
+	
+	
 	}
 
 	public function configure_dbserver() {
@@ -2196,4 +2229,4 @@
 	}
 }
 
-?>
\ No newline at end of file
+?>

--
Gitblit v1.9.1