Skip to content

Commit c8a7b51

Browse files
author
Till Brehm
committed
Merge branch 'stable-3.1' into 'stable-3.1'
Test webserver configuration on restart was not shown for nginx See merge request ispconfig/ispconfig3!938
2 parents 6e240ab + a08a291 commit c8a7b51

18 files changed

+115
-92
lines changed

install/lib/installer_base.lib.php

Lines changed: 96 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -409,80 +409,92 @@ public function add_database_server_record() {
409409

410410

411411
}
412-
412+
413+
public function get_host_ips() {
414+
$out = array();
415+
exec('hostname --all-ip-addresses', $ret, $val);
416+
if($val == 0) {
417+
if(is_array($ret) && !empty($ret)){
418+
$temp = (explode(' ', $ret[0]));
419+
foreach($temp as $ip) {
420+
$out[] = $ip;
421+
}
422+
}
423+
}
424+
425+
return $out;
426+
}
427+
413428
public function detect_ips(){
414429
global $conf;
430+
431+
$output = $this->get_host_ips();
415432

416-
exec("ip addr show | awk '/global/ { print $2 }' | cut -d '/' -f 1", $output, $retval);
417-
418-
if($retval == 0){
419-
if(is_array($output) && !empty($output)){
420-
foreach($output as $line){
421-
$line = trim($line);
422-
$ip_type = '';
423-
if (filter_var($line, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
424-
$ip_type = 'IPv4';
425-
}
426-
if (filter_var($line, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
427-
$ip_type = 'IPv6';
428-
}
429-
if($ip_type == '') continue;
430-
if($this->db->dbHost != $this->dbmaster->dbHost){
431-
$this->dbmaster->query('INSERT INTO server_ip (
432-
sys_userid, sys_groupid, sys_perm_user, sys_perm_group,
433-
sys_perm_other, server_id, client_id, ip_type, ip_address,
434-
virtualhost, virtualhost_port
435-
) VALUES (
436-
1,
437-
1,
438-
"riud",
439-
"riud",
440-
"",
441-
?,
442-
0,
443-
?,
444-
?,
445-
"y",
446-
"80,443"
447-
)', $conf['server_id'], $ip_type, $line);
448-
$server_ip_id = $this->dbmaster->insertID();
449-
$this->db->query('INSERT INTO server_ip (
450-
server_php_id, sys_userid, sys_groupid, sys_perm_user, sys_perm_group,
451-
sys_perm_other, server_id, client_id, ip_type, ip_address,
452-
virtualhost, virtualhost_port
453-
) VALUES (
454-
?,
455-
1,
456-
1,
457-
"riud",
458-
"riud",
459-
"",
460-
?,
461-
0,
462-
?,
463-
?,
464-
"y",
465-
"80,443"
466-
)', $server_ip_id, $conf['server_id'], $ip_type, $line);
467-
} else {
468-
$this->db->query('INSERT INTO server_ip (
469-
sys_userid, sys_groupid, sys_perm_user, sys_perm_group,
470-
sys_perm_other, server_id, client_id, ip_type, ip_address,
471-
virtualhost, virtualhost_port
472-
) VALUES (
473-
1,
474-
1,
475-
"riud",
476-
"riud",
477-
"",
478-
?,
479-
0,
480-
?,
481-
?,
482-
"y",
483-
"80,443"
484-
)', $conf['server_id'], $ip_type, $line);
485-
}
433+
if(is_array($output) && !empty($output)){
434+
foreach($output as $line){
435+
$ip_type = '';
436+
if (filter_var($line, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
437+
$ip_type = 'IPv4';
438+
}
439+
if (filter_var($line, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
440+
$ip_type = 'IPv6';
441+
}
442+
if($ip_type == '') continue;
443+
if($this->db->dbHost != $this->dbmaster->dbHost){
444+
$this->dbmaster->query('INSERT INTO server_ip (
445+
sys_userid, sys_groupid, sys_perm_user, sys_perm_group,
446+
sys_perm_other, server_id, client_id, ip_type, ip_address,
447+
virtualhost, virtualhost_port
448+
) VALUES (
449+
1,
450+
1,
451+
"riud",
452+
"riud",
453+
"",
454+
?,
455+
0,
456+
?,
457+
?,
458+
"y",
459+
"80,443"
460+
)', $conf['server_id'], $ip_type, $line);
461+
$server_ip_id = $this->dbmaster->insertID();
462+
$this->db->query('INSERT INTO server_ip (
463+
server_php_id, sys_userid, sys_groupid, sys_perm_user, sys_perm_group,
464+
sys_perm_other, server_id, client_id, ip_type, ip_address,
465+
virtualhost, virtualhost_port
466+
) VALUES (
467+
?,
468+
1,
469+
1,
470+
"riud",
471+
"riud",
472+
"",
473+
?,
474+
0,
475+
?,
476+
?,
477+
"y",
478+
"80,443"
479+
)', $server_ip_id, $conf['server_id'], $ip_type, $line);
480+
} else {
481+
$this->db->query('INSERT INTO server_ip (
482+
sys_userid, sys_groupid, sys_perm_user, sys_perm_group,
483+
sys_perm_other, server_id, client_id, ip_type, ip_address,
484+
virtualhost, virtualhost_port
485+
) VALUES (
486+
1,
487+
1,
488+
"riud",
489+
"riud",
490+
"",
491+
?,
492+
0,
493+
?,
494+
?,
495+
"y",
496+
"80,443"
497+
)', $conf['server_id'], $ip_type, $line);
486498
}
487499
}
488500
}
@@ -509,15 +521,23 @@ public function grant_master_database_rights($verbose = false) {
509521

510522
//* insert the ispconfig user in the remote server
511523
$from_host = $conf['hostname'];
512-
$from_ip = gethostbyname($conf['hostname']);
513-
514524
$hosts[$from_host]['user'] = $conf['mysql']['master_ispconfig_user'];
515525
$hosts[$from_host]['db'] = $conf['mysql']['master_database'];
516526
$hosts[$from_host]['pwd'] = $conf['mysql']['master_ispconfig_password'];
517527

518-
$hosts[$from_ip]['user'] = $conf['mysql']['master_ispconfig_user'];
519-
$hosts[$from_ip]['db'] = $conf['mysql']['master_database'];
520-
$hosts[$from_ip]['pwd'] = $conf['mysql']['master_ispconfig_password'];
528+
$host_ips = $this->get_host_ips();
529+
if(is_arary($host_ips) && !empty($host_ips)) {
530+
foreach($host_ips as $ip) {
531+
$hosts[$ip]['user'] = $conf['mysql']['master_ispconfig_user'];
532+
$hosts[$ip]['db'] = $conf['mysql']['master_database'];
533+
$hosts[$ip]['pwd'] = $conf['mysql']['master_ispconfig_password'];
534+
}
535+
} else {
536+
$from_ip = gethostbyname($conf['hostname']);
537+
$hosts[$from_ip]['user'] = $conf['mysql']['master_ispconfig_user'];
538+
$hosts[$from_ip]['db'] = $conf['mysql']['master_database'];
539+
$hosts[$from_ip]['pwd'] = $conf['mysql']['master_ispconfig_password'];
540+
}
521541
} else{
522542
/*
523543
* it is NOT a master-slave - Setup so we have to find out all clients and their

install/tpl/debian_dovecot2.conf.master

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ ssl_cert = </etc/postfix/smtpd.cert
99
ssl_key = </etc/postfix/smtpd.key
1010
ssl_protocols = !SSLv2 !SSLv3
1111
mail_max_userip_connections = 100
12+
mail_plugins = $mail_plugins quota
1213
passdb {
1314
args = /etc/dovecot/dovecot-sql.conf
1415
driver = sql
@@ -65,7 +66,6 @@ protocol lmtp {
6566
mail_plugins = quota sieve
6667
}
6768

68-
mail_plugins = $mail_plugins quota
6969

7070
#2.3+ service stats {
7171
#2.3+ unix_listener stats-reader {

interface/web/admin/lib/lang/ar_server_config.lng

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ $wb['backup_dir_txt'] = 'Backup directory';
8484
$wb['named_conf_local_path_txt'] = 'BIND named.conf.local path';
8585
$wb['php_ini_path_cgi_txt'] = 'CGI php.ini path';
8686
$wb['php_ini_path_apache_txt'] = 'Apache php.ini path';
87-
$wb['check_apache_config_txt'] = 'Test apache configuration on restart';
87+
$wb['check_apache_config_txt'] = 'Test webserver configuration on restart';
8888
$wb['CA_path_txt'] = 'CA Path';
8989
$wb['CA_pass_txt'] = 'CA passphrase';
9090
$wb['ufw_enable_txt'] = 'Enable';

interface/web/admin/lib/lang/bg_server_config.lng

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ $wb['backup_dir_txt'] = 'Директория за бекъп';
8484
$wb['named_conf_local_path_txt'] = 'BIND named.conf.local path';
8585
$wb['php_ini_path_cgi_txt'] = 'CGI php.ini path';
8686
$wb['php_ini_path_apache_txt'] = 'Apache php.ini path';
87-
$wb['check_apache_config_txt'] = 'Test apache configuration on restart';
87+
$wb['check_apache_config_txt'] = 'Test webserver configuration on restart';
8888
$wb['ufw_enable_txt'] = 'Enable';
8989
$wb['ufw_manage_builtins_txt'] = 'Manage Builtin Rules';
9090
$wb['ufw_ipv6_txt'] = 'Enable IPv6';

interface/web/admin/lib/lang/ca_server_config.lng

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ $wb['backup_dir_txt'] = 'Backup directory';
9696
$wb['named_conf_local_path_txt'] = 'BIND named.conf.local path';
9797
$wb['php_ini_path_cgi_txt'] = 'CGI php.ini path';
9898
$wb['php_ini_path_apache_txt'] = 'Apache php.ini path';
99-
$wb['check_apache_config_txt'] = 'Test apache configuration on restart';
99+
$wb['check_apache_config_txt'] = 'Test webserver configuration on restart';
100100
$wb['network_config_warning_txt'] = 'The network configuration option is only available for Debian and Ubuntu Servers. Do not enable this option if your network interface is not eth0.';
101101
$wb['CA_path_txt'] = 'CA Path';
102102
$wb['CA_pass_txt'] = 'CA passphrase';

interface/web/admin/lib/lang/en_server_config.lng

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ $wb["backup_tmp_txt"] = 'Backup tmp directory for zip';
9797
$wb["named_conf_local_path_txt"] = 'BIND named.conf.local path';
9898
$wb["php_ini_path_cgi_txt"] = 'CGI php.ini path';
9999
$wb["php_ini_path_apache_txt"] = 'Apache php.ini path';
100-
$wb["check_apache_config_txt"] = 'Test apache configuration on restart';
100+
$wb["check_apache_config_txt"] = 'Test webserver configuration on restart';
101101
$wb["network_config_warning_txt"] = 'The network configuration option is only available for Debian and Ubuntu Servers. Do not enable this option if your network interface is not eth0.';
102102
$wb["CA_path_txt"] = 'CA Path';
103103
$wb["CA_pass_txt"] = 'CA passphrase';

interface/web/admin/lib/lang/fi_server_config.lng

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ $wb['backup_dir_txt'] = 'Backup directory';
8484
$wb['named_conf_local_path_txt'] = 'BIND named.conf.local path';
8585
$wb['php_ini_path_cgi_txt'] = 'CGI php.ini path';
8686
$wb['php_ini_path_apache_txt'] = 'Apache php.ini path';
87-
$wb['check_apache_config_txt'] = 'Test apache configuration on restart';
87+
$wb['check_apache_config_txt'] = 'Test webserver configuration on restart';
8888
$wb['CA_path_txt'] = 'CA Path';
8989
$wb['CA_pass_txt'] = 'CA passphrase';
9090
$wb['ufw_enable_txt'] = 'Enable';

interface/web/admin/lib/lang/hu_server_config.lng

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ $wb['backup_dir_txt'] = 'Mentés könyvtára';
8484
$wb['named_conf_local_path_txt'] = 'BIND named.conf.local path';
8585
$wb['php_ini_path_cgi_txt'] = 'CGI php.ini path';
8686
$wb['php_ini_path_apache_txt'] = 'Apache php.ini path';
87-
$wb['check_apache_config_txt'] = 'Test apache configuration on restart';
87+
$wb['check_apache_config_txt'] = 'Test webserver configuration on restart';
8888
$wb['network_config_warning_txt'] = 'The network configuration option is only available for Debian and Ubuntu Servers. Do not enable this option if your network interface is not eth0.';
8989
$wb['CA_path_txt'] = 'CA Path';
9090
$wb['CA_pass_txt'] = 'CA passphrase';

interface/web/admin/lib/lang/ja_server_config.lng

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ $wb['backup_dir_txt'] = 'Backup directory';
8484
$wb['named_conf_local_path_txt'] = 'BIND named.conf.local path';
8585
$wb['php_ini_path_cgi_txt'] = 'CGI php.ini path';
8686
$wb['php_ini_path_apache_txt'] = 'Apache php.ini path';
87-
$wb['check_apache_config_txt'] = 'Test apache configuration on restart';
87+
$wb['check_apache_config_txt'] = 'Test webserver configuration on restart';
8888
$wb['ufw_enable_txt'] = 'Enable';
8989
$wb['ufw_manage_builtins_txt'] = 'Manage Builtin Rules';
9090
$wb['ufw_ipv6_txt'] = 'Enable IPv6';

interface/web/admin/lib/lang/pt_server_config.lng

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ $wb['backup_dir_txt'] = 'Backup directory';
8484
$wb['named_conf_local_path_txt'] = 'BIND named.conf.local path';
8585
$wb['php_ini_path_cgi_txt'] = 'CGI php.ini path';
8686
$wb['php_ini_path_apache_txt'] = 'Apache php.ini path';
87-
$wb['check_apache_config_txt'] = 'Test apache configuration on restart';
87+
$wb['check_apache_config_txt'] = 'Test webserver configuration on restart';
8888
$wb['CA_path_txt'] = 'CA Path';
8989
$wb['CA_pass_txt'] = 'CA passphrase';
9090
$wb['ufw_enable_txt'] = 'Enable';

0 commit comments

Comments
 (0)