nginx-proxy / acme-companion

Automated ACME SSL certificate generation for nginx-proxy
MIT License
7.39k stars 820 forks source link

[warn]:no resolver defined to resolve r3.o.lencr.org #969

Closed amorev closed 1 year ago

amorev commented 1 year ago

Bug description

Early eth was working fine. I fully deleted docker from host system (needed to change from snap version).

After clean running containers for nginx-proxy and acme-companion and generating https certs (all logs in acme-companion container are OK) i am trying to visit my website and curl says this:

curl: (60) server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
More details here: http://curl.haxx.se/docs/sslcerts.html

curl performs SSL certificate verification by default, using a "bundle"
 of Certificate Authority (CA) public keys (CA certs). If the default
 bundle file isn't adequate, you can specify an alternate file
 using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
 the bundle, the certificate verification probably failed due to a
 problem with the certificate (it might be expired, or the name might
 not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
 the -k (or --insecure) option.

in logs in docker-compose this:

nginx-proxy                | nginx.1     | 2022/10/18 17:32:07 [warn] 86#86: no resolver defined to resolve r3.o.lencr.org while requesting certificate status, responder: r3.o.lencr.org, certificate: "/etc/nginx/certs/HERE_IS_MY_DOMAIN.crt"

acme-companion image version

Please provide the container version that should be printed to the first line of log at container startup:

Info: running acme-companion version v2.2

nginx-proxy's Docker configuration

docker-compose config

networks:                                                                                     
  reverse-proxy:                                                                              
    external:                                                                                 
      name: reverse-proxy                                                                     
services:                                                                                     
  nginx-proxy:                                                                                
    container_name: nginx-proxy                                                               
    image: nginxproxy/nginx-proxy:latest                                                      
    labels:                                                                                   
      com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy: ''                       
    networks:                                                                                 
      reverse-proxy: null                                                                     
    ports:                                                                                    
    - 80:80/tcp                                                                               
    - 443:443/tcp                                                                             
    restart: always                                                                           
    volumes:                                                                                  
    - conf:/etc/nginx/conf.d:rw                                                               
    - vhost:/etc/nginx/vhost.d:rw                                                             
    - html:/usr/share/nginx/html:rw                                                           
    - dhparam:/etc/nginx/dhparam:rw                                                           
    - certs:/etc/nginx/certs:ro                                                               
    - /var/run/docker.sock:/tmp/docker.sock:ro                                                
    - /var/projects/soft/nginx-proxy/conf.conf:/etc/nginx/conf.d/body.conf:rw                 
  nginx-proxy-letsencrypt:                                                                    
    container_name: nginx-proxy-letsencrypt                                                   
    environment:                                                                              
      DEFAULT_EMAIL: ''                                                                       
    image: nginxproxy/acme-companion:2.2                                                      
    restart: always                                                                           
    volumes:                                                                                  
    - certs:/etc/nginx/certs:rw                                                               
    - acme:/etc/acme.sh:rw                                                                    
    - /var/run/docker.sock:/var/run/docker.sock:ro                                            
    volumes_from:                                                                             
    - service:nginx-proxy:rw                                                                  
  whoami:                                                                                     
    environment:                                                                              
      VIRTUAL_HOST: whoami.local                                                              
    image: jwilder/whoami                                                                     
    restart: always                                                                           
version: '2.0'                                                                                
volumes:                                                                                      
  acme: {}                                                                                    
  certs: {}                                                                                   
  conf: {}                                                                                    
  dhparam: {}                                                                                 
  html: {}                                                                                    
  vhost: {}                                                                                   

rendered nginx configuration

Please provide the rendered nginx configuration:

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
# configuration file /etc/nginx/nginx.conf:

user  nginx;
worker_processes  auto;

error_log  /var/log/nginx/error.log notice;
pid        /var/run/nginx.pid;

events {
    worker_connections  10240;
}

http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    #gzip  on;

    include /etc/nginx/conf.d/*.conf;
}
daemon off;

# configuration file /etc/nginx/mime.types:

types {
    text/html                                        html htm shtml;
    text/css                                         css;
    text/xml                                         xml;
    image/gif                                        gif;
    image/jpeg                                       jpeg jpg;
    application/javascript                           js;
    application/atom+xml                             atom;
    application/rss+xml                              rss;

    text/mathml                                      mml;
    text/plain                                       txt;
    text/vnd.sun.j2me.app-descriptor                 jad;
    text/vnd.wap.wml                                 wml;
    text/x-component                                 htc;

    image/avif                                       avif;
    image/png                                        png;
    image/svg+xml                                    svg svgz;
    image/tiff                                       tif tiff;
    image/vnd.wap.wbmp                               wbmp;
    image/webp                                       webp;
    image/x-icon                                     ico;
    image/x-jng                                      jng;
    image/x-ms-bmp                                   bmp;

    font/woff                                        woff;
    font/woff2                                       woff2;

    application/java-archive                         jar war ear;
    application/json                                 json;
    application/mac-binhex40                         hqx;
    application/msword                               doc;
    application/pdf                                  pdf;
    application/postscript                           ps eps ai;
    application/rtf                                  rtf;
    application/vnd.apple.mpegurl                    m3u8;
    application/vnd.google-earth.kml+xml             kml;
    application/vnd.google-earth.kmz                 kmz;
    application/vnd.ms-excel                         xls;
    application/vnd.ms-fontobject                    eot;
    application/vnd.ms-powerpoint                    ppt;
    application/vnd.oasis.opendocument.graphics      odg;
    application/vnd.oasis.opendocument.presentation  odp;
    application/vnd.oasis.opendocument.spreadsheet   ods;
    application/vnd.oasis.opendocument.text          odt;
    application/vnd.openxmlformats-officedocument.presentationml.presentation
                                                     pptx;
    application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
                                                     xlsx;
    application/vnd.openxmlformats-officedocument.wordprocessingml.document
                                                     docx;
    application/vnd.wap.wmlc                         wmlc;
    application/wasm                                 wasm;
    application/x-7z-compressed                      7z;
    application/x-cocoa                              cco;
    application/x-java-archive-diff                  jardiff;
    application/x-java-jnlp-file                     jnlp;
    application/x-makeself                           run;
    application/x-perl                               pl pm;
    application/x-pilot                              prc pdb;
    application/x-rar-compressed                     rar;
    application/x-redhat-package-manager             rpm;
    application/x-sea                                sea;
    application/x-shockwave-flash                    swf;
    application/x-stuffit                            sit;
    application/x-tcl                                tcl tk;
    application/x-x509-ca-cert                       der pem crt;
    application/x-xpinstall                          xpi;
    application/xhtml+xml                            xhtml;
    application/xspf+xml                             xspf;
    application/zip                                  zip;

    application/octet-stream                         bin exe dll;
    application/octet-stream                         deb;
    application/octet-stream                         dmg;
    application/octet-stream                         iso img;
    application/octet-stream                         msi msp msm;

    audio/midi                                       mid midi kar;
    audio/mpeg                                       mp3;
    audio/ogg                                        ogg;
    audio/x-m4a                                      m4a;
    audio/x-realaudio                                ra;

    video/3gpp                                       3gpp 3gp;
    video/mp2t                                       ts;
    video/mp4                                        mp4;
    video/mpeg                                       mpeg mpg;
    video/quicktime                                  mov;
    video/webm                                       webm;
    video/x-flv                                      flv;
    video/x-m4v                                      m4v;
    video/x-mng                                      mng;
    video/x-ms-asf                                   asx asf;
    video/x-ms-wmv                                   wmv;
    video/x-msvideo                                  avi;
}

# configuration file /etc/nginx/conf.d/body.conf:

# configuration file /etc/nginx/conf.d/default.conf:
# nginx-proxy version : 1.0.1-6-gc4ad18f
# If we receive X-Forwarded-Proto, pass it through; otherwise, pass along the
# scheme used to connect to this server
map $http_x_forwarded_proto $proxy_x_forwarded_proto {
  default $http_x_forwarded_proto;
  ''      $scheme;
}
# If we receive X-Forwarded-Port, pass it through; otherwise, pass along the
# server port the client connected to
map $http_x_forwarded_port $proxy_x_forwarded_port {
  default $http_x_forwarded_port;
  ''      $server_port;
}
# If we receive Upgrade, set Connection to "upgrade"; otherwise, delete any
# Connection header that may have been passed to this server
map $http_upgrade $proxy_connection {
  default upgrade;
  '' close;
}
# Apply fix for very long server names
server_names_hash_bucket_size 128;
# Default dhparam
ssl_dhparam /etc/nginx/dhparam/dhparam.pem;
# Set appropriate X-Forwarded-Ssl header based on $proxy_x_forwarded_proto
map $proxy_x_forwarded_proto $proxy_x_forwarded_ssl {
  default off;
  https on;
}
gzip_types text/plain text/css application/javascript application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
log_format vhost '$host $remote_addr - $remote_user [$time_local] '
                 '"$request" $status $body_bytes_sent '
                 '"$http_referer" "$http_user_agent" '
                 '"$upstream_addr"';
access_log off;
                ssl_protocols TLSv1.2 TLSv1.3;
                ssl_ciphers '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';
                ssl_prefer_server_ciphers off;
error_log /dev/stderr;
# HTTP 1.1 support
proxy_http_version 1.1;
proxy_buffering off;
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $proxy_connection;
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 $proxy_x_forwarded_proto;
proxy_set_header X-Forwarded-Ssl $proxy_x_forwarded_ssl;
proxy_set_header X-Forwarded-Port $proxy_x_forwarded_port;
proxy_set_header X-Original-URI $request_uri;
# Mitigate httpoxy attack (see README for details)
proxy_set_header Proxy "";
server {
        server_name _; # This is just an invalid value which will never trigger on a real hostname.
        server_tokens off;
        listen 80;
        access_log /var/log/nginx/access.log vhost;
        return 503;
}
server {
        server_name _; # This is just an invalid value which will never trigger on a real hostname.
        server_tokens off;
        listen 443 ssl http2;
        access_log /var/log/nginx/access.log vhost;
        return 503;
        ssl_session_cache shared:SSL:50m;
        ssl_session_tickets off;
        ssl_certificate /etc/nginx/certs/default.crt;
        ssl_certificate_key /etc/nginx/certs/default.key;
}
        # HERE_IS_MY_DOMAIN
upstream HERE_IS_MY_DOMAIN {
        ## Can be connected with "reverse-proxy" network
        # core_nginx_1
        server 172.18.0.4:80;
}
server {
        server_name HERE_IS_MY_DOMAIN;
        listen 80 ;
        access_log /var/log/nginx/access.log vhost;
        # Do not HTTPS redirect Let'sEncrypt ACME challenge
        location ^~ /.well-known/acme-challenge/ {
                auth_basic off;
                auth_request off;
                allow all;
                root /usr/share/nginx/html;
                try_files $uri =404;
                break;
        }
        location / {
                return 301 https://$host$request_uri;
        }
}
server {
        server_name HERE_IS_MY_DOMAIN;
        listen 443 ssl http2 ;
        access_log /var/log/nginx/access.log vhost;
        ssl_session_timeout 5m;
        ssl_session_cache shared:SSL:50m;
        ssl_session_tickets off;
        ssl_certificate /etc/nginx/certs/HERE_IS_MY_DOMAIN.crt;
        ssl_certificate_key /etc/nginx/certs/HERE_IS_MY_DOMAIN.key;
        ssl_dhparam /etc/nginx/certs/HERE_IS_MY_DOMAIN.dhparam.pem;
        ssl_stapling on;
        ssl_stapling_verify on;
        ssl_trusted_certificate /etc/nginx/certs/HERE_IS_MY_DOMAIN.chain.pem;
        add_header Strict-Transport-Security "max-age=31536000" always;
        include /etc/nginx/vhost.d/default;
        location / {
                proxy_pass http://HERE_IS_MY_DOMAIN;
}
}
        # whoami.local
upstream whoami.local {
        # Cannot connect to network 'nginx-proxy_default' of this container
        # Fallback entry
        server 127.0.0.1 down;
}
server {
        server_name whoami.local;
        listen 80 ;
        access_log /var/log/nginx/access.log vhost;
        include /etc/nginx/vhost.d/default;
        location / {
                proxy_pass http://whoami.local;
}
}
server {
        server_name whoami.local;
        listen 443 ssl http2 ;
        access_log /var/log/nginx/access.log vhost;
        return 500;
        ssl_certificate /etc/nginx/certs/default.crt;
        ssl_certificate_key /etc/nginx/certs/default.key;
}

# configuration file /etc/nginx/vhost.d/default:
## Start of configuration add by letsencrypt container
location ^~ /.well-known/acme-challenge/ {
    auth_basic off;
    auth_request off;
    allow all;
    root /usr/share/nginx/html;
    try_files $uri =404;
    break;
}
## End of configuration add by letsencrypt container

Containers logs

Please provide the logs of:

nginx-proxy-letsencrypt    | [Tue Oct 18 17:32:00 UTC 2022] Your cert is in  /etc/acme.sh/https@obvu.ru/HERE_IS_MY_DOMAIN/HERE_IS_MY_DOMAIN.cer
nginx-proxy-letsencrypt    | [Tue Oct 18 17:32:00 UTC 2022] Your cert key is in  /etc/acme.sh/https@obvu.ru/HERE_IS_MY_DOMAIN/HERE_IS_MY_DOMAIN.key
nginx-proxy-letsencrypt    | [Tue Oct 18 17:32:00 UTC 2022] The intermediate CA cert is in  /etc/acme.sh/https@obvu.ru/HERE_IS_MY_DOMAIN/ca.cer
nginx-proxy-letsencrypt    | [Tue Oct 18 17:32:00 UTC 2022] And the full chain certs is there:  /etc/acme.sh/https@obvu.ru/HERE_IS_MY_DOMAIN/fullchain.cer
nginx-proxy-letsencrypt    | [Tue Oct 18 17:32:00 UTC 2022] Installing cert to:/etc/nginx/certs/HERE_IS_MY_DOMAIN/cert.pem
nginx-proxy-letsencrypt    | [Tue Oct 18 17:32:00 UTC 2022] Installing CA to:/etc/nginx/certs/HERE_IS_MY_DOMAIN/chain.pem
nginx-proxy-letsencrypt    | [Tue Oct 18 17:32:00 UTC 2022] Installing key to:/etc/nginx/certs/HERE_IS_MY_DOMAIN/key.pem
nginx-proxy-letsencrypt    | [Tue Oct 18 17:32:00 UTC 2022] Installing full chain to:/etc/nginx/certs/HERE_IS_MY_DOMAIN/fullchain.pem
nginx-proxy-letsencrypt    | Reloading nginx proxy (7639160f420a4ea4f66ba9cb8ea31cf1d7e8dc8f45be862625b94b177a62c6da)...

Docker host

Server: Docker Engine - Community Engine: Version: 20.10.19 API version: 1.41 (minimum version 1.12) Go version: go1.18.7 Git commit: c964641 Built: Thu Oct 13 16:44:09 2022 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.6.8 GitCommit: 9cd3357b7fd7218e4aec3eae239db1f68a5a6ec6 runc: Version: 1.1.4 GitCommit: v1.1.4-0-g5fd4c4d docker-init: Version: 0.19.0 GitCommit: de40ad0

buchdag commented 1 year ago

@amorev this OCSP issue has nothing to do with the LE companion. More info here.