From 8c6a4706f8bf375738197ed83d1f91d8a17032ef Mon Sep 17 00:00:00 2001
From: Marius Burkard <m.burkard@pixcept.de>
Date: Thu, 26 May 2016 02:21:46 -0400
Subject: [PATCH] Merge branch 'stable-3.1'

---
 install/tpl/debian_postfix.conf.master                            |    2 
 server/lib/classes/monitor_tools.inc.php                          |  466 ++++++++++++++-----------
 install/dist/conf/centos72.conf.php                               |  219 ++++++++++++
 install/dist/lib/fedora.lib.php                                   |   25 +
 interface/lib/classes/json_handler.inc.php                        |   23 
 install/update.php                                                |    2 
 install/tpl/opensuse_postfix.conf.master                          |    2 
 server/conf/vhost.conf.master                                     |    6 
 interface/web/help/support_message_edit.php                       |    2 
 install/lib/installer_base.lib.php                                |    4 
 install/tpl/fedora_dovecot2.conf.master                           |    1 
 install/sql/ispconfig3.sql                                        |    6 
 install/tpl/opensuse_dovecot2.conf.master                         |    1 
 install/lib/install.lib.php                                       |  100 +++--
 server/plugins-available/apache2_plugin.inc.php                   |    5 
 install/tpl/opensuse_dovecot-sql.conf.master                      |    2 
 server/plugins-available/nginx_plugin.inc.php                     |    5 
 install/tpl/fedora_dovecot-sql.conf.master                        |    2 
 install/tpl/debian_dovecot2.conf.master                           |    1 
 install/dist/lib/gentoo.lib.php                                   |   24 +
 install/dist/lib/opensuse.lib.php                                 |   25 +
 interface/web/mail/mail_domain_edit.php                           |    2 
 install/tpl/opensuse_amavisd_conf.master                          |    4 
 interface/web/dns/dns_spf_edit.php                                |    6 
 install/tpl/gentoo_postfix.conf.master                            |    2 
 interface/web/themes/default/assets/stylesheets/ispconfig.min.css |    2 
 install/sql/incremental/upd_0081.sql                              |    2 
 server/lib/classes/cron.d/900-letsencrypt.inc.php                 |    6 
 install/install.php                                               |    2 
 remoting_client/examples/rest_example.php                         |   57 +++
 interface/web/themes/default/assets/stylesheets/select2x2.png     |    0 
 interface/web/themes/default/assets/stylesheets/ispconfig.css     |    3 
 install/tpl/fedora_postfix.conf.master                            |    2 
 install/tpl/debian6_dovecot-sql.conf.master                       |    2 
 interface/web/help/list/support_message.list.php                  |    3 
 install/tpl/debian_dovecot-sql.conf.master                        |    2 
 install/tpl/fedora_amavisd_conf.master                            |    4 
 37 files changed, 734 insertions(+), 288 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/fedora.lib.php b/install/dist/lib/fedora.lib.php
index d65ac80..11ce420 100644
--- a/install/dist/lib/fedora.lib.php
+++ b/install/dist/lib/fedora.lib.php
@@ -185,6 +185,27 @@
 		if(!is_file('/var/lib/mailman/data/transport-mailman')) touch('/var/lib/mailman/data/transport-mailman');
 		exec('/usr/sbin/postmap /var/lib/mailman/data/transport-mailman');
 
+		//* Create auxillary postfix conf files
+		$configfile = 'helo_access';
+		if(is_file($config_dir.'/'.$configfile)) {
+			copy($config_dir.'/'.$configfile, $config_dir.'/'.$configfile.'~');
+			chmod($config_dir.'/'.$configfile.'~', 0400);
+		}
+		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', 'tpl/'.$configfile.'.master');
+		$content = strtr($content, $postconf_placeholders);
+		# todo: look up this server's ip addrs and loop through each
+		# todo: look up domains hosted on this server and loop through each
+		wf($config_dir.'/'.$configfile, $content);
+
+		$configfile = 'blacklist_helo';
+		if(is_file($config_dir.'/'.$configfile)) {
+			copy($config_dir.'/'.$configfile, $config_dir.'/'.$configfile.'~');
+			chmod($config_dir.'/'.$configfile.'~', 0400);
+		}
+		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', 'tpl/'.$configfile.'.master');
+		$content = strtr($content, $postconf_placeholders);
+		wf($config_dir.'/'.$configfile, $content);
+
 		//* Make a backup copy of the main.cf file
 		copy($config_dir.'/main.cf', $config_dir.'/main.cf~');
 
@@ -440,6 +461,10 @@
 		$content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content);
 		$content = str_replace('{mysql_server_port}', $conf['mysql']['port'], $content);
 		$content = str_replace('{server_id}', $conf['server_id'], $content);
+		# enable iterate_query for dovecot2
+		if(version_compare($dovecot_version,2, '>=')) {
+			$content = str_replace('# iterate_query', 'iterate_query', $content);
+		}
 		wf("$config_dir/$configfile", $content);
 
 		exec("chmod 600 $config_dir/$configfile");
diff --git a/install/dist/lib/gentoo.lib.php b/install/dist/lib/gentoo.lib.php
index b457474..7fdec46 100644
--- a/install/dist/lib/gentoo.lib.php
+++ b/install/dist/lib/gentoo.lib.php
@@ -135,6 +135,26 @@
 		touch($config_dir.'/nested_header_checks');
 		touch($config_dir.'/body_checks');
 
+		//* Create auxillary postfix conf files
+		$configfile = 'helo_access';
+		if(is_file($config_dir.'/'.$configfile)) {
+			copy($config_dir.'/'.$configfile, $config_dir.'/'.$configfile.'~');
+			chmod($config_dir.'/'.$configfile.'~', 0400);
+		}
+		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', 'tpl/'.$configfile.'.master');
+		$content = strtr($content, $postconf_placeholders);
+		# todo: look up this server's ip addrs and loop through each
+		# todo: look up domains hosted on this server and loop through each
+		wf($config_dir.'/'.$configfile, $content);
+
+		$configfile = 'blacklist_helo';
+		if(is_file($config_dir.'/'.$configfile)) {
+			copy($config_dir.'/'.$configfile, $config_dir.'/'.$configfile.'~');
+			chmod($config_dir.'/'.$configfile.'~', 0400);
+		}
+		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', 'tpl/'.$configfile.'.master');
+		$content = strtr($content, $postconf_placeholders);
+		wf($config_dir.'/'.$configfile, $content);
 
 		//* Make a backup copy of the main.cf file
 		copy($config_dir.'/main.cf', $config_dir.'/main.cf~');
@@ -321,6 +341,10 @@
 		//* dovecot-sql.conf
 		$configfile = $config_dir.'/dovecot-sql.conf';
 		$content = $this->get_template_file('debian_dovecot-sql.conf', true, true);
+		# enable iterate_query for dovecot2
+		if(version_compare($dovecot_version,2, '>=')) {
+			$content = str_replace('# iterate_query', 'iterate_query', $content);
+		}
 		$this->write_config_file($configfile, $content);
 	}
 
diff --git a/install/dist/lib/opensuse.lib.php b/install/dist/lib/opensuse.lib.php
index 4613a58..ad70fe2 100644
--- a/install/dist/lib/opensuse.lib.php
+++ b/install/dist/lib/opensuse.lib.php
@@ -197,6 +197,27 @@
 		if(!is_file('/var/lib/mailman/data/transport-mailman')) touch('/var/lib/mailman/data/transport-mailman');
 		exec('/usr/sbin/postmap /var/lib/mailman/data/transport-mailman');
 
+		//* Create auxillary postfix conf files
+		$configfile = 'helo_access';
+		if(is_file($config_dir.'/'.$configfile)) {
+			copy($config_dir.'/'.$configfile, $config_dir.'/'.$configfile.'~');
+			chmod($config_dir.'/'.$configfile.'~', 0400);
+		}
+		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', 'tpl/'.$configfile.'.master');
+		$content = strtr($content, $postconf_placeholders);
+		# todo: look up this server's ip addrs and loop through each
+		# todo: look up domains hosted on this server and loop through each
+		wf($config_dir.'/'.$configfile, $content);
+
+		$configfile = 'blacklist_helo';
+		if(is_file($config_dir.'/'.$configfile)) {
+			copy($config_dir.'/'.$configfile, $config_dir.'/'.$configfile.'~');
+			chmod($config_dir.'/'.$configfile.'~', 0400);
+		}
+		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', 'tpl/'.$configfile.'.master');
+		$content = strtr($content, $postconf_placeholders);
+		wf($config_dir.'/'.$configfile, $content);
+
 		//* Make a backup copy of the main.cf file
 		copy($config_dir.'/main.cf', $config_dir.'/main.cf~');
 
@@ -450,6 +471,10 @@
 		$content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content);
 		$content = str_replace('{mysql_server_port}', $conf['mysql']['port'], $content);
 		$content = str_replace('{server_id}', $conf['server_id'], $content);
+		# enable iterate_query for dovecot2
+		if(version_compare($dovecot_version,2, '>=')) {
+			$content = str_replace('# iterate_query', 'iterate_query', $content);
+		}
 		wf("$config_dir/$configfile", $content);
 
 		exec("chmod 600 $config_dir/$configfile");
diff --git a/install/install.php b/install/install.php
index cff2265..14c9815 100644
--- a/install/install.php
+++ b/install/install.php
@@ -133,7 +133,7 @@
 //** Include the distribution-specific installer class library and configuration
 if(is_file('dist/lib/'.$dist['baseid'].'.lib.php')) include_once 'dist/lib/'.$dist['baseid'].'.lib.php';
 include_once 'dist/lib/'.$dist['id'].'.lib.php';
-include_once 'dist/conf/'.$dist['id'].'.conf.php';
+include_once 'dist/conf/'.$dist['confid'].'.conf.php';
 
 //****************************************************************************************************
 //** Installer Interface
diff --git a/install/lib/install.lib.php b/install/lib/install.lib.php
index 67550c8..93e5470 100644
--- a/install/lib/install.lib.php
+++ b/install/lib/install.lib.php
@@ -27,29 +27,6 @@
 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
-
-/*
-	This function returns a string that describes the installed
-	Linux distribution. e.g. debian40 for Debian GNU/Linux 4.0
-*/
-
-
-
-/*
-Comments to completion forever ;-)
-commandline arguments
-$argv[1]
-
-
-<?
-echo "Total argument passed are : $argc \n";
-for( $i = 0 ; $i <= $argc -1 ;$i++)
-{
-echo "Argument $i : $argv[$i] \n";
-}
-?>
-
-*/
 error_reporting(E_ALL|E_STRICT);
 
 
@@ -59,6 +36,10 @@
 //** IMPORTANT!
 //   This is the same code as in server/lib/classes/monitor_tools.inc.php
 //   So if you change it here, you also have to change it in there!
