Autorenewal failure for reverse proxy in front of unicorn rails app

Please fill out the fields below so we can help you better. Note: you must provide your domain name to get help. Domain names for issued certificates are all made public in Certificate Transparency logs (e.g. crt.sh | example.com), so withholding your domain name here does not increase secrecy, but only makes it harder for us to provide help.

My domain is:
s16.ddoherty.net

I ran this command:
certbot certonly --force-renew -d s16.ddoherty.net

It produced this output:
Certbot failed to authenticate some domains (authenticator: nginx). The Certificate Authority reported these problems:
Domain: s16.ddoherty.net
Type: connection
Detail: 76.201.154.172: Fetching http://s16.ddoherty.net/.well-known/acme-challenge/IYyMJC9_QhA_4UBqMfQQZlFG-u3GdPpMuS0Rm6BoP6o: Timeout during connect (likely firewall problem)

Hint: The Certificate Authority failed to verify the temporary nginx configuration changes made by Certbot. Ensure the listed domains point to this nginx server and that it is accessible from the internet.

My web server is (include version):
nginx version: nginx/1.18.0 (Ubuntu)
built with OpenSSL 3.0.2 15 Mar 2022
TLS SNI support enabled
configure arguments: --with-cc-opt='-g -O2 -ffile-prefix-map=/build/nginx-qDpDX0/nginx-1.18.0=. -flto=auto -ffat-lto-objects -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -flto=auto -ffat-lto-objects -flto=auto -Wl,-z,relro -Wl,-z,now -fPIC' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --modules-path=/usr/lib/nginx/modules --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-compat --with-debug --with-pcre-jit --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_v2_module --with-http_dav_module --with-http_slice_module --with-threads --add-dynamic-module=/build/nginx-qDpDX0/nginx-1.18.0/debian/modules/http-geoip2 --with-http_addition_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_sub_module

The operating system my web server runs on is (include version):

Distributor ID: Ubuntu
Description: Ubuntu 22.04.1 LTS
Release: 22.04
Codename: jammy

My hosting provider, if applicable, is:
self-hosted

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

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

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

My nginx config for the s16.ddoherty.net host is

server {
  listen 80;
  server_name s16.ddoherty.net;
  return 301 https://$host$1$request_uri;
}


server {
  server_name s16.ddoherty.net;

  listen 443 ssl http2;
  ssl_certificate /etc/letsencrypt/live/s16.ddoherty.net/fullchain.pem;
  ssl_certificate_key /etc/letsencrypt/live/s16.ddoherty.net/privkey.pem;

  client_max_body_size 4G;
  keepalive_timeout 10;

  error_page 500 502 504 /500.html;
  error_page 503 @503;

  location / {
    proxy_pass http://unicorn_s16;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

    proxy_set_header X-Forwarded-Proto $scheme;

  }

  location ~ /.well-known/acme-challenge {
    allow all;
    root /usr/share/nginx/html;
  }
}

upstream unicorn_s16 {
  server s16.lan:8080;
}

Hello @ddoherty03, welcome to the Let's Encrypt community. :slightly_smiling_face:

Your Port 80 (and 443) are filtered; Best Practice - Keep Port 80 Open.

The HTTP-01 challenge of the Challenge Types - Let's Encrypt requires access to Port 80.

$ nmap -Pn -p80,443 s16.ddoherty.net
Starting Nmap 7.80 ( https://nmap.org ) at 2024-01-23 22:27 UTC
Nmap scan report for s16.ddoherty.net (76.201.154.172)
Host is up.

PORT    STATE    SERVICE
80/tcp  filtered http
443/tcp filtered https

Nmap done: 1 IP address (1 host up) scanned in 3.40 seconds
3 Likes

Gob smack. Yes, that seems to have been the problem!

2 Likes

Also, this doesn't "fix" anything that's broken:

Square peg... round hole.
Force it!

LOL

3 Likes

2 posts were split to a new topic: Autorenewal failure nextcloud

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