Skip to content

Commit 85e4167

Browse files
author
Till Brehm
committed
Merge branch 'develop' of git.ispconfig.org:ispconfig/ispconfig3 into develop
2 parents 5f3b255 + a056850 commit 85e4167

File tree

194 files changed

+1031
-677
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

194 files changed

+1031
-677
lines changed

install/install.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,16 @@
536536
$inst->configure_fail2ban();
537537
}
538538

539+
// create acme vhost
540+
if($conf['nginx']['installed'] == true) {
541+
$inst->make_acme_vhost('nginx'); // we need this config file but we don't want nginx to be restarted at this point
542+
}
543+
if($conf['apache']['installed'] == true) {
544+
$inst->make_acme_vhost('apache'); // we need this config file but we don't want apache to be restarted at this point
545+
}
546+
539547
//** Configure ISPConfig :-)
548+
$issue_tried = false;
540549
$install_ispconfig_interface_default = ($conf['mysql']['master_slave_setup'] == 'y')?'n':'y';
541550
if($install_mode == 'standard' || strtolower($inst->simple_query('Install ISPConfig Web Interface', array('y', 'n'), $install_ispconfig_interface_default,'install_ispconfig_web_interface')) == 'y') {
542551
swriteln('Installing ISPConfig');
@@ -563,6 +572,7 @@
563572

564573
if(strtolower($inst->simple_query('Do you want a secure (SSL) connection to the ISPConfig web interface', array('y', 'n'), 'y','ispconfig_use_ssl')) == 'y') {
565574
$inst->make_ispconfig_ssl_cert();
575+
$issue_tried = true;
566576
}
567577
$inst->install_ispconfig_interface = true;
568578

@@ -572,8 +582,9 @@
572582

573583
// Create SSL certs for non-webserver(s)?
574584
if(!file_exists('/usr/local/ispconfig/interface/ssl/ispserver.crt')) {
575-
if(strtolower($inst->simple_query('Do you want to create SSL certs for your server?', array('y', 'n'), 'y')) == 'y')
585+
if(!$issue_tried && strtolower($inst->simple_query('Do you want to create SSL certs for your server?', array('y', 'n'), 'y')) == 'y') {
576586
$inst->make_ispconfig_ssl_cert();
587+
}
577588
} else {
578589
swriteln('Certificate exists. Not creating a new one.');
579590
}

install/lib/installer_base.lib.php

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1169,6 +1169,9 @@ public function configure_postfix($options = '') {
11691169
$postconf_commands = array_merge($postconf_commands, array_filter(explode("\n", $content)));
11701170
}
11711171

1172+
// Remove comment lines, these would give fatal errors when passed to postconf.
1173+
$postconf_commands = array_filter($postconf_commands, function($line) { return preg_match('/^[^#]/', $line); });
1174+
11721175
//* These postconf commands will be executed on installation only
11731176
if($this->is_update == false) {
11741177
$postconf_commands = array_merge($postconf_commands, array(
@@ -2550,7 +2553,7 @@ public function configure_apps_vhost() {
25502553
}
25512554

25522555
// comment out the listen directive if port is 80 or 443
2553-
if($conf['web']['apps_vhost_ip'] == 80 or $conf['web']['apps_vhost_ip'] == 443) {
2556+
if($conf['web']['apps_vhost_port'] == 80 or $conf['web']['apps_vhost_port'] == 443) {
25542557
$tpl->setVar('vhost_port_listen','#');
25552558
} else {
25562559
$tpl->setVar('vhost_port_listen','');
@@ -2718,9 +2721,15 @@ private function curl_request($url, $use_ipv6 = false) {
27182721
return $response;
27192722
}
27202723

2721-
private function make_acme_vhost($server_name, $server = 'apache') {
2724+
public function make_acme_vhost($server = 'apache') {
27222725
global $conf;
27232726

2727+
if($conf['hostname'] !== 'localhost' && $conf['hostname'] !== '') {
2728+
$server_name = $conf['hostname'];
2729+
} else {
2730+
$server_name = exec('hostname -f');
2731+
}
2732+
27242733
$use_template = 'apache_acme.conf.master';
27252734
$use_symlink = '999-acme.conf';
27262735
$use_name = 'acme.conf';
@@ -2756,14 +2765,6 @@ private function make_acme_vhost($server_name, $server = 'apache') {
27562765
if(!@is_link($vhost_conf_enabled_dir.'' . $use_symlink)) {
27572766
symlink($vhost_conf_dir.'/' . $use_name, $vhost_conf_enabled_dir.'/' . $use_symlink);
27582767
}
2759-
2760-
if($conf[$server]['installed'] == true && $conf[$server]['init_script'] != '') {
2761-
if($this->is_update) {
2762-
system($this->getinitcommand($conf[$server]['init_script'], 'force-reload').' &> /dev/null || ' . $this->getinitcommand($conf[$server]['init_script'], 'restart').' &> /dev/null');
2763-
} else {
2764-
system($this->getinitcommand($conf[$server]['init_script'], 'restart').' &> /dev/null');
2765-
}
2766-
}
27672768
}
27682769

27692770
public function make_ispconfig_ssl_cert() {
@@ -2834,12 +2835,18 @@ public function make_ispconfig_ssl_cert() {
28342835
}
28352836

28362837
swriteln('Using certificate path ' . $acme_cert_dir);
2838+
$ip_address_match = false;
28372839
if(!(($svr_ip4 && in_array($svr_ip4, $dns_ips)) || ($svr_ip6 && in_array($svr_ip6, $dns_ips)))) {
28382840
swriteln('Server\'s public ip(s) (' . $svr_ip4 . ($svr_ip6 ? ', ' . $svr_ip6 : '') . ') not found in A/AAAA records for ' . $hostname . ': ' . implode(', ', $dns_ips));
2841+
if(strtolower($inst->simple_query('Ignore DNS check and continue to request certificate?', array('y', 'n') , 'n','ignore_hostname_dns')) == 'y') {
2842+
$ip_address_match = true;
2843+
}
2844+
} else {
2845+
$ip_address_match = true;
28392846
}
28402847

28412848

2842-
if ((!@is_dir($acme_cert_dir) || !@file_exists($check_acme_file) || !@file_exists($ssl_crt_file) || md5_file($check_acme_file) != md5_file($ssl_crt_file)) && (($svr_ip4 && in_array($svr_ip4, $dns_ips)) || ($svr_ip6 && in_array($svr_ip6, $dns_ips)))) {
2849+
if ((!@is_dir($acme_cert_dir) || !@file_exists($check_acme_file) || !@file_exists($ssl_crt_file) || md5_file($check_acme_file) != md5_file($ssl_crt_file)) && $ip_address_match == true) {
28432850

28442851
// This script is needed earlier to check and open http port 80 or standalone might fail
28452852
// Make executable and temporary symlink latest letsencrypt pre, post and renew hook script before install
@@ -2889,15 +2896,22 @@ public function make_ispconfig_ssl_cert() {
28892896
// first of all create the acme vhosts if not existing
28902897
if($conf['nginx']['installed'] == true) {
28912898
swriteln('Using nginx for certificate validation');
2892-
$this->make_acme_vhost($hostname, 'nginx');
2899+
$server = 'nginx';
28932900
} elseif($conf['apache']['installed'] == true) {
28942901
swriteln('Using apache for certificate validation');
28952902
if($this->is_update == false && @is_link($vhost_conf_enabled_dir.'/000-ispconfig.conf')) {
28962903
$restore_conf_symlink = true;
28972904
unlink($vhost_conf_enabled_dir.'/000-ispconfig.conf');
28982905
}
2906+
$server = 'apache';
2907+
}
28992908

2900-
$this->make_acme_vhost($hostname, 'apache');
2909+
if($conf[$server]['installed'] == true && $conf[$server]['init_script'] != '') {
2910+
if($this->is_update) {
2911+
system($this->getinitcommand($conf[$server]['init_script'], 'force-reload').' &> /dev/null || ' . $this->getinitcommand($conf[$server]['init_script'], 'restart').' &> /dev/null');
2912+
} else {
2913+
system($this->getinitcommand($conf[$server]['init_script'], 'restart').' &> /dev/null');
2914+
}
29012915
}
29022916

29032917
$issued_successfully = false;
@@ -2930,6 +2944,8 @@ public function make_ispconfig_ssl_cert() {
29302944
rename($ssl_pem_file, $ssl_pem_file . '-' . $date->format('YmdHis') . '.bak');
29312945
}
29322946

2947+
$check_acme_file = $ssl_crt_file;
2948+
29332949
// Define LE certs name and path, then install them
29342950
//$acme_cert = "--cert-file $acme_cert_dir/cert.pem";
29352951
$acme_key = "--key-file " . escapeshellarg($ssl_key_file);
@@ -2994,9 +3010,11 @@ public function make_ispconfig_ssl_cert() {
29943010
symlink($vhost_conf_dir.'/ispconfig.conf', $vhost_conf_enabled_dir.'/000-ispconfig.conf');
29953011
}
29963012
}
2997-
} elseif(($svr_ip4 && in_array($svr_ip4, $dns_ips)) || ($svr_ip6 && in_array($svr_ip6, $dns_ips))) {
2998-
// the directory already exists so we have to assume that it was created previously
2999-
$issued_successfully = true;
3013+
} else {
3014+
if($ip_address_match) {
3015+
// the directory already exists so we have to assume that it was created previously
3016+
$issued_successfully = true;
3017+
}
30003018
}
30013019

30023020
// If the LE SSL certs for this hostname exists
Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
Alias /.well-known/acme-challenge /usr/local/ispconfig/interface/acme/.well-known/acme-challenge
2-
3-
<Directory /usr/local/ispconfig/interface/acme>
4-
AllowOverride None
1+
Alias /.well-known/acme-challenge /usr/local/ispconfig/interface/acme/.well-known/acme-challenge
2+
<Directory /usr/local/ispconfig/interface/acme/.well-known/acme-challenge>
53
<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
64
Require all granted
75
<tmpl_else>
8-
Order allow,deny
9-
Allow from all
6+
Order allow,deny
7+
Allow from all
108
</tmpl_if>
11-
</Directory>
9+
<IfModule mpm_itk_module>
10+
AssignUserId ispconfig ispconfig
11+
</IfModule>
12+
</Directory>
13+

install/tpl/apache_apps.vhost.master

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,3 +122,9 @@
122122
{/tmpl_if}
123123

124124
</VirtualHost>
125+
126+
<tmpl_if name='apache_version' op='>=' value='2.3.3' format='version'>
127+
<IfModule mod_ssl.c>
128+
<tmpl_var name="ssl_comment">SSLStaplingCache shmcb:/var/run/ocsp(128000)
129+
</IfModule>
130+
</tmpl_if>

install/tpl/apache_ispconfig.conf.master

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -132,19 +132,6 @@ CustomLog "| /usr/local/ispconfig/server/scripts/vlogger -s access.log -t \"%Y%m
132132

133133
Alias /awstats-icon "/usr/share/awstats/icon"
134134

135-
Alias /.well-known/acme-challenge /usr/local/ispconfig/interface/acme/.well-known/acme-challenge
136-
<Directory /usr/local/ispconfig/interface/acme/.well-known/acme-challenge>
137-
<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
138-
Require all granted
139-
<tmpl_else>
140-
Order allow,deny
141-
Allow from all
142-
</tmpl_if>
143-
<IfModule mpm_itk_module>
144-
AssignUserId ispconfig ispconfig
145-
</IfModule>
146-
</Directory>
147-
148135
NameVirtualHost *:80
149136
NameVirtualHost *:443
150137
<tmpl_loop name="ip_adresses">

install/tpl/debian6_dovecot2.conf.master

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ ssl_protocols = !SSLv2 !SSLv3 !TLSv1 !TLSv1.1
1111
ssl_min_protocol = TLSv1.2
1212
ssl_cipher_list = ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384
1313
ssl_prefer_server_ciphers = no
14-
auth_verbose = yes
1514
mail_max_userip_connections = 100
1615
mail_plugins = quota
1716
passdb {

install/tpl/debian_dovecot2.conf.master

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ ssl_key = </etc/postfix/smtpd.key
1010
ssl_min_protocol = TLSv1.2
1111
ssl_cipher_list = ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384
1212
ssl_prefer_server_ciphers = no
13-
auth_verbose = yes
1413
mail_max_userip_connections = 100
1514
mail_plugins = $mail_plugins quota
1615
passdb {

install/tpl/fedora_dovecot2.conf.master

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ ssl_key = </etc/postfix/smtpd.key
99
ssl_min_protocol = TLSv1.2
1010
ssl_cipher_list = ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384
1111
ssl_prefer_server_ciphers = no
12-
auth_verbose = yes
1312
mail_plugins = quota
1413
passdb {
1514
args = /etc/dovecot-sql.conf

install/tpl/mysql-virtual_mailboxes.cf.master

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ user = {mysql_server_ispconfig_user}
22
password = {mysql_server_ispconfig_password}
33
dbname = {mysql_server_database}
44
hosts = {mysql_server_ip}
5-
query = select CONCAT(SUBSTRING_INDEX(email,'@',-1),'/',SUBSTRING_INDEX(email,'@',1),'/') from mail_user where login = '%s' and postfix = 'y' and disabledeliver = 'n' and server_id = {server_id}
5+
query = select CONCAT(SUBSTRING_INDEX(email,'@',-1),'/',SUBSTRING_INDEX(email,'@',1),'/') from mail_user where email = '%s' and postfix = 'y' and disabledeliver = 'n' and server_id = {server_id}

install/tpl/nginx_apps.vhost.master

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
server {
2-
listen {apps_vhost_port} {ssl_on};
2+
listen {apps_vhost_ip}{apps_vhost_port} {ssl_on};
33
listen [::]:{apps_vhost_port} {ssl_on} ipv6only=on;
44

55
{ssl_comment}ssl_protocols TLSv1.2;
@@ -99,7 +99,7 @@ server {
9999
fastcgi_param REDIRECT_STATUS 200;
100100
# To access phpMyAdmin, the default user (like www-data on Debian/Ubuntu) must be used
101101
{use_tcp}fastcgi_pass 127.0.0.1:9000;
102-
{use_socket}fastcgi_pass unix:/var/run/php5-fpm.sock;
102+
{use_socket}fastcgi_pass unix:{fpm_socket};
103103
fastcgi_index index.php;
104104
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
105105
fastcgi_buffer_size 128k;
@@ -149,7 +149,7 @@ server {
149149
fastcgi_param REDIRECT_STATUS 200;
150150
# To access SquirrelMail, the default user (like www-data on Debian/Ubuntu) must be used
151151
{use_tcp}fastcgi_pass 127.0.0.1:9000;
152-
{use_socket}fastcgi_pass unix:/var/run/php5-fpm.sock;
152+
{use_socket}fastcgi_pass unix:{fpm_socket};
153153
fastcgi_index index.php;
154154
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
155155
fastcgi_buffer_size 128k;

0 commit comments

Comments
 (0)