+//
+//	This function returns a string that describes the installed
+//	Linux distribution. e.g. debian40 for Debian GNU/Linux 4.0
+
 function get_distname() {
 
 	$distname = '';
@@ -68,27 +49,52 @@
 
 	//** Debian or Ubuntu
 	if(file_exists('/etc/debian_version')) {
-		if (strstr(trim(file_get_contents('/etc/issue')), 'Ubuntu')) {
-			if (strstr(trim(file_get_contents('/etc/issue')), 'LTS')) {
-				$lts=" LTS";
-			} else {
-				$lts="";
-			}
+		
+		// Check if this is Ubuntu and not Debian
+		if (strstr(trim(file_get_contents('/etc/issue')), 'Ubuntu') || (is_file('/etc/os-release') && stristr(file_get_contents('/etc/os-release'), 'Ubuntu'))) {
+			
+			$issue = file_get_contents('/etc/issue');
+			
+			// Use content of /etc/issue file
+			if(strstr($issue,'Ubuntu')) {
+				if (strstr(trim($issue), 'LTS')) {
+					$lts=" LTS";
+				} else {
+					$lts="";
+				}
 
-			$issue=file_get_contents('/etc/issue');
-			$distname = 'Ubuntu';
-			$distid = 'debian40';
-			$distbaseid = 'debian';
-			$ver = explode(' ', $issue);
-			$ver = array_filter($ver);
-			$ver = next($ver);
-			$mainver = explode('.', $ver);
-			$mainver = array_filter($mainver);
-			$mainver = current($mainver).'.'.next($mainver);
+				$distname = 'Ubuntu';
+				$distid = 'debian40';
+				$distbaseid = 'debian';
+				$ver = explode(' ', $issue);
+				$ver = array_filter($ver);
+				$ver = next($ver);
+				$mainver = explode('.', $ver);
+				$mainver = array_filter($mainver);
+				$mainver = current($mainver).'.'.next($mainver);
+			// Use content of /etc/os-release file
+			} else {
+				$os_release = file_get_contents('/etc/os-release');
+				if (strstr(trim($os_release), 'LTS')) {
+					$lts = " LTS";
+				} else {
+					$lts = "";
+				}
+				
+				$distname = 'Ubuntu';
+				$distid = 'debian40';
+				$distbaseid = 'debian';
+
+				preg_match("/.*VERSION=\"(.*)\".*/ui", $os_release, $ver);
+				$ver = str_replace("LTS", "", $ver[1]);
+				$ver = explode(" ", $ver, 2);
+				$ver = reset($ver);
+				$mainver = $ver;
+			}
 			switch ($mainver){
 			case "16.04":
 				$relname = "(Xenial Xerus)";
-				$distid = 'ubuntu1604';
+				$distconfid = 'ubuntu1604';
 				break;
 			case "15.10":
 				$relname = "(Wily Werewolf)";
@@ -163,7 +169,7 @@
 				$relname = "UNKNOWN";
 			}
 			$distver = $ver.$lts." ".$relname;
-			swriteln("Operating System: ".$distver."\n");
+			swriteln("Operating System: ".$distname.' '.$distver."\n");
 		} elseif(trim(file_get_contents('/etc/debian_version')) == '4.0') {
 			$distname = 'Debian';
 			$distver = '4.0';
@@ -280,6 +286,13 @@
 			$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 = 'centos70';
+			$distconfid = 'centos72';
+			$distbaseid = 'fedora';
+			swriteln("Operating System: CentOS 7.2\n");
 		} elseif(stristr($content, 'CentOS Linux release 7')) {
 			$distname = 'CentOS';
 			$distver = 'Unknown';
@@ -310,8 +323,11 @@
 	} else {
 		die('Unrecognized GNU/Linux distribution');
 	}
+	
+	// Set $distconfid to distid, if no different id for the config is defined
+	if(!isset($distconfid)) $distconfid = $distid;
 
-	return array('name' => $distname, 'version' => $distver, 'id' => $distid, 'baseid' => $distbaseid);
+	return array('name' => $distname, 'version' => $distver, 'id' => $distid, 'confid' => $distconfid, 'baseid' => $distbaseid);
 }
 
 function sread() {
diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php
index 334a16b..63ddb09 100644
--- a/install/lib/installer_base.lib.php
+++ b/install/lib/installer_base.lib.php
@@ -1277,6 +1277,10 @@
 		$content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content);
 		$content = str_replace('{mysql_server_port}', $conf['mysql']['port'], $content);
 		$content = str_replace('{server_id}', $conf['server_id'], $content);
+		# enable iterate_query for dovecot2
+		if(version_compare($dovecot_version,2, '>=')) {
+			$content = str_replace('# iterate_query', 'iterate_query', $content);
+		}
 		wf($config_dir.'/'.$configfile, $content);
 
 		chmod($config_dir.'/'.$configfile, 0600);
diff --git a/install/sql/incremental/upd_0081.sql b/install/sql/incremental/upd_0081.sql
index 040f640..6923678 100644
--- a/install/sql/incremental/upd_0081.sql
+++ b/install/sql/incremental/upd_0081.sql
@@ -198,7 +198,7 @@
 	`traffic_date` date NOT NULL,
 	`in_bytes` bigint(32) unsigned NOT NULL,
 	`out_bytes` bigint(32) unsigned NOT NULL, 
-	PRIMARY KEY (`hostname`,`traffic_date`)
+	UNIQUE KEY (`hostname`,`traffic_date`)
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
 
 ALTER TABLE `mail_forwarding` ADD COLUMN `allow_send_as` ENUM('n','y') NOT NULL DEFAULT 'n' AFTER `active`;
diff --git a/install/sql/ispconfig3.sql b/install/sql/ispconfig3.sql
index d9898fb..a14a0d6 100644
--- a/install/sql/ispconfig3.sql
+++ b/install/sql/ispconfig3.sql
@@ -657,7 +657,7 @@
   `traffic_date` date NOT NULL,
   `in_bytes` bigint(32) unsigned NOT NULL,
   `out_bytes` bigint(32) unsigned NOT NULL,
-  PRIMARY KEY (`hostname`,`traffic_date`)
+  UNIQUE KEY (`hostname`,`traffic_date`)
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
 
 -- --------------------------------------------------------
@@ -1153,7 +1153,7 @@
   `veid` int(11) NOT NULL DEFAULT '0',
   `traffic_date` date NULL DEFAULT NULL,
   `traffic_bytes` bigint(32) unsigned NOT NULL DEFAULT '0',
-  PRIMARY KEY (`veid`,`traffic_date`)
+  UNIQUE KEY (`veid`,`traffic_date`)
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
 
 --
@@ -2043,7 +2043,7 @@
   `hostname` varchar(255) NOT NULL DEFAULT '',
   `traffic_date` date NULL DEFAULT NULL,
   `traffic_bytes` bigint(32) unsigned NOT NULL default '0',
-  PRIMARY KEY  (`hostname`,`traffic_date`)
+  UNIQUE KEY  (`hostname`,`traffic_date`)
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
 
 -- --------------------------------------------------------
diff --git a/install/tpl/debian6_dovecot-sql.conf.master b/install/tpl/debian6_dovecot-sql.conf.master
index 30afc18..e05330d 100644
--- a/install/tpl/debian6_dovecot-sql.conf.master
+++ b/install/tpl/debian6_dovecot-sql.conf.master
@@ -19,4 +19,4 @@
 
 # The iterate_query is required for the doveadm command only and works only on dovecot 2 servers.
 # Do not enable it on Dovecot 1.x servers
-# iterate_query = SELECT email as user FROM mail_user
+# iterate_query = SELECT email as user FROM mail_user WHERE server_id = '{server_id}'
diff --git a/install/tpl/debian_dovecot-sql.conf.master b/install/tpl/debian_dovecot-sql.conf.master
index b8919ff..2e08580 100644
--- a/install/tpl/debian_dovecot-sql.conf.master
+++ b/install/tpl/debian_dovecot-sql.conf.master
@@ -126,5 +126,5 @@
 
 # The iterate_query is required for the doveadm command only and works only on dovecot 2 servers.
 # Do not enable it on Dovecot 1.x servers
-# iterate_query = SELECT email as user FROM mail_user
+# iterate_query = SELECT email as user FROM mail_user WHERE server_id = '{server_id}'
 
diff --git a/install/tpl/debian_dovecot2.conf.master b/install/tpl/debian_dovecot2.conf.master
index a753433..80ca21d 100644
--- a/install/tpl/debian_dovecot2.conf.master
+++ b/install/tpl/debian_dovecot2.conf.master
@@ -63,3 +63,4 @@
   postmaster_address = webmaster@localhost
   mail_plugins = quota sieve
 }
+mail_plugins = $mail_plugins quota
diff --git a/install/tpl/debian_postfix.conf.master b/install/tpl/debian_postfix.conf.master
index 30aa483..dce69b0 100644
--- a/install/tpl/debian_postfix.conf.master
+++ b/install/tpl/debian_postfix.conf.master
@@ -26,7 +26,7 @@
 proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $sender_bcc_maps $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $smtpd_sender_login_maps
 smtpd_helo_required = yes
 smtpd_helo_restrictions = permit_sasl_authenticated, permit_mynetworks, check_helo_access regexp:{config_dir}/helo_access, reject_invalid_hostname, reject_non_fqdn_hostname, check_helo_access regexp:{config_dir}/blacklist_helo
-smtpd_sender_restrictions = check_sender_access regexp:{config_dir}/tag_as_originating.re {reject_slm}, permit_mynetworks, check_sender_access mysql:{config_dir}/mysql-virtual_sender.cf, check_sender_access regexp:{config_dir}/tag_as_foreign.re
+smtpd_sender_restrictions = check_sender_access regexp:{config_dir}/tag_as_originating.re {reject_slm}, permit_mynetworks, permit_sasl_authenticated, check_sender_access mysql:{config_dir}/mysql-virtual_sender.cf, check_sender_access regexp:{config_dir}/tag_as_foreign.re
 smtpd_client_restrictions = check_client_access mysql:{config_dir}/mysql-virtual_client.cf
 smtpd_client_message_rate_limit = 100
 maildrop_destination_concurrency_limit = 1
diff --git a/install/tpl/fedora_amavisd_conf.master b/install/tpl/fedora_amavisd_conf.master
index 8935df7..6e454e7 100644
--- a/install/tpl/fedora_amavisd_conf.master
+++ b/install/tpl/fedora_amavisd_conf.master
@@ -146,8 +146,8 @@
 
 $myhostname = '{hostname}';
 
-$notify_method  = 'smtp:[127.0.0.1]:10027';
-$forward_method = 'smtp:[127.0.0.1]:10025';  # set to undef with milter!
+$notify_method  = 'smtp:*:*';
+$forward_method = 'smtp:*:*';  # set to undef with milter!
 
 # $os_fingerprint_method = 'p0f:127.0.0.1:2345';  # to query p0f-analyzer.pl
 
diff --git a/install/tpl/fedora_dovecot-sql.conf.master b/install/tpl/fedora_dovecot-sql.conf.master
index d242c8c..5d06d51 100644
--- a/install/tpl/fedora_dovecot-sql.conf.master
+++ b/install/tpl/fedora_dovecot-sql.conf.master
@@ -139,4 +139,4 @@
 
 # The iterate_query is required for the doveadm command only and works only on dovecot 2 servers.
 # Do not enable it on Dovecot 1.x servers
-# iterate_query = SELECT email as user FROM mail_user
\ No newline at end of file
+# iterate_query = SELECT email as user FROM mail_user WHERE server_id = '{server_id}'
diff --git a/install/tpl/fedora_dovecot2.conf.master b/install/tpl/fedora_dovecot2.conf.master
index a527676..c14af1d 100644
--- a/install/tpl/fedora_dovecot2.conf.master
+++ b/install/tpl/fedora_dovecot2.conf.master
@@ -61,3 +61,4 @@
   postmaster_address = webmaster@localhost
   mail_plugins = quota sieve
 }
+mail_plugins = $mail_plugins quota
diff --git a/install/tpl/fedora_postfix.conf.master b/install/tpl/fedora_postfix.conf.master
index 974277f..3aa69ae 100644
--- a/install/tpl/fedora_postfix.conf.master
+++ b/install/tpl/fedora_postfix.conf.master
@@ -23,7 +23,7 @@
 proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $sender_bcc_maps $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $smtpd_sender_login_maps
 smtpd_helo_required = yes
 smtpd_helo_restrictions = permit_sasl_authenticated, permit_mynetworks, check_helo_access regexp:{config_dir}/helo_access, reject_invalid_hostname, reject_non_fqdn_hostname, check_helo_access regexp:{config_dir}/blacklist_helo
-smtpd_sender_restrictions = check_sender_access regexp:{config_dir}/tag_as_originating.re {reject_slm}, permit_mynetworks, check_sender_access mysql:{config_dir}/mysql-virtual_sender.cf, check_sender_access regexp:{config_dir}/tag_as_foreign.re
+smtpd_sender_restrictions = check_sender_access regexp:{config_dir}/tag_as_originating.re {reject_slm}, permit_mynetworks, permit_sasl_authenticated, check_sender_access mysql:{config_dir}/mysql-virtual_sender.cf, check_sender_access regexp:{config_dir}/tag_as_foreign.re
 smtpd_client_restrictions = check_client_access mysql:{config_dir}/mysql-virtual_client.cf
 smtpd_client_message_rate_limit = 100
 maildrop_destination_concurrency_limit = 1
diff --git a/install/tpl/gentoo_postfix.conf.master b/install/tpl/gentoo_postfix.conf.master
index 9556ba3..b40a9a7 100644
--- a/install/tpl/gentoo_postfix.conf.master
+++ b/install/tpl/gentoo_postfix.conf.master
@@ -22,7 +22,7 @@
 proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $smtpd_sender_login_maps
 smtpd_helo_required = yes
 smtpd_helo_restrictions = permit_sasl_authenticated, permit_mynetworks, check_helo_access regexp:{config_dir}/helo_access, reject_invalid_hostname, reject_non_fqdn_hostname, check_helo_access regexp:{config_dir}/blacklist_helo
