Commit b45475a8 authored by jnsc's avatar jnsc
Browse files

Merge remote-tracking branch 'upstream/stable-3.1' into stable-3.1

parents 07e75759 f90e18f6
.DS_Store
......@@ -49,4 +49,14 @@ $autoupdate['reconfigure_services'] = 'yes'; // yes (default), no
$autoupdate['ispconfig_port'] = '8080'; // default: 8080
$autoupdate['create_new_ispconfig_ssl_cert'] = 'no'; // no (default), yes
$autoupdate['reconfigure_crontab'] = 'yes'; // yes (default), no
/* These are for service-detection (defaulting to old behaviour where alle changes were automatically accepted) */
$autoupdate['svc_detect_change_mail_server'] = 'yes'; // yes (default), no
$autoupdate['svc_detect_change_web_server'] = 'yes'; // yes (default), no
$autoupdate['svc_detect_change_dns_server'] = 'yes'; // yes (default), no
$autoupdate['svc_detect_change_xmpp_server'] = 'yes'; // yes (default), no
$autoupdate['svc_detect_change_firewall_server'] = 'yes'; // yes (default), no
$autoupdate['svc_detect_change_vserver_server'] = 'yes'; // yes (default), no
$autoupdate['svc_detect_change_db_server'] = 'yes'; // yes (default), no
?>
\ No newline at end of file
......@@ -47,4 +47,13 @@ reconfigure_permissions_in_master_database=no
reconfigure_services=yes
ispconfig_port=8080
create_new_ispconfig_ssl_cert=no
reconfigure_crontab=yes
\ No newline at end of file
reconfigure_crontab=yes
; These are for service-detection (defaulting to old behaviour where alle changes were automatically accepted)
svc_detect_change_mail_server=yes
svc_detect_change_web_server=yes
svc_detect_change_dns_server=yes
svc_detect_change_xmpp_server=yes
svc_detect_change_firewall_server=yes
svc_detect_change_vserver_server=yes
svc_detect_change_db_server=yes
......@@ -17,15 +17,15 @@ try{
// check for existing user
$dbmail = $db->real_escape_string($arg_email);
$result = $db->query("SELECT jid, password FROM xmpp_user WHERE jid LIKE ? AND active='y' AND server_id=?", $dbmail, $isp_server_id);
result_false($result->num_rows != 1);
$user = $result->fetch_object();
// check for domain autologin api key
$domain_key = 'f47kmm5Yh5hJzSws2KTS';
checkAuth($argv[1], $argv[2], $arg_password, $user->password, $domain_key);
$query = $db->prepare("SELECT jid, password FROM xmpp_user WHERE jid LIKE ? AND active='y' AND server_id=?");
$query->bind_param('si', $arg_email, $isp_server_id);
$query->execute();
$query->bind_result($jid, $password);
$query->fetch();
$query->close();
result_false(is_null($jid));
checkAuth($arg_password, $password);
}catch(Exception $ex){
echo 0;
exit();
......@@ -40,19 +40,9 @@ function result_true(){
echo 1;
exit();
}
function checkAuth($user, $domain, $pw_arg, $pw_db, $domain_key){
function checkAuth($pw_arg, $pw_db){
if(crypt($pw_arg, $pw_db) == $pw_db)
result_true();
if($domain_key){
$datetime = new DateTime();
$datetime->setTimezone(new DateTimeZone("UTC"));
for($t = $datetime->getTimestamp(); $t >= $datetime->getTimestamp()-30; $t--){
$pw_api = md5($domain.'@'.$domain_key.'@'.$user.'@'.$t);
if($pw_api == $pw_arg)
result_true();
}
}
result_false();
}
?>
\ No newline at end of file
......@@ -15,8 +15,14 @@ try{
// check for existing user
$dbmail = $db->real_escape_string($arg_email);
$result = $db->query("SELECT jid, password FROM xmpp_user WHERE jid LIKE ? AND active='y' AND server_id=?", $dbmail, $isp_server_id);
result_false($result->num_rows != 1);
$query = $db->prepare("SELECT count(*) AS usercount FROM xmpp_user WHERE jid LIKE ? AND active='y' AND server_id=?");
$query->bind_param('si', $arg_email, $isp_server_id);
$query->execute();
$query->bind_result($usercount);
$query->fetch();
$query->close();
result_false($usercount != 1);
result_true();
}catch(Exception $ex){
......@@ -34,4 +40,4 @@ function result_true(){
exit();
}
?>
\ No newline at end of file
?>
<?php
/*
Copyright (c) 2014, Till Brehm, ISPConfig UG
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of ISPConfig nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
require_once realpath(dirname(__FILE__)) . '/centos_base.lib.php';
class installer extends installer_centos {
protected $clamav_socket = '/var/run/clamd.amavisd/clamd.sock';
// everything else is inherited from installer_centos class
}
?>
......@@ -33,7 +33,7 @@ class installer_centos extends installer_dist {
protected $clamav_socket = '/tmp/clamd.socket';
public function configure_amavis() {
global $conf;
global $conf, $dist;
// amavisd user config file
$configfile = 'fedora_amavisd_conf';
......@@ -50,6 +50,12 @@ class installer_centos extends installer_dist {
$content = str_replace('/var/spool/amavisd/clamd.sock', $this->clamav_socket, $content);
wf($conf["amavis"]["config_dir"].'/amavisd.conf', $content);
chmod($conf['amavis']['config_dir'].'/amavisd.conf', 0640);
// for CentOS 7.2 only
if($dist['confid'] == 'centos72') {
chmod($conf['amavis']['config_dir'].'/amavisd.conf', 0750);
chgrp($conf['amavis']['config_dir'].'/amavisd.conf', 'amavis');
}
// Adding the amavisd commands to the postfix configuration
......
......@@ -89,6 +89,9 @@ class installer_dist extends installer_base {
//* mysql-virtual_relayrecipientmaps.cf
$this->process_postfix_config('mysql-virtual_relayrecipientmaps.cf');
//* mysql-virtual_outgoing_bcc.cf
$this->process_postfix_config('mysql-virtual_outgoing_bcc.cf');
//* mysql-virtual_policy_greylist.cf
$this->process_postfix_config('mysql-virtual_policy_greylist.cf');
......@@ -179,6 +182,7 @@ class installer_dist extends installer_base {
//if(!is_file('/var/lib/mailman/data/aliases')) touch('/var/lib/mailman/data/aliases');
if(is_file('/var/lib/mailman/data/aliases')) unlink('/var/lib/mailman/data/aliases');
if(!is_link('/var/lib/mailman/data/aliases')) symlink('/etc/mailman/aliases', '/var/lib/mailman/data/aliases');
if(!is_file('/etc/mailman/aliases')) touch('/etc/mailman/aliases');
exec('postalias /var/lib/mailman/data/aliases');
if(!is_file('/etc/mailman/virtual-mailman')) touch('/etc/mailman/virtual-mailman');
exec('postmap /etc/mailman/virtual-mailman');
......@@ -476,7 +480,7 @@ class installer_dist extends installer_base {
}
public function configure_amavis() {
global $conf;
global $conf, $dist;
// amavisd user config file
$configfile = 'fedora_amavisd_conf';
......@@ -491,6 +495,12 @@ class installer_dist extends installer_base {
$content = str_replace('{hostname}', $conf['hostname'], $content);
wf($conf["amavis"]["config_dir"].'/amavisd.conf', $content);
chmod($conf['amavis']['config_dir'].'/amavisd.conf', 0640);
// for CentOS 7.2 only
if($dist['confid'] == 'centos72') {
chmod($conf['amavis']['config_dir'].'/amavisd.conf', 0750);
chgrp($conf['amavis']['config_dir'].'/amavisd.conf', 'amavis');
}
// Adding the amavisd commands to the postfix configuration
......
......@@ -95,9 +95,9 @@ $log_level = 0; # (defaults to 0)
$inet_socket_port = [10024,10026];
# *:* = send to IP/HOST:incoming Port + 1
$forward_method = 'smtp:*:*';
$notify_method = 'smtp:*:*';
# :* = send to incoming Port + 1
$forward_method = 'smtp:127.0.0.1:*';
$notify_method = 'smtp:127.0.0.1:*';
$interface_policy{'10026'} = 'ORIGINATING';
$policy_bank{'ORIGINATING'} = {
......
This diff is collapsed.
......@@ -92,6 +92,10 @@ function get_distname() {
$mainver = $ver;
}
switch ($mainver){
case "16.10":
$relname = "(Yakkety Yak)";
$distconfid = 'ubuntu1604';
break;
case "16.04":
$relname = "(Xenial Xerus)";
$distconfid = 'ubuntu1604';
......@@ -296,7 +300,7 @@ function get_distname() {
} elseif(stristr($content, 'CentOS Linux release 7.2')) {
$distname = 'CentOS';
$distver = 'Unknown';
$distid = 'centos70';
$distid = 'centos72';
$distconfid = 'centos72';
$distbaseid = 'fedora';
swriteln("Operating System: CentOS 7.2\n");
......
......@@ -171,16 +171,21 @@ class installer_base {
if(is_installed('named') || is_installed('bind') || is_installed('bind9')) $conf['bind']['installed'] = true;
if(is_installed('squid')) $conf['squid']['installed'] = true;
if(is_installed('nginx')) $conf['nginx']['installed'] = true;
if(is_installed('iptables') && is_installed('ufw')) $conf['ufw']['installed'] = true;
if(is_installed('iptables') && is_installed('bastille-netfilter')) $conf['firewall']['installed'] = true;
if(is_installed('iptables') && is_installed('ufw')) {
$conf['ufw']['installed'] = true;
} elseif(is_installed('iptables')) {
$conf['firewall']['installed'] = true;
}
if(is_installed('fail2ban-server')) $conf['fail2ban']['installed'] = true;
if(is_installed('vzctl')) $conf['openvz']['installed'] = true;
if(is_installed('metronome') && is_installed('metronomectl')) $conf['xmpp']['installed'] = true;
if(is_installed('spamassassin')) $conf['spamassassin']['installed'] = true;
if(is_installed('vlogger')) $conf['vlogger']['installed'] = true;
if(is_installed('cron')) $conf['cron']['installed'] = true;
// if(is_installed('vlogger')) $conf['vlogger']['installed'] = true;
// ISPConfig ships with vlogger, so it is always installed.
$conf['vlogger']['installed'] = true;
if(is_installed('cron') || is_installed('anacron')) $conf['cron']['installed'] = true;
if ($conf['services']['web'] && (($conf['apache']['installed'] && is_file($conf['apache']["vhost_conf_enabled_dir"]."/000-ispconfig.vhost")) || ($conf['nginx']['installed'] && is_file($conf['nginx']["vhost_conf_enabled_dir"]."/000-ispconfig.vhost")))) $this->ispconfig_interface_installed = true;
if (($conf['apache']['installed'] && is_file($conf['apache']["vhost_conf_enabled_dir"]."/000-ispconfig.vhost")) || ($conf['nginx']['installed'] && is_file($conf['nginx']["vhost_conf_enabled_dir"]."/000-ispconfig.vhost"))) $this->ispconfig_interface_installed = true;
}
public function force_configure_app($service, $enable_force=true) {
......@@ -580,7 +585,7 @@ class installer_base {
$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
}
$query = "GRANT SELECT, UPDATE (`ssl_request`, `ssl_cert`, `ssl_action`, `ssl_key`) ON ?? TO ?@?";
$query = "GRANT SELECT, UPDATE (`ssl`, `ssl_letsencrypt`, `ssl_request`, `ssl_cert`, `ssl_action`, `ssl_key`) ON ?? TO ?@?";
if ($verbose){
echo $query ."\n";
}
......@@ -798,7 +803,7 @@ class installer_base {
}
//* Create aliasaes
exec('/usr/lib/mailman/bin/genaliases 2>/dev/null');
if($status == 'install') exec('/usr/lib/mailman/bin/genaliases 2>/dev/null');
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');
......@@ -807,7 +812,7 @@ class installer_base {
public function get_postfix_service($service, $type) {
global $conf;
exec("postconf -M", $out, $ret);
exec("postconf -M 2> /dev/null", $out, $ret);
if ($ret === 0) { //* with postfix >= 2.9 we can detect configured services with postconf
unset($out);
......@@ -817,9 +822,9 @@ class installer_base {
}
$postfix_service = @($out[0]=='')?false:true;
} else { //* fallback - Postfix < 2.9
rf($conf['postfix']['config_dir'].'/master.cf');
$regex = '/[^#]'.$service.'.*.'.$type.'.*/';
$postfix_service = @(!preg_match($regex, $content))?true:false;
$content = rf($conf['postfix']['config_dir'].'/master.cf');
$regex = "/^((?!#)".$service.".*".$type.".*)$/m";
$postfix_service = @(preg_match($regex, $content))?true:false;
}
return $postfix_service;
......@@ -1361,21 +1366,25 @@ class installer_base {
// Add the clamav user to the amavis group
exec('adduser clamav amavis');
// Create the director for DKIM-Keys
if(!is_dir('/var/lib/amavis/dkim')) mkdir('/var/lib/amavis/dkim', 0750, true);
// get shell-user for amavis
$amavis_user=exec('grep -o "^amavis:\|^vscan:" /etc/passwd');
if(!empty($amavis_user)) {
$amavis_user=rtrim($amavis_user, ":");
exec('chown '.$amavis_user.' /var/lib/amavis/dkim');
}
// get shell-group for amavis
$amavis_group=exec('grep -o "^amavis:\|^vscan:" /etc/group');
if(!empty($amavis_group)) {
$amavis_group=rtrim($amavis_group, ":");
exec('chgrp '.$amavis_group.' /var/lib/amavis/dkim');
}
// get shell-user for amavis
$amavis_user=exec('grep -o "^amavis:\|^vscan:" /etc/passwd');
if(!empty($amavis_user)) {
$amavis_user=rtrim($amavis_user, ":");
}
// Create the director for DKIM-Keys
if(!is_dir('/var/lib/amavis')) mkdir('/var/lib/amavis', 0750, true);
if(!empty($amavis_user)) exec('chown '.$amavis_user.' /var/lib/amavis');
if(!empty($amavis_group)) exec('chgrp '.$amavis_group.' /var/lib/amavis');
if(!is_dir('/var/lib/amavis/dkim')) mkdir('/var/lib/amavis/dkim', 0750);
if(!empty($amavis_user)) exec('chown -R '.$amavis_user.' /var/lib/amavis/dkim');
if(!empty($amavis_group)) exec('chgrp -R '.$amavis_group.' /var/lib/amavis/dkim');
}
public function configure_spamassassin() {
......@@ -1588,6 +1597,7 @@ class installer_base {
// Copy isp libs
if(!@is_dir('/usr/lib/metronome/isp-modules')) mkdir('/usr/lib/metronome/isp-modules', 0755, true);
caselog('cp -rf apps/metronome_libs/* /usr/lib/metronome/isp-modules/', __FILE__, __LINE__);
caselog('chmod 755 /usr/lib/metronome/isp-modules/mod_auth_external/authenticate_isp.sh', __FILE__, __LINE__);
// Process db config
$full_file_name = '/usr/lib/metronome/isp-modules/mod_auth_external/db_conf.inc.php';
$content = rf($full_file_name);
......@@ -1600,13 +1610,14 @@ class installer_base {
if(!stristr($options, 'dont-create-certs')){
// Create SSL Certificate for localhost
echo "writing new private key to 'localhost.key'\n-----\n";
$ssl_country = $this->free_query('Country Name (2 letter code)', 'AU');
$ssl_locality = $this->free_query('Locality Name (eg, city)', '');
// Ensure no line is left blank
echo "writing new private key to 'localhost.key'\n-----\n";
$ssl_country = $this->free_query('Country Name (2 letter code)', 'AU');
$ssl_locality = $this->free_query('Locality Name (eg, city)', 'City Name');
$ssl_organisation = $this->free_query('Organization Name (eg, company)', 'Internet Widgits Pty Ltd');
$ssl_organisation_unit = $this->free_query('Organizational Unit Name (eg, section)', '');
$ssl_organisation_unit = $this->free_query('Organizational Unit Name (eg, section)', 'Infrastructure');
$ssl_domain = $this->free_query('Common Name (e.g. server FQDN or YOUR name)', $conf['hostname']);
$ssl_email = $this->free_query('Email Address', '');
$ssl_email = $this->free_query('Email Address', 'hostmaster@'.$conf['hostname']);
$tpl = new tpl('metronome_conf_ssl.master');
$tpl->setVar('ssl_country',$ssl_country);
......@@ -1623,6 +1634,14 @@ class installer_base {
exec("(cd /etc/metronome/certs && make localhost.cert)");
exec('chmod 0400 /etc/metronome/certs/localhost.key');
exec('chown metronome /etc/metronome/certs/localhost.key');
echo "IMPORTANT:\n";
echo "Localhost Key, Csr and a self-signed Cert have been saved to /etc/metronome/certs\n";
echo "In order to work with all clients, the server must have a trusted certificate, so use the Csr\n";
echo "to get a trusted certificate from your CA or replace Key and Cert with already signed files for\n";
echo "your domain. Clients like Pidgin dont allow to use untrusted self-signed certificates.\n";
echo "\n";
}else{
echo "-----\n";
echo "Metronome XMPP SSL server certificate is not renewed. Run the following command manual as root to recreate it:\n";
......@@ -1636,45 +1655,6 @@ class installer_base {
caselog('update-rc.d metronome defaults', __FILE__, __LINE__);
exec($this->getinitcommand($conf['xmpp']['init_script'], 'restart'));
/*
writing new private key to 'smtpd.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:
State or Province Name (full name) [Some-State]:
Locality Name (eg, city) []:
Organization Name (eg, company) [Internet Widgits Pty Ltd]:
Organizational Unit Name (eg, section) []:
Common Name (e.g. server FQDN or YOUR name) []:
Email Address []:
* */
/*// Dont just copy over the virtualhost template but add some custom settings
$tpl = new tpl('apache_apps.vhost.master');
$tpl->setVar('apps_vhost_port',$conf['web']['apps_vhost_port']);
$tpl->setVar('apps_vhost_dir',$conf['web']['website_basedir'].'/apps');
$tpl->setVar('apps_vhost_basedir',$conf['web']['website_basedir']);
$tpl->setVar('apps_vhost_servername',$apps_vhost_servername);
$tpl->setVar('apache_version',getapacheversion());
// comment out the listen directive if port is 80 or 443
if($conf['web']['apps_vhost_ip'] == 80 or $conf['web']['apps_vhost_ip'] == 443) {
$tpl->setVar('vhost_port_listen','#');
} else {
$tpl->setVar('vhost_port_listen','');
}
wf($vhost_conf_dir.'/apps.vhost', $tpl->grab());
unset($tpl);*/
}
......@@ -1686,9 +1666,9 @@ Email Address []:
if(!@is_dir($conf['ispconfig_log_dir'].'/httpd')) mkdir($conf['ispconfig_log_dir'].'/httpd', 0755, true);
if(is_file('/etc/suphp/suphp.conf')) {
replaceLine('/etc/suphp/suphp.conf', 'php=php:/usr/bin', 'x-httpd-suphp="php:/usr/bin/php-cgi"', 0);
replaceLine('/etc/suphp/suphp.conf', 'php="php:/usr/bin', 'x-httpd-suphp="php:/usr/bin/php-cgi"', 0);
//replaceLine('/etc/suphp/suphp.conf','docroot=','docroot=/var/clients',0);
replaceLine('/etc/suphp/suphp.conf', 'umask=0077', 'umask=0022', 0);
replaceLine('/etc/suphp/suphp.conf', 'umask=00', 'umask=0022', 0);
}
if(is_file('/etc/apache2/sites-enabled/000-default')) {
......@@ -2076,7 +2056,7 @@ Email Address []:
$content = str_replace('{fpm_socket}', $fpm_socket, $content);
$content = str_replace('{cgi_socket}', $cgi_socket, $content);
if(file_exists('/var/run/php5-fpm.sock')){
if(file_exists('/var/run/php5-fpm.sock') || file_exists('/var/run/php/php7.0-fpm.sock')){
$use_tcp = '#';
$use_socket = '';
} else {
......@@ -2323,9 +2303,9 @@ Email Address []:
$vserver_server_enabled = ($conf['openvz']['installed'])?1:0;
$proxy_server_enabled = ($conf['services']['proxy'])?1:0;
$firewall_server_enabled = ($conf['services']['firewall'])?1:0;
$xmpp_server_enabled = ($conf['services']['xmpp'])?1:0;
$xmpp_server_enabled = ($conf['services']['xmpp'])?1:0;
$sql = "UPDATE `server` SET mail_server = '$mail_server_enabled', web_server = '$web_server_enabled', dns_server = '$dns_server_enabled', file_server = '$file_server_enabled', db_server = '$db_server_enabled', vserver_server = '$vserver_server_enabled', proxy_server = '$proxy_server_enabled', firewall_server = '$firewall_server_enabled', xmpp_server = '.$xmpp_server_enabled.' WHERE server_id = ?";
$sql = "UPDATE `server` SET mail_server = '$mail_server_enabled', web_server = '$web_server_enabled', dns_server = '$dns_server_enabled', file_server = '$file_server_enabled', db_server = '$db_server_enabled', vserver_server = '$vserver_server_enabled', proxy_server = '$proxy_server_enabled', firewall_server = '$firewall_server_enabled', xmpp_server = '$xmpp_server_enabled' WHERE server_id = ?";
$this->db->query($sql, $conf['server_id']);
if($conf['mysql']['master_slave_setup'] == 'y') {
......@@ -2554,8 +2534,8 @@ Email Address []:
if(is_file('/usr/local/bin/ispconfig_update_from_dev.sh')) unlink('/usr/local/bin/ispconfig_update_from_dev.sh');
chown($install_dir.'/server/scripts/update_from_dev.sh', 'root');
chmod($install_dir.'/server/scripts/update_from_dev.sh', 0700);
chown($install_dir.'/server/scripts/update_from_tgz.sh', 'root');
chmod($install_dir.'/server/scripts/update_from_tgz.sh', 0700);
// chown($install_dir.'/server/scripts/update_from_tgz.sh', 'root');
// chmod($install_dir.'/server/scripts/update_from_tgz.sh', 0700);
chown($install_dir.'/server/scripts/ispconfig_update.sh', 'root');
chmod($install_dir.'/server/scripts/ispconfig_update.sh', 0700);
if(!is_link('/usr/local/bin/ispconfig_update_from_dev.sh')) symlink($install_dir.'/server/scripts/ispconfig_update.sh', '/usr/local/bin/ispconfig_update_from_dev.sh');
......
......@@ -44,9 +44,9 @@ function prepareDBDump() {
//** load the pre update sql script do perform modifications on the database before the database is dumped
if(is_file(ISPC_INSTALL_ROOT."/install/sql/pre_update.sql")) {
if($conf['mysql']['admin_password'] == '') {
caselog("mysql --default-character-set=".escapeshellarg($conf['mysql']['charset'])." -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." ".escapeshellarg($conf['mysql']['database'])." < '".ISPC_INSTALL_ROOT."/install/sql/pre_update.sql' &> /dev/null", __FILE__, __LINE__, 'read in ispconfig3.sql', 'could not read in ispconfig3.sql');
caselog("mysql --default-character-set=".escapeshellarg($conf['mysql']['charset'])." -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." ".escapeshellarg($conf['mysql']['database'])." < '".ISPC_INSTALL_ROOT."/install/sql/pre_update.sql' &> /dev/null", __FILE__, __LINE__, 'read in pre_update.sql', 'could not read in pre_update.sql');
} else {
caselog("mysql --default-character-set=".escapeshellarg($conf['mysql']['charset'])." -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." -p".escapeshellarg($conf['mysql']['admin_password'])." ".escapeshellarg($conf['mysql']['database'])." < '".ISPC_INSTALL_ROOT."/install/sql/pre_update.sql' &> /dev/null", __FILE__, __LINE__, 'read in ispconfig3.sql', 'could not read in ispconfig3.sql');
caselog("mysql --default-character-set=".escapeshellarg($conf['mysql']['charset'])." -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." -p".escapeshellarg($conf['mysql']['admin_password'])." ".escapeshellarg($conf['mysql']['database'])." < '".ISPC_INSTALL_ROOT."/install/sql/pre_update.sql' &> /dev/null", __FILE__, __LINE__, 'read in pre_update.sql', 'could not read in pre_update.sql');
}
}
......@@ -205,7 +205,11 @@ function updateDbAndIni() {
$cmd = "mysql --default-character-set=".escapeshellarg($conf['mysql']['charset'])." --force -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." ".escapeshellarg($conf['mysql']['database'])." < ".$sql_patch_filename;
}
if(in_array($next_db_version,explode(',',$silent_update_versions))) $cmd .= ' > /dev/null 2> /dev/null';
if(in_array($next_db_version,explode(',',$silent_update_versions))) {
$cmd .= ' > /dev/null 2> /dev/null';
} else {
$cmd .= ' >> /var/log/ispconfig_install.log 2>> /var/log/ispconfig_install.log';
}
system($cmd);
swriteln($inst->lng('Loading SQL patch file').': '.$sql_patch_filename);
......@@ -390,6 +394,9 @@ function updateDbAndIni() {
unset($old_ini_array);
unset($tpl_ini_array);
unset($new_ini);
// Truncate sys_session
$inst->db->query('TRUNCATE ??', $conf['mysql']['database'].'sys_session');
}
......@@ -414,4 +421,29 @@ function setDefaultServers(){
}
/** Checks if a detected service differs from db setup and asks the user what to do
* @param $servicename string the name of the Database-Field in "servers" for this service
* @param $detected_value boolean The result of service detection
*/
function check_service_config_state($servicename, $detected_value) {
global $current_svc_config, $inst, $conf;
if ($current_svc_config[$servicename] == 1) $current_state = 1;
else $current_state = 0;
if ($detected_value) $detected_value = 1;
else $detected_value = 0;
if ($detected_value != $current_state) {
$answer = $inst->simple_query('Service \''.$servicename.'\' '.($detected_value ? 'has been' : 'has not been').' detected ('.($current_state ? 'strongly recommended, currently enabled' : 'currently disabled').') do you want to '.($detected_value ? 'enable and configure' : 'disable').' it? ', array('yes', 'no'), ($current_state ? 'yes' : 'no'), 'svc_detect_change_'.$servicename);
if ($answer == 'yes') return $detected_value;
else {
if ($servicename == 'web_server') echo "\033[0;33mWARNING: If ISPConfig-Interface (Webfrontend) is installed on this Server we will configure the Web Server anyways but will not enable it in ISPConfig.\033[0m\n\n";
return $current_state;
}
} else return $current_state;
}
?>
ALTER TABLE `client` CHANGE `web_servers` `web_servers` TEXT NULL DEFAULT NULL;
ALTER TABLE `client` CHANGE `mail_servers` `mail_servers` TEXT NULL DEFAULT NULL;
ALTER TABLE `client` CHANGE `xmpp_servers` `xmpp_servers` TEXT NULL DEFAULT NULL;
ALTER TABLE `client` CHANGE `db_servers` `db_servers` TEXT NULL DEFAULT NULL;
ALTER TABLE `client` CHANGE `dns_servers` `dns_servers` TEXT NULL DEFAULT NULL;
UPDATE client SET web_servers = default_webserver WHERE (web_servers = '' OR web_servers IS NULL);
UPDATE client SET mail_servers = default_mailserver WHERE (mail_servers = '' OR mail_servers IS NULL);
UPDATE client SET xmpp_servers = default_xmppserver WHERE (xmpp_servers = '' OR xmpp_servers IS NULL);
UPDATE client SET db_servers = default_dbserver WHERE (db_servers = '' OR db_servers IS NULL);
UPDATE client SET dns_servers = default_dnsserver WHERE (dns_servers = '' OR dns_servers IS NULL);
ALTER TABLE `client_template` ADD `default_slave_dnsserver` INT NOT NULL DEFAULT '0' AFTER `limit_dns_slave_zone`;
ALTER TABLE `client_template` ADD `mail_servers` TEXT NULL DEFAULT NULL AFTER `template_type`;
ALTER TABLE `client_template` ADD `web_servers` TEXT NULL DEFAULT NULL AFTER `limit_xmpp_httparchive`;
ALTER TABLE `client_template` ADD `dns_servers` TEXT NULL DEFAULT NULL AFTER `limit_aps`;
ALTER TABLE `client_template` ADD `db_servers` TEXT NULL DEFAULT NULL AFTER `limit_dns_record`;
\ No newline at end of file
UPDATE `sys_user` SET `app_theme` = 'default' WHERE 1;
ALTER TABLE `ftp_user` ADD `user_type` SET('user','system') NOT NULL DEFAULT 'user' AFTER `expires`, ADD `user_config` TEXT NULL AFTER `user_type`;
\ No newline at end of file
ALTER TABLE `web_domain` CHANGE `folder_directive_snippets` `folder_directive_snippets` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL;
\ No newline at end of file
......@@ -170,7 +170,7 @@ CREATE TABLE `client` (
`bank_account_swift` varchar(255) DEFAULT NULL,
`paypal_email` varchar(255) DEFAULT NULL,
`default_mailserver` int(11) unsigned NOT NULL DEFAULT '1',
`mail_servers` blob,
`mail_servers` text,
`limit_maildomain` int(11) NOT NULL DEFAULT '-1',
`limit_mailbox` int(11) NOT NULL DEFAULT '-1',
`limit_mailalias` int(11) NOT NULL DEFAULT '-1',
......@@ -185,7 +185,7 @@ CREATE TABLE `client` (
`limit_spamfilter_user` int(11) NOT NULL DEFAULT '0',
`limit_spamfilter_policy` int(11) NOT NULL DEFAULT '0',
`default_xmppserver` int(11) unsigned NOT NULL DEFAULT '1',
`xmpp_servers` blob,
`xmpp_servers` text,
`limit_xmpp_domain` int(11) NOT NULL DEFAULT '-1',
`limit_xmpp_user` int(11) NOT NULL DEFAULT '-1',
`limit_xmpp_muc` ENUM( 'n', 'y' ) NOT NULL default 'n',
......@@ -197,7 +197,7 @@ CREATE TABLE `client` (
`limit_xmpp_pastebin` ENUM( 'n', 'y' ) NOT NULL default 'n',
`limit_xmpp_httparchive` ENUM( 'n', 'y' ) NOT NULL default 'n',
`default_webserver` int(11) unsigned NOT NULL DEFAULT '1',
`web_servers` blob,
`web_servers` text,
`limit_web_ip` text,
`limit_web_domain` int(11) NOT NULL DEFAULT '-1',
`limit_web_quota` int(11) NOT NULL DEFAULT '-1',
......@@ -222,13 +222,13 @@ CREATE TABLE `client` (