Invalid response from

Hi,
I do experience some trouble renewing my certificate and now is the time come to ask for some help. I managed to create the original certificat but now the renewal process won’t run. In my Fritzbox 7490 portforwarding on ports 80 and 443 to the internal ip adress is set up.
Please see below the error message running certbot -renew and my ngingx config. I am not sure whether the problem is the fritzbox or the raspberry pi with the nginx.

My domain is:

I ran this command:
certbot renew

It produced this output:
Processing /etc/letsencrypt/renewal/jcbcloud.spdns.de.conf


Cert is due for renewal, auto-renewing…
Plugins selected: Authenticator webroot, Installer None
Renewing an existing certificate
Performing the following challenges:
http-01 challenge for jcbcloud.spdns.de
Waiting for verification…
Cleaning up challenges
Attempting to renew cert (jcbcloud.spdns.de) from /etc/letsencrypt/renewal/jcbcloud.spdns.de.conf produced an unexpected error: Failed authorization procedure. jcbcloud.spdns.de (http-01): urn:ietf:params:acme:error:unauthorized :: The client lacks sufficient authorization :: Invalid response from https://jcbcloud.spdns.de/.well-known/acme-challenge/K6b-ueWs1rlddik2jnHXvAdLt3zbmGOBbtsTAAgBG1U [93.236.208.234]: “\r\n403 Forbidden\r\n<body bgcolor=“white”>\r\n

403 Forbidden

\r\n
”. Skipping.
All renewal attempts failed. The following certs could not be renewed:
/etc/letsencrypt/live/jcbcloud.spdns.de/fullchain.pem (failure)

All renewal attempts failed. The following certs could not be renewed:
/etc/letsencrypt/live/jcbcloud.spdns.de/fullchain.pem (failure)


1 renew failure(s), 0 parse failure(s)

IMPORTANT NOTES:

My web server is (include version): nginx/1.10.3

The operating system my web server runs on is (include version):
PRETTY_NAME=“Raspbian GNU/Linux 9 (stretch)”

My hosting provider, if applicable, is:

I can login to a root shell on my machine (yes or no, or I don’t know):
Yes

I’m using a control panel to manage my site (no, or provide the name and version of the control panel):

The version of my client is (e.g. output of certbot --version or certbot-auto --version if you’re using Certbot):
0.28.0

nginx config:
upstream php-handler {
#server 127.0.0.1:9000;
server unix:/var/run/php/php7.0-fpm.sock;
}

server {
listen 80;
listen [::]:80;
server_name jcbcloud.spdns.de;

enforce https

return 301 https://$server_name$request_uri;
#root /var/www/html/;
}

server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name jcbcloud.spdns.de;

ssl_certificate /etc/letsencrypt/live/jcbcloud.spdns.de/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/jcbcloud.spdns.de/privkey.pem;

Add headers to serve security related headers

Before enabling Strict-Transport-Security headers please read into this

topic first.

add_header Strict-Transport-Security “max-age=15768000; includeSubDomains; preload;”;

WARNING: Only add the preload option once you read about

the consequences in https://hstspreload.org/. This option

will add the domain to a hardcoded list that is shipped

in all major browsers and getting removed from this list

could take several months.

add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection “1; mode=block”;
add_header X-Robots-Tag none;
add_header X-Download-Options noopen;
add_header X-Permitted-Cross-Domain-Policies none;
add_header Referrer-Policy “no-referrer” always;

Path to the root of your installation

root /var/www/html/;

location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}

The following 2 rules are only needed for the user_webfinger app.

Uncomment it if you’re planning to use this app.

#rewrite ^/.well-known/host-meta /public.php?service=host-meta last;
#rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json

last;

location = /.well-known/carddav {
return 301 $scheme://$host/remote.php/dav;
}
location = /.well-known/caldav {
return 301 $scheme://$host/remote.php/dav;
}

set max upload size

client_max_body_size 512M;
fastcgi_buffers 64 4K;

Enable gzip but do not remove ETag headers

gzip on;
gzip_vary on;
gzip_comp_level 4;
gzip_min_length 256;
gzip_proxied expired no-cache no-store private no_last_modified no_etag auth;
gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy;

Uncomment if your server is build with the ngx_pagespeed module

This module is currently not supported.

#pagespeed off;

location / {
rewrite ^ /index.php$uri;
}