-smtpd_sender_restrictions = check_sender_access regexp:{config_dir}/tag_as_originating.re {reject_slm}, permit_mynetworks, check_sender_access mysql:{config_dir}/mysql-virtual_sender.cf, check_sender_access regexp:{config_dir}/tag_as_foreign.re
+smtpd_sender_restrictions = check_sender_access regexp:{config_dir}/tag_as_originating.re {reject_slm}, permit_mynetworks, permit_sasl_authenticated, check_sender_access mysql:{config_dir}/mysql-virtual_sender.cf, check_sender_access regexp:{config_dir}/tag_as_foreign.re
 smtpd_client_restrictions = check_client_access mysql:{config_dir}/mysql-virtual_client.cf
 smtpd_client_message_rate_limit = 100
 maildrop_destination_concurrency_limit = 1
diff --git a/install/tpl/opensuse_amavisd_conf.master b/install/tpl/opensuse_amavisd_conf.master
index df5f03f..a756bb5 100644
--- a/install/tpl/opensuse_amavisd_conf.master
+++ b/install/tpl/opensuse_amavisd_conf.master
@@ -145,8 +145,8 @@
 
 $myhostname = 'linux-jfp8.site';
 
-$notify_method  = 'smtp:[127.0.0.1]:10027';
-$forward_method = 'smtp:[127.0.0.1]:10025';  # set to undef with milter!
+$notify_method  = 'smtp:*:*';
+$forward_method = 'smtp:*:*';  # set to undef with milter!
 
 # $final_virus_destiny      = D_DISCARD;
 # $final_banned_destiny     = D_BOUNCE;
diff --git a/install/tpl/opensuse_dovecot-sql.conf.master b/install/tpl/opensuse_dovecot-sql.conf.master
index f9ffbf7..5d06d51 100644
--- a/install/tpl/opensuse_dovecot-sql.conf.master
+++ b/install/tpl/opensuse_dovecot-sql.conf.master
@@ -139,4 +139,4 @@
 
 # The iterate_query is required for the doveadm command only and works only on dovecot 2 servers.
 # Do not enable it on Dovecot 1.x servers
-# iterate_query = SELECT email as user FROM mail_user
+# iterate_query = SELECT email as user FROM mail_user WHERE server_id = '{server_id}'
diff --git a/install/tpl/opensuse_dovecot2.conf.master b/install/tpl/opensuse_dovecot2.conf.master
index 8deb305..f28c109 100644
--- a/install/tpl/opensuse_dovecot2.conf.master
+++ b/install/tpl/opensuse_dovecot2.conf.master
@@ -60,3 +60,4 @@
   postmaster_address = webmaster@localhost
   mail_plugins = quota sieve
 }
+mail_plugins = $mail_plugins quota
diff --git a/install/tpl/opensuse_postfix.conf.master b/install/tpl/opensuse_postfix.conf.master
index 016f672..cb021b2 100644
--- a/install/tpl/opensuse_postfix.conf.master
+++ b/install/tpl/opensuse_postfix.conf.master
@@ -25,7 +25,7 @@
 proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $sender_bcc_maps $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $smtpd_sender_login_maps
 smtpd_helo_required = yes
 smtpd_helo_restrictions = permit_sasl_authenticated, permit_mynetworks, check_helo_access regexp:{config_dir}/helo_access, reject_invalid_hostname, reject_non_fqdn_hostname, check_helo_access regexp:{config_dir}/blacklist_helo
-smtpd_sender_restrictions = check_sender_access regexp:{config_dir}/tag_as_originating.re {reject_slm}, permit_mynetworks, check_sender_access mysql:{config_dir}/mysql-virtual_sender.cf, check_sender_access regexp:{config_dir}/tag_as_foreign.re
+smtpd_sender_restrictions = check_sender_access regexp:{config_dir}/tag_as_originating.re {reject_slm}, permit_mynetworks, permit_sasl_authenticated, check_sender_access mysql:{config_dir}/mysql-virtual_sender.cf, check_sender_access regexp:{config_dir}/tag_as_foreign.re
 smtpd_client_restrictions = check_client_access mysql:{config_dir}/mysql-virtual_client.cf
 smtpd_client_message_rate_limit = 100
 maildrop_destination_concurrency_limit = 1
diff --git a/install/update.php b/install/update.php
index 94de945..4626b50 100644
--- a/install/update.php
+++ b/install/update.php
@@ -137,7 +137,7 @@
 //** Include the distribution-specific installer class library and configuration
 if(is_file('dist/lib/'.$dist['baseid'].'.lib.php')) include_once 'dist/lib/'.$dist['baseid'].'.lib.php';
 include_once 'dist/lib/'.$dist['id'].'.lib.php';
-include_once 'dist/conf/'.$dist['id'].'.conf.php';
+include_once 'dist/conf/'.$dist['confid'].'.conf.php';
 
 //** Get hostname
 exec('hostname -f', $tmp_out);
diff --git a/interface/lib/classes/json_handler.inc.php b/interface/lib/classes/json_handler.inc.php
index d6d58c3..de8dd5b 100644
--- a/interface/lib/classes/json_handler.inc.php
+++ b/interface/lib/classes/json_handler.inc.php
@@ -88,15 +88,11 @@
 		$keys = array_keys($_GET);
 		$method = reset($keys);
 		$params = array();
-
-		if(is_array($_POST)) {
-			foreach($_POST as $key => $val) {
-				$tmp = json_decode($val, true);
-				if(!$tmp) $params[] = $val;
-				else $params[] = (array)$tmp;
-			}
-		}
-
+		
+		$raw = file_get_contents("php://input");
+		$json = json_decode($raw, true);
+		if(!is_array($json)) $this->_return_json('invalid_data', 'The JSON data sent to the api is invalid');
+		
 		if(array_key_exists($method, $this->methods) == false) {
 			$this->_return_json('invalid_method', 'Method ' . $method . ' does not exist');
 		}
@@ -109,7 +105,14 @@
 		if(method_exists($this->classes[$class_name], $method) == false) {
 			$this->_return_json('invalid_method', 'Method ' . $method . ' does not exist in the class it was expected (' . $class_name . ')');
 		}
-
+		
+		$methObj = new ReflectionMethod($this->classes[$class_name], $method);
+		foreach($methObj->getParameters() as $param) {
+			$pname = $param->name;
+			if(isset($json[$pname])) $params[] = $json[$pname];
+			else $params[] = null;
+		}
+		
 		try {
 			$this->_return_json('ok', '', call_user_func_array(array($this->classes[$class_name], $method), $params));
 		} catch(SoapFault $e) {
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;
diff --git a/interface/web/help/list/support_message.list.php b/interface/web/help/list/support_message.list.php
index 1724c54..efb2432 100644
--- a/interface/web/help/list/support_message.list.php
+++ b/interface/web/help/list/support_message.list.php
@@ -43,7 +43,8 @@
 	'suffix' => '',
 	'width'  => '',
 	'datasource'=> array (  'type' => 'SQL',
-		'querystring'  => 'SELECT userid,username FROM sys_user WHERE {AUTHSQL} ORDER BY username',
+//		'querystring'  => 'SELECT userid,username FROM sys_user WHERE {AUTHSQL} ORDER BY username',
+		'querystring'  => 'SELECT userid,username FROM sys_user ORDER BY username',
 		'keyfield'  => 'userid',
 		'valuefield' => 'username'
 	),
diff --git a/interface/web/help/support_message_edit.php b/interface/web/help/support_message_edit.php
index 4fcf5da..9886541 100644
--- a/interface/web/help/support_message_edit.php
+++ b/interface/web/help/support_message_edit.php
@@ -73,7 +73,7 @@
 			}
 			$confirmation_message .= "\n\n".$app->tform->lng('message_txt').": \"".$this->dataRecord['message']."\"";
 			$confirmation_message .= "\n\nISPConfig: ".($_SERVER['HTTPS'] == 'on' ? 'https://' : 'http://').$_SERVER['HTTP_HOST'];
-			$app->functions->mail($sender_email, $subject, $confirmation_message, $recipient_email);
+			if ($this->dataRecord['subject'] != '' && $this->dataRecord['message'] != '') $app->functions->mail($sender_email, $subject, $confirmation_message, $recipient_email);
 		} else {
 			$app->tform->errorMessage .= $app->tform->lng("recipient_or_sender_email_address_not_valid_txt")."<br />";
 		}
diff --git a/interface/web/mail/mail_domain_edit.php b/interface/web/mail/mail_domain_edit.php
index d87b921..ad383c4 100644
--- a/interface/web/mail/mail_domain_edit.php
+++ b/interface/web/mail/mail_domain_edit.php
@@ -241,7 +241,7 @@
 		if($_SESSION["s"]["user"]["typ"] != 'admin') {
 			// Get the limits of the client
 			$client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]);
-			$client = $app->db->queryOneRecord("SELECT limit_maildomain, default_mailserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ?", $client_group_id);
+			$client = $app->db->queryOneRecord("SELECT client.mail_servers, limit_maildomain, default_mailserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ?", $client_group_id);
 			// When the record is updated
 			if($this->id > 0) {
 				// restore the server ID if the user is not admin and record is edited
diff --git a/interface/web/themes/default/assets/stylesheets/ispconfig.css b/interface/web/themes/default/assets/stylesheets/ispconfig.css
index 866e721..fedee6f 100644
--- a/interface/web/themes/default/assets/stylesheets/ispconfig.css
+++ b/interface/web/themes/default/assets/stylesheets/ispconfig.css
@@ -231,6 +231,9 @@
     transition: background ease 500ms; }
     .table tbody tr:last-child {
       border-radius: 4px; }
