Skip to content

Commit 7456a4f

Browse files
author
Marius Burkard
committed
- changed the way letsencrypt is handled due to various problems
1 parent ee24ad5 commit 7456a4f

File tree

5 files changed

+19
-30
lines changed

5 files changed

+19
-30
lines changed

install/tpl/apache_ispconfig.conf.master

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ CustomLog "| /usr/local/ispconfig/server/scripts/vlogger -s access.log -t \"%Y%m
118118
Alias /awstats-icon "/usr/share/awstats/icon"
119119
</tmpl_if>
120120

121+
Alias /.well-known/acme-challenge /usr/local/ispconfig/interface/acme-challenge
122+
121123
NameVirtualHost *:80
122124
NameVirtualHost *:443
123125
<tmpl_loop name="ip_adresses">

interface/acme-challenge/empty.dir

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This empty directory is needed by ISPConfig.

server/conf/nginx_vhost.conf.master

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,13 @@ server {
263263
}
264264
</tmpl_if>
265265

266+
location /\.well-known/acme-challenge {
267+
root /usr/local/ispconfig/interface/acme-challenge;
268+
index index.html index.htm;
269+
try_files $uri =404;
270+
}
271+
272+
266273
<tmpl_loop name="basic_auth_locations">
267274
location <tmpl_var name='htpasswd_location'> { ##merge##
268275
auth_basic "Members Only";
@@ -293,6 +300,13 @@ server {
293300
</tmpl_if>
294301

295302
server_name <tmpl_var name='rewrite_domain'>;
303+
304+
location /\.well-known/acme-challenge {
305+
root /usr/local/ispconfig/interface/acme-challenge;
306+
index index.html index.htm;
307+
try_files $uri =404;
308+
}
309+
296310
<tmpl_if name='alias_seo_redirects2'>
297311
<tmpl_loop name="alias_seo_redirects2">
298312
if ($http_host <tmpl_var name='alias_seo_redirect_operator'> "<tmpl_var name='alias_seo_redirect_origin_domain'>") {

server/plugins-available/apache2_plugin.inc.php

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1183,22 +1183,8 @@ function update($event_name, $data) {
11831183
if(!file_exists($crt_tmp_file) && !file_exists($key_tmp_file)) {
11841184
$app->log("Create Let's Encrypt SSL Cert for: $domain", LOGLEVEL_DEBUG);
11851185

1186-
if(is_dir($webroot . "/.well-known/acme-challenge/")) {
1187-
$app->log("Remove old challenge directory", LOGLEVEL_DEBUG);
1188-
$this->_exec("rm -rf " . $webroot . "/.well-known/acme-challenge/");
1189-
}
1190-
1191-
$app->log("Create challenge directory", LOGLEVEL_DEBUG);
1192-
$app->system->mkdirpath($webroot . "/.well-known/");
1193-
$app->system->chown($webroot . "/.well-known/", $data['new']['system_user']);
1194-
$app->system->chgrp($webroot . "/.well-known/", $data['new']['system_group']);
1195-
$app->system->mkdirpath($webroot . "/.well-known/acme-challenge");
1196-
$app->system->chown($webroot . "/.well-known/acme-challenge/", $data['new']['system_user']);
1197-
$app->system->chgrp($webroot . "/.well-known/acme-challenge/", $data['new']['system_group']);
1198-
$app->system->chmod($webroot . "/.well-known/acme-challenge", "g+s");
1199-
12001186
if(file_exists("/root/.local/share/letsencrypt/bin/letsencrypt")) {
1201-
$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 " . escapeshellarg($webroot));
1187+
$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-challenge");
12021188
}
12031189
};
12041190

server/plugins-available/nginx_plugin.inc.php

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1303,22 +1303,8 @@ function update($event_name, $data) {
13031303
if(!file_exists($crt_tmp_file) && !file_exists($key_tmp_file)) {
13041304
$app->log("Create Let's Encrypt SSL Cert for: $domain", LOGLEVEL_DEBUG);
13051305

1306-
if(is_dir($webroot . "/.well-known/acme-challenge/")) {
1307-
$app->log("Remove old challenge directory", LOGLEVEL_DEBUG);
1308-
$this->_exec("rm -rf " . $webroot . "/.well-known/acme-challenge/");
1309-
}
1310-
1311-
$app->log("Create challenge directory", LOGLEVEL_DEBUG);
1312-
$app->system->mkdirpath($webroot . "/.well-known/");
1313-
$app->system->chown($webroot . "/.well-known/", $data['new']['system_user']);
1314-
$app->system->chgrp($webroot . "/.well-known/", $data['new']['system_group']);
1315-
$app->system->mkdirpath($webroot . "/.well-known/acme-challenge");
1316-
$app->system->chown($webroot . "/.well-known/acme-challenge/", $data['new']['system_user']);
1317-
$app->system->chgrp($webroot . "/.well-known/acme-challenge/", $data['new']['system_group']);
1318-
$app->system->chmod($webroot . "/.well-known/acme-challenge", "g+s");
1319-
13201306
if(file_exists("/root/.local/share/letsencrypt/bin/letsencrypt")) {
1321-
$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 " . escapeshellarg($webroot));
1307+
$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-challenge");
13221308
}
13231309
};
13241310

0 commit comments

Comments
 (0)