location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/ {
deny all;
}
location ~ ^/(?:.|autotest|occ|issue|indie|db_|console) {
deny all;
}

location ~ ^/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|ocs-provider/.+).php(?:|/) { fastcgi_split_path_info ^(.+\.php)(/.*);
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param HTTPS on;
#Avoid sending the security headers twice
fastcgi_param modHeadersAvailable true;
fastcgi_param front_controller_active true;
fastcgi_pass php-handler;
fastcgi_intercept_errors on;
fastcgi_request_buffering off;
}

location ~ ^/(?:updater|ocs-provider)(?:$|/) {
try_files $uri/ =404;
index index.php;
}

Adding the cache control header for js and css files

Make sure it is BELOW the PHP block

location ~ .(?:css|js|woff|svg|gif)$ {
try_files $uri /index.php$uri$is_args$args;
add_header Cache-Control “public, max-age=15778463”;

Add headers to serve security related headers (It is intended to

have those duplicated to the ones above)

Before enabling Strict-Transport-Security headers please read into

this topic first.

add_header Strict-Transport-Security “max-age=15768000; includeSubDomains; preload;”;

WARNING: Only add the preload option once you read about

the consequences in https://hstspreload.org/. This option

will add the domain to a hardcoded list that is shipped

in all major browsers and getting removed from this list

could take several months.

add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection “1; mode=block”;
add_header X-Robots-Tag none;
add_header X-Download-Options noopen;
add_header X-Permitted-Cross-Domain-Policies none;

Optional: Don’t log access to assets

access_log off;
}

location ~ .(?:png|html|ttf|ico|jpg|jpeg)$ {
try_files $uri /index.php$uri$is_args$args;

Optional: Don’t log access to other assets

access_log off;
}
}

Thank you for your help

Hi @krischanb

there is a check of your domain, ~1,5 hours old - https://check-your-website.server-daten.de/?q=jcbcloud.spdns.de

There you see the problem:

You have a redirect http -> https. But https + /.well-known/acme-challenge has a wrong http status 403 - Forbidden.

You use webroot (that should always work). So your config file must have the correct webroot. Check the permissions of that directory.

Hi,
I sorry, but somehow I am missing the forrest throughout the trees.
This is the content of config file for letsencrypt:

renew_before_expiry = 30 days

version = 0.28.0
archive_dir = /etc/letsencrypt/archive/jcbcloud.spdns.de
cert = /etc/letsencrypt/live/jcbcloud.spdns.de/cert.pem
privkey = /etc/letsencrypt/live/jcbcloud.spdns.de/privkey.pem
chain = /etc/letsencrypt/live/jcbcloud.spdns.de/chain.pem
fullchain = /etc/letsencrypt/live/jcbcloud.spdns.de/fullchain.pem

Options used in the renewal process

[renewalparams]
webroot_path = /var/www/html,
account = c7656509c3bec8a7c4ee4efa26899fa2
authenticator = webroot
server = https://acme-v02.api.letsencrypt.org/directory
[[webroot_map]]
jcbcloud.spdns.de = /var/www/html

Follwoing permissions are assigned in (webroot path):
/var/www/html/
drwxr-xr-x 32 www-data www-data 4096 Feb 27 21:49 3rdparty
drwxr-xr-x 41 www-data www-data 4096 Mär 23 21:20 apps
-rw-r–r-- 1 www-data www-data 12063 Feb 27 21:45 AUTHORS
drwxr-xr-x 2 www-data www-data 4096 Mär 23 21:11 config
-rw-r–r-- 1 www-data www-data 3650 Feb 27 21:45 console.php
-rw-r–r-- 1 www-data www-data 34520 Feb 27 21:45 COPYING
drwxr-xr-x 18 www-data www-data 4096 Feb 27 21:49 core
-rw-r–r-- 1 www-data www-data 4979 Feb 27 21:45 cron.php
drwxrwx— 6 www-data www-data 4096 Mär 23 21:21 data
-rw-r–r-- 1 www-data www-data 2928 Mär 23 21:08 .htaccess
-rw-r–r-- 1 www-data www-data 156 Feb 27 21:45 index.html
-rw-r–r-- 1 www-data www-data 3172 Feb 27 21:45 index.php
drwxr-xr-x 6 www-data www-data 4096 Feb 27 21:45 lib
-rw-r–r-- 1 www-data www-data 283 Feb 27 21:45 occ
drwxr-xr-x 2 www-data www-data 4096 Feb 27 21:45 ocm-provider
drwxr-xr-x 2 www-data www-data 4096 Feb 27 21:45 ocs
drwxr-xr-x 2 www-data www-data 4096 Feb 27 21:45 ocs-provider
-rw-r–r-- 1 www-data www-data 2951 Feb 27 21:45 public.php
-rw-r–r-- 1 www-data www-data 5139 Feb 27 21:45 remote.php
drwxr-xr-x 4 www-data www-data 4096 Feb 27 21:45 resources
-rw-r–r-- 1 www-data www-data 26 Feb 27 21:45 robots.txt
drwxr-xr-x 12 www-data www-data 4096 Feb 27 21:49 settings
-rw-r–r-- 1 www-data www-data 2232 Feb 27 21:45 status.php
drwxr-xr-x 3 www-data www-data 4096 Feb 27 21:45 themes
drwxr-xr-x 2 www-data www-data 4096 Feb 27 21:46 updater
-rw-r–r-- 1 www-data www-data 163 Feb 27 21:45 .user.ini
-rw-r–r-- 1 www-data www-data 362 Feb 27 21:48 version.php