+    .table tbody tr td {
+      text-overflow: ellipsis;
+      overflow-x: hidden; }
 
 .tfooter {
   margin-top: -1px;
diff --git a/interface/web/themes/default/assets/stylesheets/ispconfig.min.css b/interface/web/themes/default/assets/stylesheets/ispconfig.min.css
index b02dc47..4477cea 100644
--- a/interface/web/themes/default/assets/stylesheets/ispconfig.min.css
+++ b/interface/web/themes/default/assets/stylesheets/ispconfig.min.css
@@ -1 +1 @@
-body{overflow-y:scroll}.left{float:left}.right{float:right}.clear:after{content:"";display:table;clear:both}.marginTop15{margin-top:15px}.paddingX5{padding-left:5px!important;padding-right:5px!important}.width65{width:65px}.form-group input[type='checkbox']{margin-top:10px}.control-label{font-weight:normal}.control-label:after{content:":"}.formbutton-default{padding:6px 30px;border-bottom-style:solid;border-bottom-width:2px;font-size:12px;font-weight:bold;transition:all ease 500ms}.formbutton-success,.formbutton-danger{padding:6px 30px;border-style:solid;border-width:1px;border-bottom-width:solid;font-size:12px;font-weight:bold;transition:all ease 500ms}.formbutton-narrow{padding:6px 8px;margin-left:2px;margin-right:2px}.formbutton-narrower{padding:4px 6px}#main-wrapper{margin:0 auto;width:95%;max-width:1260px}#logo{float:left;width:200px;height:65px;margin-top:10px}#logo a{display:block;width:100%;height:100%}#headerbar{float:right}#searchform{float:right;margin-top:16px}#searchform>div{position:relative;display:table}#searchform>div>div{display:table-cell;padding-right:8px;vertical-align:top}#searchform .icon{padding:0 2px;font-size:16px}#logout-button{float:right;margin-top:16px;margin-left:25px;border-bottom-style:solid;border-bottom-width:2px;transition:all ease 500ms}#main-navigation{margin-top:24px}#main-navigation a{padding:0 12px;height:70px;border-bottom-style:solid;botder-bottom-width:2px;transition:all ease 500ms}#main-navigation .icon{font-size:32px}#main-navigation .title{margin-top:2px;font-weight:bold}.btn-group-justified .btn{border-right-width:0}.btn-group-justified .btn:last-of-type{border-right-width:1px}#content{width:78%}#passBar,#passText{display:inline-block;vertical-align:middle}#passBar{height:11px;padding:0}#passBar>div{height:100%;padding:0}#sidebar{margin-top:27px;width:18%;border-style:solid;border-width:1px;border-radius:4px}#sidebar header{margin:1px;padding:0 10px;height:40px;line-height:40px;font-weight:bold;border-top-left-radius:2px;border-top-right-radius:2px}#sidebar ul{margin:0;padding:0;list-style:none}#sidebar li{padding:10px;border-top-style:solid;border-top-width:1px;font-size:12px}#sidebar a{text-decoration:none;transition:color ease 500ms}.page-header{margin:20px 0;padding:0}.alert-notification a{font-weight:bold;text-decoration:none;transition:color ease 500ms}.alert-label,.alert-content{display:inline-block;vertical-align:top}.alert-label{width:60px}.modules{margin:0;padding:0;list-style:none}.modules li{float:left;margin-right:15px;margin-bottom:15px;padding:8px;width:200px;border-radius:4px;border-style:solid;border-width:1px}.modules .icon{float:left;margin-right:15px;font-size:50px}.modules .left{margin-top:5px}.modules .title{margin-top:6px;margin-left:20px;font-size:16px;font-weight:bold}.modules .button{margin-top:10px;width:100%;border-bottom-style:solid;border-bottom-width:2px;font-size:12px;font-weight:bold;transition:all ease 500ms}.modules a{text-decoration:none}.table-wrapper{margin-bottom:20px;border-radius:4px;border-style:solid;border-width:1px}.table{table-layout:fixed;margin-bottom:1px}.table caption{padding:5px 10px;text-align:left;font-weight:bold;font-size:18px;border-bottom-style:solid;border-bottom-width:1px}.table tbody tr{border-top-style:solid;border-top-width:1px;transition:background ease 500ms}.table tbody tr:last-child{border-radius:4px}.tfooter{margin-top:-1px;height:40px;border-top-style:solid;border-top-width:1px}.pagination{margin:10px 0}.progress{display:inline-block;margin-bottom:0;width:150px;height:10px}p.fieldset-legend{display:none}.content-tab-wrapper{border-style:solid;border-width:1px;border-radius:4px}.content-tab-wrapper .nav-tabs>li>a{border-radius:0;border:none!important;border-right-style:solid!important;border-right-width:1px!important;outline:0;font-weight:bold;transition:background ease 500ms}.content-tab-wrapper .nav-tabs li:not(:first-child) a{margin-left:-2px}.tab-content{padding:25px 10px}.input-group-btn .icon-calendar{font-size:18px}thead.dark th{height:40px;line-height:40px;font-weight:normal}thead.dark th.small-col{width:14%}thead.dark th.tiny-col{width:8%;overflow:hidden;text-overflow:ellipsis}thead.dark th[data-column]{cursor:pointer}thead.dark th[data-column][data-ordered]{font-weight:bold;position:relative}thead.dark th[data-column][data-ordered]:before{content:"";display:block;position:absolute;right:5px;top:16px;width:0;height:0;vertical-align:middle;border-bottom:5px solid #fff;border-top:5px solid transparent;border-right:5px solid transparent;border-left:6px solid transparent;line-height:inherit}thead.dark th[data-column][data-ordered="desc"]:before{top:21px;border-bottom:5px solid transparent;border-top:5px solid #fff}thead.dark td input,thead.dark td select{width:100%}#footer{margin:20px 0;padding-top:20px;border-top-style:solid;border-top-width:1px;text-align:center;font-size:10px}.menu-btn{display:none;cursor:pointer}.df-container,.gs-container{position:relative}.gs-container:after{content:"";display:table;clear:both}ul.df-resultbox,ul.gs-resultbox{display:block;position:absolute;left:0;top:100%;margin:0;padding:0 0 10px;min-width:250px;max-width:500px;z-index:999999;background:#fff;list-style:none;box-shadow:2px 2px 5px #c5c5c5;border-radius:5px}ul.df-resultbox li,ul.gs-resultbox li{float:none;display:block;cursor:pointer;padding:0 10px}ul.gs-resultbox li{padding:3px 10px;line-height:1.1;font-size:.9em}ul.df-resultbox li:nth-child(even),ul.gs-resultbox li:nth-child(even){background:#f2f5f7}ul.df-resultbox li.df-cheader,ul.gs-resultbox li.gs-cheader{background:#fff;padding-top:10px;margin-bottom:10px}ul.df-resultbox li p,ul.gs-resultbox li p{margin-bottom:0;color:inherit}ul.df-resultbox li.df-cheader p.df-cheader-title,ul.gs-resultbox li.gs-cheader p.gs-cheader-title{font-weight:bold;margin-bottom:0}ul.df-resultbox li.df-cheader p.df-cheader-limit,ul.gs-resultbox li.gs-cheader p.gs-cheader-limit{font-weight:normal}ul.df-resultbox li.df-cdata img,ul.gs-resultbox li.gs-cdata img{margin-right:12px}ul.df-resultbox li.df-cdata p span.df-cdata-title,ul.gs-resultbox li.gs-cdata p span.gs-cdata-title{font-weight:bold}ul.gs-resultbox li.gs-cdata p span.gs-cdata-title{display:block}ul.df-resultbox li:first-child,ul.gs-resultbox li:first-child{border-top-left-radius:5px;border-top-right-radius:5px}ul.df-resultbox li:last-child,ul.gs-resultbox li:last-child{border-bottom-left-radius:5px;border-bottom-right-radius:5px}span.flags{background-image:url("../images/flags_sprite.png");background-repeat:no-repeat;min-height:20px;padding-left:27px;vertical-align:middle}span.flag-el{background-position:0 -1475px}span.flag-ad{background-position:0 -1px}span.flag-ae{background-position:0 -23px}span.flag-af{background-position:0 -45px}span.flag-ag{background-position:0 -67px}span.flag-ai{background-position:0 -89px}span.flag-al{background-position:0 -111px}span.flag-am{background-position:0 -133px}span.flag-an{background-position:0 -155px}span.flag-ao{background-position:0 -177px}span.flag-aq{background-position:0 -199px}span.flag-ar{background-position:0 -221px}span.flag-as{background-position:0 -243px}span.flag-at{background-position:0 -265px}span.flag-au{background-position:0 -287px}span.flag-aw{background-position:0 -309px}span.flag-ax{background-position:0 -331px}span.flag-az{background-position:0 -353px}span.flag-ba{background-position:0 -375px}span.flag-bb{background-position:0 -397px}span.flag-bd{background-position:0 -419px}span.flag-be{background-position:0 -441px}span.flag-bf{background-position:0 -463px}span.flag-bg{background-position:0 -485px}span.flag-bh{background-position:0 -507px}span.flag-bi{background-position:0 -529px}span.flag-bj{background-position:0 -551px}span.flag-bm{background-position:0 -573px}span.flag-bn{background-position:0 -595px}span.flag-bo{background-position:0 -617px}span.flag-br{background-position:0 -639px}span.flag-bs{background-position:0 -661px}span.flag-bt{background-position:0 -683px}span.flag-bv{background-position:0 -705px}span.flag-bw{background-position:0 -727px}span.flag-by{background-position:0 -749px}span.flag-bz{background-position:0 -771px}span.flag-ca{background-position:0 -793px}span.flag-cc{background-position:0 -837px}span.flag-cd{background-position:0 -859px}span.flag-cf{background-position:0 -881px}span.flag-cg{background-position:0 -903px}span.flag-ch{background-position:0 -925px}span.flag-ci{background-position:0 -947px}span.flag-ck{background-position:0 -969px}span.flag-cl{background-position:0 -991px}span.flag-cm{background-position:0 -1013px}span.flag-cn{background-position:0 -1035px}span.flag-co{background-position:0 -1057px}span.flag-cr{background-position:0 -1079px}span.flag-cs{background-position:0 -1101px}span.flag-cu{background-position:0 -1123px}span.flag-cv{background-position:0 -1145px}span.flag-cx{background-position:0 -1167px}span.flag-cy{background-position:0 -1189px}span.flag-cz{background-position:0 -1211px}span.flag-de{background-position:0 -1233px}span.flag-dj{background-position:0 -1255px}span.flag-dk{background-position:0 -1277px}span.flag-dm{background-position:0 -1299px}span.flag-do{background-position:0 -1321px}span.flag-dz{background-position:0 -1343px}span.flag-ec{background-position:0 -1365px}span.flag-ee{background-position:0 -1387px}span.flag-eg{background-position:0 -1409px}span.flag-eh{background-position:0 -1431px}span.flag-er{background-position:0 -1475px}span.flag-es{background-position:0 -1497px}span.flag-et{background-position:0 -1519px}span.flag-fi{background-position:0 -1585px}span.flag-fj{background-position:0 -1607px}span.flag-fk{background-position:0 -1629px}span.flag-fm{background-position:0 -1651px}span.flag-fo{background-position:0 -1673px}span.flag-fr{background-position:0 -1695px}span.flag-ga{background-position:0 -1717px}span.flag-gb,span.flag-en{background-position:0 -1739px}span.flag-gd{background-position:0 -1761px}span.flag-ge{background-position:0 -1783px}span.flag-gf{background-position:0 -1805px}span.flag-gh{background-position:0 -1827px}span.flag-gi{background-position:0 -1849px}span.flag-gl{background-position:0 -1871px}span.flag-gm{background-position:0 -1893px}span.flag-gn{background-position:0 -1915px}span.flag-gp{background-position:0 -1937px}span.flag-gq{background-position:0 -1959px}span.flag-gr{background-position:0 -1981px}span.flag-gs{background-position:0 -2003px}span.flag-gt{background-position:0 -2025px}span.flag-gu{background-position:0 -2047px}span.flag-gw{background-position:0 -2069px}span.flag-gy{background-position:0 -2091px}span.flag-hk{background-position:0 -2113px}span.flag-hm{background-position:0 -2135px}span.flag-hn{background-position:0 -2157px}span.flag-hr{background-position:0 -2179px}span.flag-ht{background-position:0 -2201px}span.flag-hu{background-position:0 -2223px}span.flag-id{background-position:0 -2245px}span.flag-ie{background-position:0 -2267px}span.flag-il{background-position:0 -2289px}span.flag-in{background-position:0 -2311px}span.flag-io{background-position:0 -2333px}span.flag-iq{background-position:0 -2355px}span.flag-ir{background-position:0 -2377px}span.flag-is{background-position:0 -2399px}span.flag-it{background-position:0 -2421px}span.flag-jm{background-position:0 -2443px}span.flag-jo{background-position:0 -2465px}span.flag-jp{background-position:0 -2487px}span.flag-ke{background-position:0 -2509px}span.flag-kg{background-position:0 -2531px}span.flag-kh{background-position:0 -2553px}span.flag-ki{background-position:0 -2575px}span.flag-km{background-position:0 -2597px}span.flag-kn{background-position:0 -2619px}span.flag-kp{background-position:0 -2641px}span.flag-kr{background-position:0 -2663px}span.flag-kw{background-position:0 -2685px}span.flag-ky{background-position:0 -2707px}span.flag-kz{background-position:0 -2729px}span.flag-la{background-position:0 -2751px}span.flag-lb{background-position:0 -2773px}span.flag-lc{background-position:0 -2795px}span.flag-li{background-position:0 -2817px}span.flag-lk{background-position:0 -2839px}span.flag-lr{background-position:0 -2861px}span.flag-ls{background-position:0 -2883px}span.flag-lt{background-position:0 -2905px}span.flag-lu{background-position:0 -2927px}span.flag-lv{background-position:0 -2949px}span.flag-ly{background-position:0 -2971px}span.flag-ma{background-position:0 -2993px}span.flag-mc{background-position:0 -3015px}span.flag-md{background-position:0 -3037px}span.flag-me{background-position:0 -3059px}span.flag-mg{background-position:0 -3081px}span.flag-mh{background-position:0 -3103px}span.flag-mk{background-position:0 -3125px}span.flag-ml{background-position:0 -3147px}span.flag-mm{background-position:0 -3169px}span.flag-mn{background-position:0 -3191px}span.flag-mo{background-position:0 -3213px}span.flag-mp{background-position:0 -3235px}span.flag-mq{background-position:0 -3257px}span.flag-mr{background-position:0 -3279px}span.flag-ms{background-position:0 -3301px}span.flag-mt{background-position:0 -3323px}span.flag-mu{background-position:0 -3345px}span.flag-mv{background-position:0 -3367px}span.flag-mw{background-position:0 -3389px}span.flag-mx{background-position:0 -3411px}span.flag-my{background-position:0 -3433px}span.flag-mz{background-position:0 -3455px}span.flag-na{background-position:0 -3477px}span.flag-nc{background-position:0 -3499px}span.flag-ne{background-position:0 -3521px}span.flag-nf{background-position:0 -3543px}span.flag-ng{background-position:0 -3565px}span.flag-ni{background-position:0 -3587px}span.flag-nl{background-position:0 -3609px}span.flag-no{background-position:0 -3631px}span.flag-np{background-position:0 -3653px}span.flag-nr{background-position:0 -3675px}span.flag-nu{background-position:0 -3697px}span.flag-nz{background-position:0 -3719px}span.flag-om{background-position:0 -3741px}span.flag-pa{background-position:0 -3763px}span.flag-pe{background-position:0 -3785px}span.flag-pf{background-position:0 -3807px}span.flag-pg{background-position:0 -3829px}span.flag-ph{background-position:0 -3851px}span.flag-pk{background-position:0 -3873px}span.flag-pl{background-position:0 -3895px}span.flag-pm{background-position:0 -3917px}span.flag-pn{background-position:0 -3939px}span.flag-pr{background-position:0 -3961px}span.flag-ps{background-position:0 -3983px}span.flag-pt{background-position:0 -4005px}span.flag-pw{background-position:0 -4027px}span.flag-py{background-position:0 -4049px}span.flag-qa{background-position:0 -4071px}span.flag-re{background-position:0 -4093px}span.flag-ro{background-position:0 -4115px}span.flag-rs{background-position:0 -4137px}span.flag-ru{background-position:0 -4159px}span.flag-rw{background-position:0 -4181px}span.flag-sa{background-position:0 -4203px}span.flag-sb{background-position:0 -4225px}span.flag-sc{background-position:0 -4247px}span.flag-sd{background-position:0 -4291px}span.flag-se{background-position:0 -4313px}span.flag-sg{background-position:0 -4335px}span.flag-sh{background-position:0 -4357px}span.flag-si{background-position:0 -4379px}span.flag-sj{background-position:0 -4401px}span.flag-sk{background-position:0 -4423px}span.flag-sl{background-position:0 -4445px}span.flag-sm{background-position:0 -4467px}span.flag-sn{background-position:0 -4489px}span.flag-so{background-position:0 -4511px}span.flag-sr{background-position:0 -4533px}span.flag-st{background-position:0 -4555px}span.flag-sv{background-position:0 -4577px}span.flag-sy{background-position:0 -4599px}span.flag-sz{background-position:0 -4621px}span.flag-tc{background-position:0 -4643px}span.flag-td{background-position:0 -4665px}span.flag-tf{background-position:0 -4687px}span.flag-tg{background-position:0 -4709px}span.flag-th{background-position:0 -4731px}span.flag-tj{background-position:0 -4753px}span.flag-tk{background-position:0 -4775px}span.flag-tl{background-position:0 -4797px}span.flag-tm{background-position:0 -4819px}span.flag-tn{background-position:0 -4841px}span.flag-to{background-position:0 -4863px}span.flag-tr{background-position:0 -4885px}span.flag-tt{background-position:0 -4907px}span.flag-tv{background-position:0 -4929px}span.flag-tw{background-position:0 -4951px}span.flag-tz{background-position:0 -4973px}span.flag-ua{background-position:0 -4995px}span.flag-ug{background-position:0 -5017px}span.flag-um{background-position:0 -5039px}span.flag-us{background-position:0 -5061px}span.flag-uy{background-position:0 -5083px}span.flag-uz{background-position:0 -5105px}span.flag-va{background-position:0 -5127px}span.flag-vc{background-position:0 -5149px}span.flag-ve{background-position:0 -5171px}span.flag-vg{background-position:0 -5193px}span.flag-vi{background-position:0 -5215px}span.flag-vn{background-position:0 -5237px}span.flag-vu{background-position:0 -5259px}span.flag-wf{background-position:0 -5303px}span.flag-ws{background-position:0 -5325px}span.flag-ye{background-position:0 -5347px}span.flag-yt{background-position:0 -5369px}span.flag-za{background-position:0 -5391px}span.flag-zm{background-position:0 -5413px}span.flag-zw{background-position:0 -5435px}@media(-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#logo{background-image:url("../images/logo@2x.png");background-size:200px 65px}}.input-group-field{display:table-cell;vertical-align:middle;border-radius:4px;min-width:1%;white-space:nowrap}.input-group-field .form-control{border-radius:inherit!important}.input-group-field:not(:first-child):not(:last-child){border-radius:0}.input-group-field:not(:first-child):not(:last-child) .form-control{border-left-width:0;border-right-width:0}.input-group-field:last-child{border-top-left-radius:0;border-bottom-left-radius:0}
\ No newline at end of file
+body{overflow-y:scroll}.left{float:left}.right{float:right}.clear:after{content:"";display:table;clear:both}.marginTop15{margin-top:15px}.paddingX5{padding-left:5px!important;padding-right:5px!important}.width65{width:65px}.form-group input[type='checkbox']{margin-top:10px}.control-label{font-weight:normal}.control-label:after{content:":"}.formbutton-default{padding:6px 30px;border-bottom-style:solid;border-bottom-width:2px;font-size:12px;font-weight:bold;transition:all ease 500ms}.formbutton-success,.formbutton-danger{padding:6px 30px;border-style:solid;border-width:1px;border-bottom-width:solid;font-size:12px;font-weight:bold;transition:all ease 500ms}.formbutton-narrow{padding:6px 8px;margin-left:2px;margin-right:2px}.formbutton-narrower{padding:4px 6px}#main-wrapper{margin:0 auto;width:95%;max-width:1260px}#logo{float:left;width:200px;height:65px;margin-top:10px}#logo a{display:block;width:100%;height:100%}#headerbar{float:right}#searchform{float:right;margin-top:16px}#searchform>div{position:relative;display:table}#searchform>div>div{display:table-cell;padding-right:8px;vertical-align:top}#searchform .icon{padding:0 2px;font-size:16px}#logout-button{float:right;margin-top:16px;margin-left:25px;border-bottom-style:solid;border-bottom-width:2px;transition:all ease 500ms}#main-navigation{margin-top:24px}#main-navigation a{padding:0 12px;height:70px;border-bottom-style:solid;botder-bottom-width:2px;transition:all ease 500ms}#main-navigation .icon{font-size:32px}#main-navigation .title{margin-top:2px;font-weight:bold}.btn-group-justified .btn{border-right-width:0}.btn-group-justified .btn:last-of-type{border-right-width:1px}#content{width:78%}#passBar,#passText{display:inline-block;vertical-align:middle}#passBar{height:11px;padding:0}#passBar>div{height:100%;padding:0}#sidebar{margin-top:27px;width:18%;border-style:solid;border-width:1px;border-radius:4px}#sidebar header{margin:1px;padding:0 10px;height:40px;line-height:40px;font-weight:bold;border-top-left-radius:2px;border-top-right-radius:2px}#sidebar ul{margin:0;padding:0;list-style:none}#sidebar li{padding:10px;border-top-style:solid;border-top-width:1px;font-size:12px}#sidebar a{text-decoration:none;transition:color ease 500ms}.page-header{margin:20px 0;padding:0}.alert-notification a{font-weight:bold;text-decoration:none;transition:color ease 500ms}.alert-label,.alert-content{display:inline-block;vertical-align:top}.alert-label{width:60px}.modules{margin:0;padding:0;list-style:none}.modules li{float:left;margin-right:15px;margin-bottom:15px;padding:8px;width:200px;border-radius:4px;border-style:solid;border-width:1px}.modules .icon{float:left;margin-right:15px;font-size:50px}.modules .left{margin-top:5px}.modules .title{margin-top:6px;margin-left:20px;font-size:16px;font-weight:bold}.modules .button{margin-top:10px;width:100%;border-bottom-style:solid;border-bottom-width:2px;font-size:12px;font-weight:bold;transition:all ease 500ms}.modules a{text-decoration:none}.table-wrapper{margin-bottom:20px;border-radius:4px;border-style:solid;border-width:1px}.table{table-layout:fixed;margin-bottom:1px}.table caption{padding:5px 10px;text-align:left;font-weight:bold;font-size:18px;border-bottom-style:solid;border-bottom-width:1px}.table tbody tr{border-top-style:solid;border-top-width:1px;transition:background ease 500ms}.table tbody tr:last-child{border-radius:4px}.table tbody tr td{text-overflow:ellipsis;overflow-x:hidden}.tfooter{margin-top:-1px;height:40px;border-top-style:solid;border-top-width:1px}.pagination{margin:10px 0}.progress{display:inline-block;margin-bottom:0;width:150px;height:10px}p.fieldset-legend{display:none}.content-tab-wrapper{border-style:solid;border-width:1px;border-radius:4px}.content-tab-wrapper .nav-tabs>li>a{border-radius:0;border:none!important;border-right-style:solid!important;border-right-width:1px!important;outline:0;font-weight:bold;transition:background ease 500ms}.content-tab-wrapper .nav-tabs li:not(:first-child) a{margin-left:-2px}.tab-content{padding:25px 10px}.input-group-btn .icon-calendar{font-size:18px}thead.dark th{height:40px;line-height:40px;font-weight:normal}thead.dark th.small-col{width:14%}thead.dark th.tiny-col{width:8%;overflow:hidden;text-overflow:ellipsis}thead.dark th[data-column]{cursor:pointer}thead.dark th[data-column][data-ordered]{font-weight:bold;position:relative}thead.dark th[data-column][data-ordered]:before{content:"";display:block;position:absolute;right:5px;top:16px;width:0;height:0;vertical-align:middle;border-bottom:5px solid #fff;border-top:5px solid transparent;border-right:5px solid transparent;border-left:6px solid transparent;line-height:inherit}thead.dark th[data-column][data-ordered="desc"]:before{top:21px;border-bottom:5px solid transparent;border-top:5px solid #fff}thead.dark td input,thead.dark td select{width:100%}#footer{margin:20px 0;padding-top:20px;border-top-style:solid;border-top-width:1px;text-align:center;font-size:10px}.menu-btn{display:none;cursor:pointer}.df-container,.gs-container{position:relative}.gs-container:after{content:"";display:table;clear:both}ul.df-resultbox,ul.gs-resultbox{display:block;position:absolute;left:0;top:100%;margin:0;padding:0 0 10px;min-width:250px;max-width:500px;z-index:999999;background:#fff;list-style:none;box-shadow:2px 2px 5px #c5c5c5;border-radius:5px}ul.df-resultbox li,ul.gs-resultbox li{float:none;display:block;cursor:pointer;padding:0 10px}ul.gs-resultbox li{padding:3px 10px;line-height:1.1;font-size:.9em}ul.df-resultbox li:nth-child(even),ul.gs-resultbox li:nth-child(even){background:#f2f5f7}ul.df-resultbox li.df-cheader,ul.gs-resultbox li.gs-cheader{background:#fff;padding-top:10px;margin-bottom:10px}ul.df-resultbox li p,ul.gs-resultbox li p{margin-bottom:0;color:inherit}ul.df-resultbox li.df-cheader p.df-cheader-title,ul.gs-resultbox li.gs-cheader p.gs-cheader-title{font-weight:bold;margin-bottom:0}ul.df-resultbox li.df-cheader p.df-cheader-limit,ul.gs-resultbox li.gs-cheader p.gs-cheader-limit{font-weight:normal}ul.df-resultbox li.df-cdata img,ul.gs-resultbox li.gs-cdata img{margin-right:12px}ul.df-resultbox li.df-cdata p span.df-cdata-title,ul.gs-resultbox li.gs-cdata p span.gs-cdata-title{font-weight:bold}ul.gs-resultbox li.gs-cdata p span.gs-cdata-title{display:block}ul.df-resultbox li:first-child,ul.gs-resultbox li:first-child{border-top-left-radius:5px;border-top-right-radius:5px}ul.df-resultbox li:last-child,ul.gs-resultbox li:last-child{border-bottom-left-radius:5px;border-bottom-right-radius:5px}span.flags{background-image:url("../images/flags_sprite.png");background-repeat:no-repeat;min-height:20px;padding-left:27px;vertical-align:middle}span.flag-el{background-position:0 -1475px}span.flag-ad{background-position:0 -1px}span.flag-ae{background-position:0 -23px}span.flag-af{background-position:0 -45px}span.flag-ag{background-position:0 -67px}span.flag-ai{background-position:0 -89px}span.flag-al{background-position:0 -111px}span.flag-am{background-position:0 -133px}span.flag-an{background-position:0 -155px}span.flag-ao{background-position:0 -177px}span.flag-aq{background-position:0 -199px}span.flag-ar{background-position:0 -221px}span.flag-as{background-position:0 -243px}span.flag-at{background-position:0 -265px}span.flag-au{background-position:0 -287px}span.flag-aw{background-position:0 -309px}span.flag-ax{background-position:0 -331px}span.flag-az{background-position:0 -353px}span.flag-ba{background-position:0 -375px}span.flag-bb{background-position:0 -397px}span.flag-bd{background-position:0 -419px}span.flag-be{background-position:0 -441px}span.flag-bf{background-position:0 -463px}span.flag-bg{background-position:0 -485px}span.flag-bh{background-position:0 -507px}span.flag-bi{background-position:0 -529px}span.flag-bj{background-position:0 -551px}span.flag-bm{background-position:0 -573px}span.flag-bn{background-position:0 -595px}span.flag-bo{background-position:0 -617px}span.flag-br{background-position:0 -639px}span.flag-bs{background-position:0 -661px}span.flag-bt{background-position:0 -683px}span.flag-bv{background-position:0 -705px}span.flag-bw{background-position:0 -727px}span.flag-by{background-position:0 -749px}span.flag-bz{background-position:0 -771px}span.flag-ca{background-position:0 -793px}span.flag-cc{background-position:0 -837px}span.flag-cd{background-position:0 -859px}span.flag-cf{background-position:0 -881px}span.flag-cg{background-position:0 -903px}span.flag-ch{background-position:0 -925px}span.flag-ci{background-position:0 -947px}span.flag-ck{background-position:0 -969px}span.flag-cl{background-position:0 -991px}span.flag-cm{background-position:0 -1013px}span.flag-cn{background-position:0 -1035px}span.flag-co{background-position:0 -1057px}span.flag-cr{background-position:0 -1079px}span.flag-cs{background-position:0 -1101px}span.flag-cu{background-position:0 -1123px}span.flag-cv{background-position:0 -1145px}span.flag-cx{background-position:0 -1167px}span.flag-cy{background-position:0 -1189px}span.flag-cz{background-position:0 -1211px}span.flag-de{background-position:0 -1233px}span.flag-dj{background-position:0 -1255px}span.flag-dk{background-position:0 -1277px}span.flag-dm{background-position:0 -1299px}span.flag-do{background-position:0 -1321px}span.flag-dz{background-position:0 -1343px}span.flag-ec{background-position:0 -1365px}span.flag-ee{background-position:0 -1387px}span.flag-eg{background-position:0 -1409px}span.flag-eh{background-position:0 -1431px}span.flag-er{background-position:0 -1475px}span.flag-es{background-position:0 -1497px}span.flag-et{background-position:0 -1519px}span.flag-fi{background-position:0 -1585px}span.flag-fj{background-position:0 -1607px}span.flag-fk{background-position:0 -1629px}span.flag-fm{background-position:0 -1651px}span.flag-fo{background-position:0 -1673px}span.flag-fr{background-position:0 -1695px}span.flag-ga{background-position:0 -1717px}span.flag-gb,span.flag-en{background-position:0 -1739px}span.flag-gd{background-position:0 -1761px}span.flag-ge{background-position:0 -1783px}span.flag-gf{background-position:0 -1805px}span.flag-gh{background-position:0 -1827px}span.flag-gi{background-position:0 -1849px}span.flag-gl{background-position:0 -1871px}span.flag-gm{background-position:0 -1893px}span.flag-gn{background-position:0 -1915px}span.flag-gp{background-position:0 -1937px}span.flag-gq{background-position:0 -1959px}span.flag-gr{background-position:0 -1981px}span.flag-gs{background-position:0 -2003px}span.flag-gt{background-position:0 -2025px}span.flag-gu{background-position:0 -2047px}span.flag-gw{background-position:0 -2069px}span.flag-gy{background-position:0 -2091px}span.flag-hk{background-position:0 -2113px}span.flag-hm{background-position:0 -2135px}span.flag-hn{background-position:0 -2157px}span.flag-hr{background-position:0 -2179px}span.flag-ht{background-position:0 -2201px}span.flag-hu{background-position:0 -2223px}span.flag-id{background-position:0 -2245px}span.flag-ie{background-position:0 -2267px}span.flag-il{background-position:0 -2289px}span.flag-in{background-position:0 -2311px}span.flag-io{background-position:0 -2333px}span.flag-iq{background-position:0 -2355px}span.flag-ir{background-position:0 -2377px}span.flag-is{background-position:0 -2399px}span.flag-it{background-position:0 -2421px}span.flag-jm{background-position:0 -2443px}span.flag-jo{background-position:0 -2465px}span.flag-jp{background-position:0 -2487px}span.flag-ke{background-position:0 -2509px}span.flag-kg{background-position:0 -2531px}span.flag-kh{background-position:0 -2553px}span.flag-ki{background-position:0 -2575px}span.flag-km{background-position:0 -2597px}span.flag-kn{background-position:0 -2619px}span.flag-kp{background-position:0 -2641px}span.flag-kr{background-position:0 -2663px}span.flag-kw{background-position:0 -2685px}span.flag-ky{background-position:0 -2707px}span.flag-kz{background-position:0 -2729px}span.flag-la{background-position:0 -2751px}span.flag-lb{background-position:0 -2773px}span.flag-lc{background-position:0 -2795px}span.flag-li{background-position:0 -2817px}span.flag-lk{background-position:0 -2839px}span.flag-lr{background-position:0 -2861px}span.flag-ls{background-position:0 -2883px}span.flag-lt{background-position:0 -2905px}span.flag-lu{background-position:0 -2927px}span.flag-lv{background-position:0 -2949px}span.flag-ly{background-position:0 -2971px}span.flag-ma{background-position:0 -2993px}span.flag-mc{background-position:0 -3015px}span.flag-md{background-position:0 -3037px}span.flag-me{background-position:0 -3059px}span.flag-mg{background-position:0 -3081px}span.flag-mh{background-position:0 -3103px}span.flag-mk{background-position:0 -3125px}span.flag-ml{background-position:0 -3147px}span.flag-mm{background-position:0 -3169px}span.flag-mn{background-position:0 -3191px}span.flag-mo{background-position:0 -3213px}span.flag-mp{background-position:0 -3235px}span.flag-mq{background-position:0 -3257px}span.flag-mr{background-position:0 -3279px}span.flag-ms{background-position:0 -3301px}span.flag-mt{background-position:0 -3323px}span.flag-mu{background-position:0 -3345px}span.flag-mv{background-position:0 -3367px}span.flag-mw{background-position:0 -3389px}span.flag-mx{background-position:0 -3411px}span.flag-my{background-position:0 -3433px}span.flag-mz{background-position:0 -3455px}span.flag-na{background-position:0 -3477px}span.flag-nc{background-position:0 -3499px}span.flag-ne{background-position:0 -3521px}span.flag-nf{background-position:0 -3543px}span.flag-ng{background-position:0 -3565px}span.flag-ni{background-position:0 -3587px}span.flag-nl{background-position:0 -3609px}span.flag-no{background-position:0 -3631px}span.flag-np{background-position:0 -3653px}span.flag-nr{background-position:0 -3675px}span.flag-nu{background-position:0 -3697px}span.flag-nz{background-position:0 -3719px}span.flag-om{background-position:0 -3741px}span.flag-pa{background-position:0 -3763px}span.flag-pe{background-position:0 -3785px}span.flag-pf{background-position:0 -3807px}span.flag-pg{background-position:0 -3829px}span.flag-ph{background-position:0 -3851px}span.flag-pk{background-position:0 -3873px}span.flag-pl{background-position:0 -3895px}span.flag-pm{background-position:0 -3917px}span.flag-pn{background-position:0 -3939px}span.flag-pr{background-position:0 -3961px}span.flag-ps{background-position:0 -3983px}span.flag-pt{background-position:0 -4005px}span.flag-pw{background-position:0 -4027px}span.flag-py{background-position:0 -4049px}span.flag-qa{background-position:0 -4071px}span.flag-re{background-position:0 -4093px}span.flag-ro{background-position:0 -4115px}span.flag-rs{background-position:0 -4137px}span.flag-ru{background-position:0 -4159px}span.flag-rw{background-position:0 -4181px}span.flag-sa{background-position:0 -4203px}span.flag-sb{background-position:0 -4225px}span.flag-sc{background-position:0 -4247px}span.flag-sd{background-position:0 -4291px}span.flag-se{background-position:0 -4313px}span.flag-sg{background-position:0 -4335px}span.flag-sh{background-position:0 -4357px}span.flag-si{background-position:0 -4379px}span.flag-sj{background-position:0 -4401px}span.flag-sk{background-position:0 -4423px}span.flag-sl{background-position:0 -4445px}span.flag-sm{background-position:0 -4467px}span.flag-sn{background-position:0 -4489px}span.flag-so{background-position:0 -4511px}span.flag-sr{background-position:0 -4533px}span.flag-st{background-position:0 -4555px}span.flag-sv{background-position:0 -4577px}span.flag-sy{background-position:0 -4599px}span.flag-sz{background-position:0 -4621px}span.flag-tc{background-position:0 -4643px}span.flag-td{background-position:0 -4665px}span.flag-tf{background-position:0 -4687px}span.flag-tg{background-position:0 -4709px}span.flag-th{background-position:0 -4731px}span.flag-tj{background-position:0 -4753px}span.flag-tk{background-position:0 -4775px}span.flag-tl{background-position:0 -4797px}span.flag-tm{background-position:0 -4819px}span.flag-tn{background-position:0 -4841px}span.flag-to{background-position:0 -4863px}span.flag-tr{background-position:0 -4885px}span.flag-tt{background-position:0 -4907px}span.flag-tv{background-position:0 -4929px}span.flag-tw{background-position:0 -4951px}span.flag-tz{background-position:0 -4973px}span.flag-ua{background-position:0 -4995px}span.flag-ug{background-position:0 -5017px}span.flag-um{background-position:0 -5039px}span.flag-us{background-position:0 -5061px}span.flag-uy{background-position:0 -5083px}span.flag-uz{background-position:0 -5105px}span.flag-va{background-position:0 -5127px}span.flag-vc{background-position:0 -5149px}span.flag-ve{background-position:0 -5171px}span.flag-vg{background-position:0 -5193px}span.flag-vi{background-position:0 -5215px}span.flag-vn{background-position:0 -5237px}span.flag-vu{background-position:0 -5259px}span.flag-wf{background-position:0 -5303px}span.flag-ws{background-position:0 -5325px}span.flag-ye{background-position:0 -5347px}span.flag-yt{background-position:0 -5369px}span.flag-za{background-position:0 -5391px}span.flag-zm{background-position:0 -5413px}span.flag-zw{background-position:0 -5435px}@media(-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#logo{background-image:url("../images/logo@2x.png");background-size:200px 65px}}.input-group-field{display:table-cell;vertical-align:middle;border-radius:4px;min-width:1%;white-space:nowrap}.input-group-field .form-control{border-radius:inherit!important}.input-group-field:not(:first-child):not(:last-child){border-radius:0}.input-group-field:not(:first-child):not(:last-child) .form-control{border-left-width:0;border-right-width:0}.input-group-field:last-child{border-top-left-radius:0;border-bottom-left-radius:0}
\ No newline at end of file
diff --git a/interface/web/themes/default/assets/stylesheets/select2x2.png b/interface/web/themes/default/assets/stylesheets/select2x2.png
new file mode 100644
index 0000000..4bdd5c9
--- /dev/null
+++ b/interface/web/themes/default/assets/stylesheets/select2x2.png
Binary files differ
diff --git a/remoting_client/examples/rest_example.php b/remoting_client/examples/rest_example.php
new file mode 100644
index 0000000..24a009c
--- /dev/null
+++ b/remoting_client/examples/rest_example.php
@@ -0,0 +1,57 @@
+<?php
+
+
+$remote_user = 'test';
+$remote_pass = 'apipassword';
+$remote_url = 'https://yourserver.com:8080/remote/json.php';
+
+function restCall($method, $data) {
+	global $remote_url;
+	
+	if(!is_array($data)) return false;
+	$json = json_encode($data);
+	
+	$curl = curl_init();
+	curl_setopt($curl, CURLOPT_POST, 1);
+
+	if($data) curl_setopt($curl, CURLOPT_POSTFIELDS, $json);
+
+	// needed for self-signed cert
+	curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
+	curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
+	// end of needed for self-signed cert
+	
+	curl_setopt($curl, CURLOPT_URL, $remote_url . '?' . $method);
+	curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
+	
+	$result = curl_exec($curl);
+	curl_close($curl);
+
+	return $result;
+}
+
+$result = restCall('login', array('username' => $remote_user, 'password' => $remote_pass, 'client_login' => false));
+if($result) {
+	$data = json_decode($result, true);
+	if(!$data) die("ERROR!\n");
+	
+	$session_id = $data['response'];
+	
+	$result = restCall('client_get', array('session_id' => $session_id, 'client_id' => array('username' => 'abcde')));
+	if($result) var_dump(json_decode($result, true));
+	else print "Could not get client_get result\n";
+	
+	// or by id
+	$result = restCall('client_get', array('session_id' => $session_id, 'client_id' => 2));
+	if($result) var_dump(json_decode($result, true));
+	else print "Could not get client_get result\n";
+	
+	// or all
+	$result = restCall('client_get', array('session_id' => $session_id, 'client_id' => array()));
+	if($result) var_dump(json_decode($result, true));
+	else print "Could not get client_get result\n";
+
+	$result = restCall('logout', array('session_id' => $session_id));
+	if($result) var_dump(json_decode($result, true));
+	else print "Could not get logout result\n";
+}
diff --git a/server/conf/vhost.conf.master b/server/conf/vhost.conf.master
index 230f089..66b4608 100644
--- a/server/conf/vhost.conf.master
+++ b/server/conf/vhost.conf.master
@@ -57,9 +57,9 @@
 		SSLProtocol All -SSLv2 -SSLv3
 		SSLCipherSuite          ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA
 		SSLHonorCipherOrder     on
-		<IfModule mod_headers.c>
-		Header always add Strict-Transport-Security "max-age=15768000"
-		</IfModule>
+		# <IfModule mod_headers.c>
+		# Header always add Strict-Transport-Security "max-age=15768000"
+		# </IfModule>
 		SSLCertificateFile <tmpl_var name='document_root'>/ssl/<tmpl_var name='ssl_domain'>.crt
 		SSLCertificateKeyFile <tmpl_var name='document_root'>/ssl/<tmpl_var name='ssl_domain'>.key
 <tmpl_if name='has_bundle_cert'>
diff --git a/server/lib/classes/cron.d/900-letsencrypt.inc.php b/server/lib/classes/cron.d/900-letsencrypt.inc.php
index f00adc2..7e1655e 100644
--- a/server/lib/classes/cron.d/900-letsencrypt.inc.php
+++ b/server/lib/classes/cron.d/900-letsencrypt.inc.php
@@ -36,8 +36,10 @@
 	public function onRunJob() {
 		global $app, $conf;
 
-		if(file_exists("/root/.local/share/letsencrypt/bin/letsencrypt")) {
-			exec('/root/.local/share/letsencrypt/bin/letsencrypt renew');
+		$letsencrypt = array_shift( split("\n", `which letsencrypt /root/.local/share/letsencrypt/bin/letsencrypt`) );
+		if(is_executable($letsencrypt)) {
+			exec($letsencrypt . ' -n renew');
+			$app->services->restartServiceDelayed('httpd', 'reload');
 		}
 		
 		parent::onRunJob();
diff --git a/server/lib/classes/monitor_tools.inc.php b/server/lib/classes/monitor_tools.inc.php
index 8d71d9b..f2b7467 100644
--- a/server/lib/classes/monitor_tools.inc.php
+++ b/server/lib/classes/monitor_tools.inc.php
@@ -35,23 +35,29 @@
 	//   This is the same code as in install/lib/install.lib.php
 	//   So if you change it here, you also have to change it in there!
 	//   Please do not forget to remove the swriteln(); - lines here at this file
-	public function get_distname() {
+	function get_distname() {
 
-		$distname = '';
-		$distver = '';
-		$distid = '';
-		$distbaseid = '';
+	$distname = '';
+	$distver = '';
+	$distid = '';
+	$distbaseid = '';
 
-		//** Debian or Ubuntu
-		if (file_exists('/etc/debian_version')) {
-			if (strstr(trim(file_get_contents('/etc/issue')), 'Ubuntu')) {
-				if (strstr(trim(file_get_contents('/etc/issue')), 'LTS')) {
+	//** Debian or Ubuntu
+	if(file_exists('/etc/debian_version')) {
+		
+		// Check if this is Ubuntu and not Debian
+		if (strstr(trim(file_get_contents('/etc/issue')), 'Ubuntu') || (is_file('/etc/os-release') && stristr(file_get_contents('/etc/os-release'), 'Ubuntu'))) {
+			
+			$issue = file_get_contents('/etc/issue');
+			
+			// Use content of /etc/issue file
+			if(strstr($issue,'Ubuntu')) {
+				if (strstr(trim($issue), 'LTS')) {
 					$lts=" LTS";
 				} else {
 					$lts="";
 				}
 
-				$issue=file_get_contents('/etc/issue');
 				$distname = 'Ubuntu';
 				$distid = 'debian40';
 				$distbaseid = 'debian';
@@ -61,206 +67,262 @@
 				$mainver = explode('.', $ver);
 				$mainver = array_filter($mainver);
 				$mainver = current($mainver).'.'.next($mainver);
-				switch ($mainver){
-				case "16.04":
-					$relname = "(Xenial Xerus)";
-					$distid = 'ubuntu1604';
-					break;
-				case "15.10":
-					$relname = "(Wily Werewolf)";
-					break;
-				case "15.04":
-					$relname = "(Vivid Vervet)";
-					break;
-				case "14.10":
-					$relname = "(Utopic Unicorn)";
-					break;
-				case "14.04":
-					$relname = "(Trusty Tahr)";
-					break;
-				case "13.10":
-					$relname = "(Saucy Salamander)";
-					break;
-				case "13.04":
-					$relname = "(Raring Ringtail)";
-					break;
-				case "12.10":
-					$relname = "(Quantal Quetzal)";
-					break;
-				case "12.04":
-					$relname = "(Precise Pangolin)";
-					break;
-				case "11.10":
-					$relname = "(Oneiric Ocelot)";
-					break;
-				case "11.14":
-					$relname = "(Natty Narwhal)";
-					break;
-				case "10.10":
-					$relname = "(Maverick Meerkat)";
-					break;
-				case "10.04":
-					$relname = "(Lucid Lynx)";
-					break;
-				case "9.10":
-					$relname = "(Karmic Koala)";
-					break;
-				case "9.04":
-					$relname = "(Jaunty Jackpole)";
-					break;
-				case "8.10":
-					$relname = "(Intrepid Ibex)";
-					break;
-				case "8.04":
-					$relname = "(Hardy Heron)";
-					break;
-				case "7.10":
-					$relname = "(Gutsy Gibbon)";
-					break;
-				case "7.04":
-					$relname = "(Feisty Fawn)";
-					break;
-				case "6.10":
-					$relname = "(Edgy Eft)";
-					break;
-				case "6.06":
-					$relname = "(Dapper Drake)";
-					break;
-				case "5.10":
-					$relname = "(Breezy Badger)";
-					break;
-				case "5.04":
-					$relname = "(Hoary Hedgehog)";
-					break;
-				case "4.10":
-					$relname = "(Warty Warthog)";
-					break;
-				default:
-					$relname = "UNKNOWN";
+			// Use content of /etc/os-release file
+			} else {
+				$os_release = file_get_contents('/etc/os-release');
+				if (strstr(trim($os_release), 'LTS')) {
+					$lts = " LTS";
+				} else {
+					$lts = "";
 				}
-				$distver = $ver.$lts." ".$relname;
-			} elseif(trim(file_get_contents('/etc/debian_version')) == '4.0') {
-				$distname = 'Debian';
-				$distver = '4.0';
+				
+				$distname = 'Ubuntu';
 				$distid = 'debian40';
 				$distbaseid = 'debian';
-			} elseif (strstr(trim(file_get_contents('/etc/debian_version')), '5.0')) {
-				$distname = 'Debian';
-				$distver = 'Lenny';
-				$distid = 'debian40';
-				$distbaseid = 'debian';
-			} elseif (strstr(trim(file_get_contents('/etc/debian_version')), '6.0') || trim(file_get_contents('/etc/debian_version')) == 'squeeze/sid') {
-				$distname = 'Debian';
-				$distver = 'Squeeze/Sid';
-				$distid = 'debian60';
-				$distbaseid = 'debian';
-			} elseif (strstr(trim(file_get_contents('/etc/debian_version')), '7.0') || substr(trim(file_get_contents('/etc/debian_version')),0,2) == '7.' || trim(file_get_contents('/etc/debian_version')) == 'wheezy/sid') {
-				$distname = 'Debian';
-				$distver = 'Wheezy/Sid';
-				$distid = 'debian60';
-				$distbaseid = 'debian';
-			} elseif(strstr(trim(file_get_contents('/etc/debian_version')), '8') || substr(trim(file_get_contents('/etc/debian_version')),0,1) == '8') {
-				$distname = 'Debian';
-				$distver = 'Jessie';
-				$distid = 'debian60';
-				$distbaseid = 'debian';
-			} else {
-				$distname = 'Debian';
-				$distver = 'Unknown';
-				$distid = 'debian40';
-				$distbaseid = 'debian';
+
+				preg_match("/.*VERSION=\"(.*)\".*/ui", $os_release, $ver);
+				$ver = str_replace("LTS", "", $ver[1]);
+				$ver = explode(" ", $ver, 2);
+				$ver = reset($ver);
+				$mainver = $ver;
 			}
-		}
-
-		//** OpenSuSE
-		elseif (file_exists('/etc/SuSE-release')) {
-			if (stristr(file_get_contents('/etc/SuSE-release'), '11.0')) {
-				$distname = 'openSUSE';
-				$distver = '11.0';
-				$distid = 'opensuse110';
-				$distbaseid = 'opensuse';
-			} elseif (stristr(file_get_contents('/etc/SuSE-release'), '11.1')) {
-				$distname = 'openSUSE';
-				$distver = '11.1';
-				$distid = 'opensuse110';
-				$distbaseid = 'opensuse';
-			} elseif (stristr(file_get_contents('/etc/SuSE-release'), '11.2')) {
-				$distname = 'openSUSE';
-				$distver = '11.1';
-				$distid = 'opensuse110';
-				$distbaseid = 'opensuse';
-			} else {
-				$distname = 'openSUSE';
-				$distver = 'Unknown';
-				$distid = 'opensuse110';
-				$distbaseid = 'opensuse';
+			switch ($mainver){
+			case "16.04":
+				$relname = "(Xenial Xerus)";
+				$distconfid = 'ubuntu1604';
+				break;
+			case "15.10":
+				$relname = "(Wily Werewolf)";
+				break;
+			case "15.04":
+				$relname = "(Vivid Vervet)";
+				break;
+			case "14.10":
+				$relname = "(Utopic Unicorn)";
+				break;
+			case "14.04":
+				$relname = "(Trusty Tahr)";
+				break;
+			case "13.10":
+				$relname = "(Saucy Salamander)";
+				break;
+			case "13.04":
+				$relname = "(Raring Ringtail)";
+				break;
+			case "12.10":
+				$relname = "(Quantal Quetzal)";
+				break;
+			case "12.04":
+				$relname = "(Precise Pangolin)";
+				break;
+			case "11.10":
+				$relname = "(Oneiric Ocelot)";
+				break;
+			case "11.14":
+				$relname = "(Natty Narwhal)";
+				break;
+			case "10.10":
+				$relname = "(Maverick Meerkat)";
+				break;
+			case "10.04":
+				$relname = "(Lucid Lynx)";
+				break;
+			case "9.10":
+				$relname = "(Karmic Koala)";
+				break;
+			case "9.04":
+				$relname = "(Jaunty Jackpole)";
+				break;
+			case "8.10":
+				$relname = "(Intrepid Ibex)";
+				break;
+			case "8.04":
+				$relname = "(Hardy Heron)";
+				break;
+			case "7.10":
+				$relname = "(Gutsy Gibbon)";
+				break;
+			case "7.04":
+				$relname = "(Feisty Fawn)";
+				break;
+			case "6.10":
+				$relname = "(Edgy Eft)";
+				break;
+			case "6.06":
+				$relname = "(Dapper Drake)";
+				break;
+			case "5.10":
+				$relname = "(Breezy Badger)";
+				break;
+			case "5.04":
+				$relname = "(Hoary Hedgehog)";
+				break;
+			case "4.10":
+				$relname = "(Warty Warthog)";
+				break;
+			default:
+				$relname = "UNKNOWN";
 			}
-		}
-
-
-		//** Redhat
-		elseif (file_exists('/etc/redhat-release')) {
-
-			$content = file_get_contents('/etc/redhat-release');
-
-			if (stristr($content, 'Fedora release 9 (Sulphur)')) {
-				$distname = 'Fedora';
-				$distver = '9';
-				$distid = 'fedora9';
-				$distbaseid = 'fedora';
-			} elseif (stristr($content, 'Fedora release 10 (Cambridge)')) {
-				$distname = 'Fedora';
-				$distver = '10';
-				$distid = 'fedora9';
-				$distbaseid = 'fedora';
-			} elseif (stristr($content, 'Fedora release 10')) {
-				$distname = 'Fedora';
-				$distver = '11';
-				$distid = 'fedora9';
-				$distbaseid = 'fedora';
-			} elseif (stristr($content, 'CentOS release 5.2 (Final)')) {
-				$distname = 'CentOS';
-				$distver = '5.2';
-				$distid = 'centos52';
-				$distbaseid = 'fedora';
-			} elseif (stristr($content, 'CentOS release 5.3 (Final)')) {
-				$distname = 'CentOS';
-				$distver = '5.3';
-				$distid = 'centos53';
-				$distbaseid = 'fedora';
-			} elseif(stristr($content, 'CentOS Linux release 6')) {
-				$distname = 'CentOS';
-				$distver = 'Unknown';
-				$distid = 'centos53';
-				$distbaseid = 'fedora';
-			} elseif(stristr($content, 'CentOS Linux release 7')) {
-				$distname = 'CentOS';
-				$distver = 'Unknown';
-				$distid = 'centos53';
-				$distbaseid = 'fedora';
-			} else {
-				$distname = 'Redhat';
-				$distver = 'Unknown';
-				$distid = 'fedora9';
-				$distbaseid = 'fedora';
-			}
-		}
-
-		//** Gentoo
-		elseif (file_exists('/etc/gentoo-release')) {
-
-			$content = file_get_contents('/etc/gentoo-release');
-
-			preg_match_all('/([0-9]{1,2})/', $content, $version);
-			$distname = 'Gentoo';
-			$distver = $version[0][0] . $version[0][1];
-			$distid = 'gentoo';
-			$distbaseid = 'gentoo';
+			$distver = $ver.$lts." ".$relname;
+			swriteln("Operating System: ".$distname.' '.$distver."\n");
+		} elseif(trim(file_get_contents('/etc/debian_version')) == '4.0') {
+			$distname = 'Debian';
+			$distver = '4.0';
+			$distid = 'debian40';
+			$distbaseid = 'debian';
+			swriteln("Operating System: Debian 4.0 or compatible\n");
+		} elseif(strstr(trim(file_get_contents('/etc/debian_version')), '5.0')) {
+			$distname = 'Debian';
+			$distver = 'Lenny';
+			$distid = 'debian40';
+			$distbaseid = 'debian';
+			swriteln("Operating System: Debian Lenny or compatible\n");
+		} elseif(strstr(trim(file_get_contents('/etc/debian_version')), '6.0') || trim(file_get_contents('/etc/debian_version')) == 'squeeze/sid') {
+			$distname = 'Debian';
+			$distver = 'Squeeze/Sid';
+			$distid = 'debian60';
+			$distbaseid = 'debian';
+			swriteln("Operating System: Debian 6.0 (Squeeze/Sid) or compatible\n");
+		} elseif(strstr(trim(file_get_contents('/etc/debian_version')), '7.0') || substr(trim(file_get_contents('/etc/debian_version')),0,2) == '7.' || trim(file_get_contents('/etc/debian_version')) == 'wheezy/sid') {
+			$distname = 'Debian';
+			$distver = 'Wheezy/Sid';
+			$distid = 'debian60';
+			$distbaseid = 'debian';
+			swriteln("Operating System: Debian 7.0 (Wheezy/Sid) or compatible\n");
+		} elseif(strstr(trim(file_get_contents('/etc/debian_version')), '8') || substr(trim(file_get_contents('/etc/debian_version')),0,1) == '8') {
+			$distname = 'Debian';
+			$distver = 'Jessie';
+			$distid = 'debian60';
+			$distbaseid = 'debian';
+			swriteln("Operating System: Debian 8.0 (Jessie) or compatible\n");
 		} else {
-			die('Unrecognized GNU/Linux distribution');
+			$distname = 'Debian';
+			$distver = 'Unknown';
+			$distid = 'debian40';
+			$distbaseid = 'debian';
+			swriteln("Operating System: Debian or compatible, unknown version.\n");
 		}
+	}
 
-		return array('name' => $distname, 'version' => $distver, 'id' => $distid, 'baseid' => $distbaseid);
+	//** OpenSuSE
+	elseif(file_exists('/etc/SuSE-release')) {
+		if(stristr(file_get_contents('/etc/SuSE-release'), '11.0')) {
+			$distname = 'openSUSE';
+			$distver = '11.0';
+			$distid = 'opensuse110';
+			$distbaseid = 'opensuse';
+			swriteln("Operating System: openSUSE 11.0 or compatible\n");
+		} elseif(stristr(file_get_contents('/etc/SuSE-release'), '11.1')) {
+			$distname = 'openSUSE';
+			$distver = '11.1';
+			$distid = 'opensuse110';
+			$distbaseid = 'opensuse';
+			swriteln("Operating System: openSUSE 11.1 or compatible\n");
+		} elseif(stristr(file_get_contents('/etc/SuSE-release'), '11.2')) {
+			$distname = 'openSUSE';
+			$distver = '11.2';
+			$distid = 'opensuse112';
+			$distbaseid = 'opensuse';
+			swriteln("Operating System: openSUSE 11.2 or compatible\n");
+		}  else {
+			$distname = 'openSUSE';
+			$distver = 'Unknown';
+			$distid = 'opensuse112';
+			$distbaseid = 'opensuse';
+			swriteln("Operating System: openSUSE or compatible, unknown version.\n");
+		}
+	}
+
+
+	//** Redhat
+	elseif(file_exists('/etc/redhat-release')) {
+
+		$content = file_get_contents('/etc/redhat-release');
+
+		if(stristr($content, 'Fedora release 9 (Sulphur)')) {
+			$distname = 'Fedora';
+			$distver = '9';
+			$distid = 'fedora9';
+			$distbaseid = 'fedora';
+			swriteln("Operating System: Fedora 9 or compatible\n");
+		} elseif(stristr($content, 'Fedora release 10 (Cambridge)')) {
+			$distname = 'Fedora';
+			$distver = '10';
+			$distid = 'fedora9';
+			$distbaseid = 'fedora';
+			swriteln("Operating System: Fedora 10 or compatible\n");
+		} elseif(stristr($content, 'Fedora release 10')) {
+			$distname = 'Fedora';
+			$distver = '11';
+			$distid = 'fedora9';
+			$distbaseid = 'fedora';
+			swriteln("Operating System: Fedora 11 or compatible\n");
+		} elseif(stristr($content, 'CentOS release 5.2 (Final)')) {
+			$distname = 'CentOS';
+			$distver = '5.2';
+			$distid = 'centos52';
+			$distbaseid = 'fedora';
+			swriteln("Operating System: CentOS 5.2 or compatible\n");
+		} elseif(stristr($content, 'CentOS release 5.3 (Final)')) {
+			$distname = 'CentOS';
+			$distver = '5.3';
+			$distid = 'centos53';
+			$distbaseid = 'fedora';
+			swriteln("Operating System: CentOS 5.3 or compatible\n");
+		} elseif(stristr($content, 'CentOS release 5')) {
+			$distname = 'CentOS';
+			$distver = 'Unknown';
+			$distid = 'centos53';
+			$distbaseid = 'fedora';
+			swriteln("Operating System: CentOS 5 or compatible\n");
+		} elseif(stristr($content, 'CentOS Linux release 6')) {
+			$distname = 'CentOS';
+			$distver = 'Unknown';
+			$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 = 'centos70';
+			$distconfid = 'centos72';
+			$distbaseid = 'fedora';
+			swriteln("Operating System: CentOS 7.2\n");
+		} elseif(stristr($content, 'CentOS Linux release 7')) {
+			$distname = 'CentOS';
+			$distver = 'Unknown';
+			$distid = 'centos70';
+			$distbaseid = 'fedora';
+			swriteln("Operating System: CentOS 7 or compatible\n");
+		} else {
+			$distname = 'Redhat';
+			$distver = 'Unknown';
+			$distid = 'fedora9';
+			$distbaseid = 'fedora';
+			swriteln("Operating System: Redhat or compatible, unknown version.\n");
+		}
+	}
+
+	//** Gentoo
+	elseif(file_exists('/etc/gentoo-release')) {
+
+		$content = file_get_contents('/etc/gentoo-release');
+
+		preg_match_all('/([0-9]{1,2})/', $content, $version);
+		$distname = 'Gentoo';
+		$distver = $version[0][0].$version[0][1];
+		$distid = 'gentoo';
+		$distbaseid = 'gentoo';
+		swriteln("Operating System: Gentoo $distver or compatible\n");
+
+	} else {
+		die('Unrecognized GNU/Linux distribution');
+	}
+	
+	// Set $distconfid to distid, if no different id for the config is defined
+	if(!isset($distconfid)) $distconfid = $distid;
+
+	return array('name' => $distname, 'version' => $distver, 'id' => $distid, 'confid' => $distconfid, 'baseid' => $distbaseid);
 	}
 
 	// this function remains in the tools class, because it is used by cron AND rescue
diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php
index 34623c6..8c1da78 100644
--- a/server/plugins-available/apache2_plugin.inc.php
+++ b/server/plugins-available/apache2_plugin.inc.php
@@ -1234,8 +1234,9 @@
 				$app->log("Create Let's Encrypt SSL Cert for: $domain", LOGLEVEL_DEBUG);
 				
 				$success = false;
-				if(file_exists("/root/.local/share/letsencrypt/bin/letsencrypt")) {
-					$success = $this->_exec("/root/.local/share/letsencrypt/bin/letsencrypt auth --text --agree-tos --authenticator webroot --server https://acme-v01.api.letsencrypt.org/directory --rsa-key-size 4096 --email postmaster@$domain --domains $lddomain --webroot-path /usr/local/ispconfig/interface/acme");
+				$letsencrypt = array_shift( split("\n", `which letsencrypt /root/.local/share/letsencrypt/bin/letsencrypt`) );
+				if(is_executable($letsencrypt)) {
+					$success = $this->_exec($letsencrypt . " auth --text --agree-tos --authenticator webroot --server https://acme-v01.api.letsencrypt.org/directory --rsa-key-size 4096 --email postmaster@$domain --domains $lddomain --webroot-path /usr/local/ispconfig/interface/acme");
 				}
 				if(!$success) {
 					// error issuing cert
diff --git a/server/plugins-available/nginx_plugin.inc.php b/server/plugins-available/nginx_plugin.inc.php
index 1c5247d..9393a9b 100644
--- a/server/plugins-available/nginx_plugin.inc.php
+++ b/server/plugins-available/nginx_plugin.inc.php
@@ -1312,8 +1312,9 @@
 				$app->log("Create Let's Encrypt SSL Cert for: $domain", LOGLEVEL_DEBUG);
 				
 				$success = false;
-				if(file_exists("/root/.local/share/letsencrypt/bin/letsencrypt")) {
-					$success = $this->_exec("/root/.local/share/letsencrypt/bin/letsencrypt auth --text --agree-tos --authenticator webroot --server https://acme-v01.api.letsencrypt.org/directory --rsa-key-size 4096 --email postmaster@$domain --domains $lddomain --webroot-path /usr/local/ispconfig/interface/acme");
+				$letsencrypt = array_shift( split("\n", `which letsencrypt /root/.local/share/letsencrypt/bin/letsencrypt`) );
+				if(is_executable($letsencrypt)) {
+					$success = $this->_exec($letsencrypt . " auth --text --agree-tos --authenticator webroot --server https://acme-v01.api.letsencrypt.org/directory --rsa-key-size 4096 --email postmaster@$domain --domains $lddomain --webroot-path /usr/local/ispconfig/interface/acme");
 				}
 				if(!$success) {
 					// error issuing cert

--
Gitblit v1.9.1