and in:
/etc/letsencrypt/livejcbcloud.spdns.de/
lrwxrwxrwx 1 root root 41 Mär 23 21:02 cert.pem -> …/…/archive/jcbcloud.spdns.de/cert1.pem
lrwxrwxrwx 1 root root 42 Mär 23 21:02 chain.pem -> …/…/archive/jcbcloud.spdns.de/chain1.pem
lrwxrwxrwx 1 root root 46 Mär 23 21:02 fullchain.pem -> …/…/archive/jcbcloud.spdns.de/fullchain1.pem
lrwxrwxrwx 1 root root 44 Mär 23 21:02 privkey.pem -> …/…/archive/jcbcloud.spdns.de/privkey1.pem
-rw-r–r-- 1 root root 692 Mär 23 21:02 README

/etc/letsencrypt/archive/jcbcloud.spdns.de/
drwxr-xr-x 2 root root 4096 Mär 23 21:02 .
drwx------ 3 root root 4096 Mär 23 21:02 …
-rw-r–r-- 1 root root 1915 Mär 23 21:02 cert1.pem
-rw-r–r-- 1 root root 1647 Mär 23 21:02 chain1.pem
-rw-r–r-- 1 root root 3562 Mär 23 21:02 fullchain1.pem
-rw-r–r-- 1 root root 1704 Mär 23 21:02 privkey1.pem

What am I missing?
Thanks for your help.

If this is your correct webroot, create the two subdirectories

/var/www/html/.well-known/acme-challenge

there a file (file name 1234), then try to load that file via

http://jcbcloud.spdns.de/.well-known/acme-challenge/1234

That must work. If not, that's not your webroot.

Hi,
i created the directory and file. Trying to obtain the file via

http://jcbcloud.spdns.de/.well-known/acme-challenge/1234

returned the error: 403 Forbidden

I was redirected to https, as the nginx config requires. Changing the owner of the directory from root to www-data as the rest of the directory is owned by that user did not improve the result.
Right now I do not have a clue which other directory could be my webroot. Any further suggestions?

Thank you

Your configuration yes, but there is absolutely nothing in nginx requiring to redirect http to https unconditionally. I am adding an exception for letsencrypt, and well, I am pretty sure that's what should be done (tm):

snippets/letsencrypt.conf

location ^~ /.well-known/acme-challenge/ {
default_type "text/plain";
root /var/www/letsencrypt;
}
(http site file)
include /etc/nginx/snippets/letsencrypt.conf;
location / {
return 301 https://$host$request_uri;
}

you are welcome to do it better - I'm hardly a nginx expert -, but it works for me and on principle it's what should be done. It feels to me entirely wrong to do tls validation on a tls connexion. What happens if the certificate is misplaced ?

There

is your blocking rule.

Blocks all directories with a /. at the start.

PS:

Such rules have sometimes the same problem. The nginx user doesn't have enough rights to read files in that directory.

1 Like

Hi,
that has been the right hint.

For the moment I changed the deny to allow in the rule and it worked.

I will try to implement a solution like that. A first try did not work out.

Thanks everybody for the fast and effective help.

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.