Certbot failed to authenticate some domains (authenticator: nginx)

camc[.]sa domain is originally from dnet and I transferred it to bluehost and connected a wordpress site to it. Now i created a subdomain and connected it to my new website hosted on aws. I created the sub domain vr.camc[.]sa on bluehost as I cannot create subdomain on dnet. Then after verification dns status says pointed and is now pointing towards the website deployed on aws. But it is http and i tried to get ssl certificate from letsencrypt using commands in ec2 instance but got some errors which are attached below. Can you help me in this regard as camc[.]sa has SSL certificate but its subdomain vr.camc[.]sa does not.

My domain is: camc[.]sa
My sub-domain is: vr.camc[.]sa

I ran this command:
sudo apt-get update
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get install python3-certbot-nginx
sudo certbot --nginx -d vr.camc[.]sa -d www.vr.camc[.]sa

It produced this output:
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Requesting a certificate for vr.camc[.]sa and www.vr.camc[.]sa

Certbot failed to authenticate some domains (authenticator: nginx). The Certificate Authority reported these problems:
Domain: vr.camc[.]sa
Type: unauthorized
Detail: 50.87.184.136: Invalid response from http://vr.camc[.]sa/.well-known/acme-challenge/1bKwOEXrWi_pem1p6UV9ApFi32YJjuJPsQBqTugHIPg: 404

Domain: www.vr.camc[.]sa
Type: unauthorized
Detail: 50.87.184.136: Invalid response from http://www.vr.camc[.]sa/.well-known/acme-challenge/Ot_oRDLRnVYn2IOPOk_pcaQo84PKHuq5vRZoBBrInec: 404

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.

Some challenges have failed.

My web server is (include version):Nginx

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

My hosting provider, if applicable, is: dnet and bluehost

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): No

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

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

I see one issued certificate:

General
Issuer Name:	Let's Encrypt
Serial Number:	3d572c4991984706a3524541a485b256271
Issuer CN:	R3
Subject CN:	vr.camc[.]sa
Validation:	non-EV
Valid From:	Mon May 13 2024 00:00:00 GMT-0700 (Pacific Daylight Time)
Valid To:	Sun Aug 11 2024 00:00:00 GMT-0700 (Pacific Daylight Time)
Signing Algorithm:	SHA-256
Key:	RSA-2048
Issuer DN:	cn=R3,o=Let's Encrypt,c=US
Subject DN:	cn=vr.camc[.]sa
Subject Org:	undefined

Edit:

I disagree that you are using Nginx, I find Server: Apache

$ curl -i http://vr.camc[.]sa/.well-known/acme-challenge/ZQ9QvtC57WWI67m8DpJbQ4uJzk5lSxStWgxDs1zl
HTTP/1.1 404 Not Found
Date: Mon, 13 May 2024 18:02:59 GMT
Server: Apache
Content-Length: 315
Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL was not found on this server.</p>
<p>Additionally, a 404 Not Found
error was encountered while trying to use an ErrorDocument to handle the request.</p>
</body></html>
1 Like

Not that it will fix this problem, but the recommended installation instructions for certbot are via snap.
See: Certbot (eff.org)

As for the current problem, it seems that nginx has been set to require authentication.
The HTTP ACME challenge requests will always fail such authentication requirements.
Let's have a look at the full nginx config, with the output of:

nginx -T

And the complete certbot logs, normally found at:
/var/log/letsencrypt/letsencrypt.log

2 Likes

It seems your site has listed for PHISHING by four security vendors
And as MALICIOUS by one security vendor:
VirusTotal - URL

2 Likes

nginx -T returns following,

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 www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
        worker_connections 768;
        # multi_accept on;
}

http {

        ##
        # Basic Settings
        ##

        sendfile on;
        tcp_nopush on;
        types_hash_max_size 2048;
        # server_tokens off;

        # server_names_hash_bucket_size 64;
        # server_name_in_redirect off;

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

        ##
        # SSL Settings
        ##

        ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
        ssl_prefer_server_ciphers on;

        ##
        # Logging Settings
        ##

        access_log /var/log/nginx/access.log;
        error_log /var/log/nginx/error.log;

        ##
        # Gzip Settings
        ##

        gzip on;

        # gzip_vary on;
        # gzip_proxied any;
        # gzip_comp_level 6;
        # gzip_buffers 16 8k;
        # gzip_http_version 1.1;
        # gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

        ##
        # Virtual Host Configs
        ##

        include /etc/nginx/conf.d/*.conf;
        include /etc/nginx/sites-enabled/*;
}


#mail {
#       # See sample authentication script at:
#       # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
#
#       # auth_http localhost/auth.php;
#       # pop3_capabilities "TOP" "USER";
#       # imap_capabilities "IMAP4rev1" "UIDPLUS";
#
#       server {
#               listen     localhost:110;
#               protocol   pop3;
#               proxy      on;
#       }
#
#       server {
#               listen     localhost:143;
#               protocol   imap;
#               proxy      on;
#       }
#}

# configuration file /etc/nginx/modules-enabled/50-mod-http-geoip2.conf:
load_module modules/ngx_http_geoip2_module.so;

# configuration file /etc/nginx/modules-enabled/50-mod-http-image-filter.conf:
load_module modules/ngx_http_image_filter_module.so;

# configuration file /etc/nginx/modules-enabled/50-mod-http-xslt-filter.conf:
load_module modules/ngx_http_xslt_filter_module.so;

# configuration file /etc/nginx/modules-enabled/50-mod-mail.conf:
load_module modules/ngx_mail_module.so;

# configuration file /etc/nginx/modules-enabled/50-mod-stream.conf:
load_module modules/ngx_stream_module.so;

# configuration file /etc/nginx/modules-enabled/70-mod-stream-geoip2.conf:
load_module modules/ngx_stream_geoip2_module.so;

# 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/png                             png;
    image/tiff                            tif tiff;
    image/vnd.wap.wbmp                    wbmp;
    image/x-icon                          ico;
    image/x-jng                           jng;
    image/x-ms-bmp                        bmp;
    image/svg+xml                         svg svgz;
    image/webp                            webp;

    application/font-woff                 woff;
    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.ms-excel              xls;
    application/vnd.ms-fontobject         eot;
    application/vnd.ms-powerpoint         ppt;
    application/vnd.wap.wmlc              wmlc;
    application/vnd.google-earth.kml+xml  kml;
    application/vnd.google-earth.kmz      kmz;
    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;

    application/vnd.openxmlformats-officedocument.wordprocessingml.document    docx;
    application/vnd.openxmlformats-officedocument.spreadsheetml.sheet          xlsx;
    application/vnd.openxmlformats-officedocument.presentationml.presentation  pptx;

    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/sites-enabled/default:
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# https://www.nginx.com/resources/wiki/start/
# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
# https://wiki.debian.org/Nginx/DirectoryStructure
#
# In most cases, administrators will remove this file from sites-enabled/ and
# leave it as reference inside of sites-available where it will continue to be
# updated by the nginx packaging team.
#
# This file will automatically load configuration files provided by other
# applications, such as Drupal or Wordpress. These applications will be made
# available underneath a path with that package name, such as /drupal8.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##

# Default server configuration
#
server {
        listen 80 default_server;
        listen [::]:80 default_server;

        # SSL configuration
        #
        # listen 443 ssl default_server;
        # listen [::]:443 ssl default_server;
        #
        # Note: You should disable gzip for SSL traffic.
        # See: https://bugs.debian.org/773332
        #
        # Read up on ssl_ciphers to ensure a secure configuration.
        # See: https://bugs.debian.org/765782
        #
        # Self signed certs generated by the ssl-cert package
        # Don't use them in a production server!
        #
        # include snippets/snakeoil.conf;

        #root /var/www/html;

        # Add index.php to the list if you are using PHP
        #index index.html index.htm index.nginx-debian.html;

        #server_name _;

        #location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                #       try_files $uri $uri/ =404;
                #}


        location / {
                proxy_pass http://localhost:5000/;
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection 'upgrade';
                proxy_set_header Host $host;
                proxy_cache_bypass $http_upgrade;
        }


        # pass PHP scripts to FastCGI server
        #
        #location ~ \.php$ {
                #       include snippets/fastcgi-php.conf;
                #
                #       # With php-fpm (or other unix sockets):
                #       fastcgi_pass unix:/run/php/php7.4-fpm.sock;
                #       # With php-cgi (or other tcp sockets):
                #       fastcgi_pass 127.0.0.1:9000;
                #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
                #       deny all;
                #}
}


# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
#server {
#       listen 80;
#       listen [::]:80;
#
#       server_name example.com;
#
#       root /var/www/example.com;
#       index index.html;
#
#       location / {
#               try_files $uri $uri/ =404;
#       }
#}

server {

        # SSL configuration
        #
        # listen 443 ssl default_server;
        # listen [::]:443 ssl default_server;
        #
        # Note: You should disable gzip for SSL traffic.
        # See: https://bugs.debian.org/773332
        #
        # Read up on ssl_ciphers to ensure a secure configuration.
        # See: https://bugs.debian.org/765782
        #
        # Self signed certs generated by the ssl-cert package
        # Don't use them in a production server!
        #
        # include snippets/snakeoil.conf;

        #root /var/www/html;

        # Add index.php to the list if you are using PHP
        #index index.html index.htm index.nginx-debian.html;

        #server_name _;

        #location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                #       try_files $uri $uri/ =404;
                #}


        location / {
                proxy_pass http://localhost:5000/;
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection 'upgrade';
                proxy_set_header Host $host;
                proxy_cache_bypass $http_upgrade;
        }


        # pass PHP scripts to FastCGI server
        #
        #location ~ \.php$ {
                #       include snippets/fastcgi-php.conf;
                #
                #       # With php-fpm (or other unix sockets):
                #       fastcgi_pass unix:/run/php/php7.4-fpm.sock;
                #       # With php-cgi (or other tcp sockets):
                #       fastcgi_pass 127.0.0.1:9000;
                #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
                #       deny all;
                #}

    server_name www.camc[.]sa camc[.]sa; # managed by Certbot

    listen [::]:443 ssl ipv6only=on; # managed by Certbot
    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/camc.sa/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/camc.sa/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot



}
server {
    if ($host = www.camc[.]sa) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    if ($host = camc[.]sa) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


        listen 80 ;
        listen [::]:80 ;
    server_name www.camc[.]sa camc[.]sa;
    return 404; # managed by Certbot




}
# configuration file /etc/letsencrypt/options-ssl-nginx.conf:
# This file contains important security parameters. If you modify this file
# manually, Certbot will be unable to automatically provide future security
# updates. Instead, Certbot will print and log an error message with a path to
# the up-to-date file that you will need to refer to when manually updating
# this file.

ssl_session_cache shared:le_nginx_SSL:10m;
ssl_session_timeout 1440m;
ssl_session_tickets off;

ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers off;

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";

This cannot be possible. I installed nginx and configured its settings.

The nginx config shown has no vhost for the vr subdomain.

3 Likes

Can you explain about this topic as Its my first time deployed website on sub domain and don't know much about it and nginx

What show?:
ps -ef | grep -v grep | grep -Ei 'apache|nginx|docker'
netstat -plnt
curl -4 ifconfig.me

2 Likes

@MuhammadSanaullah123,

On the machine running "nginx"
Please run and share the output of

curl -4 ifconfig.me
curl -6 ifconfig.me

and/or

curl -4 ifconfig.co
curl -6 ifconfig.co

and/or

curl -4 ifconfig.io
curl -6 ifconfig.io

Presently this is what I see

$ nmap -Pn -p80,443 vr.camc[.]sa
Starting Nmap 7.80 ( https://nmap.org ) at 2024-05-13 18:17 UTC
Nmap scan report for vr.camc[.]sa (50.87.184.136)
Host is up (0.051s latency).
rDNS record for 50.87.184.136: box2547.bluehost.com

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

Nmap done: 1 IP address (1 host up) scanned in 0.13 seconds
$ curl -i http://vr.camc[.]sa/.well-known/acme-challenge/qBZRlRGVVtRArbjZnqHmR9uyRBszEAnmRL7mdwTP
HTTP/1.1 404 Not Found
Date: Mon, 13 May 2024 18:17:34 GMT
Server: Apache
Content-Length: 315
Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL was not found on this server.</p>
<p>Additionally, a 404 Not Found
error was encountered while trying to use an ErrorDocument to handle the request.</p>
</body></html>

Edit:

And here too is showing Apache SSL Server Test: vr.camc.sa (Powered by Qualys SSL Labs)

Yet here does show nginx

And here shows Apache

This is not a forum for basic web server configuraitons.
Here is what a quick web search returned:
image
[I'm sure you can find much more by searching online][

2 Likes

Bluehost support replied to me stating that they have installed SSL and will be visible after 30 mints. I will wait and see the result. If it does not happen, I will follow the instructions of @Bruce5051 and @rg305

You don't need to wait for those results.
See them now:
SSL Server Test: vr.camc.sa (Powered by Qualys SSL Labs)

That said, have you addressed the PHISHING/MALICIOUS content issue?:

2 Likes

I will look into it today as I am not sure how there are phishing or malicious content. Maybe there are vulnerabilities which i will look out for

oh wow, you added some useful knowledge into my brain library. I was not aware of this website to check the SSL

Is this this the IP Address SSL Report: vr.camc[.]sa (50.87.184.136) you are expecting @MuhammadSanaullah123 ?

Edit:

This Permanent link to this check report shows, from around the world, mostly "Not found" for camc[.]saDNS.

And Permanent link to this check report for vr.camc[.]sa most of the shows 43.205.115.65 and a few show 50.87.184.136.

What is going on with your DNS?

Edit:

I am therefor assuming this box2547.bluehost.com (50.87.184.136) is the correct one.
And from here Certbot failed to authenticate some domains (authenticator: nginx) - #10 by Bruce5051
the server is Apache.

nmap -Pn -p80,443 50.87.184.136

$ nmap -Pn -p80,443 50.87.184.136
Starting Nmap 7.80 ( https://nmap.org ) at 2024-05-13 18:42 UTC
Nmap scan report for box2547.bluehost.com (50.87.184.136)
Host is up (0.049s latency).

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

Nmap done: 1 IP address (1 host up) scanned in 0.12 seconds

Edit SSL Server Test: vr.camc.sa (Powered by Qualys SSL Labs) has Alternative names Alternative names *.bluehost.com bluehost.com in Certificate #2

nmap -Pn -p80,443 43.205.115.65

$ nmap -Pn -p80,443 43.205.115.65
Starting Nmap 7.80 ( https://nmap.org ) at 2024-05-13 18:42 UTC
Nmap scan report for ec2-43-205-115-65.ap-south-1.compute.amazonaws.com (43.205.115.65)
Host is up (0.23s latency).

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

Nmap done: 1 IP address (1 host up) scanned in 0.57 seconds

Edit: And interestingly SSL Server Test: ec2-43-205-115-65.ap-south-1.compute.amazonaws.com (Powered by Qualys SSL Labs) has Alternative names camc.sa www.camc.sa

1 Like

Some public global DNS systems still see AWS as authoritative:
primary name server = ns-991.awsdns-59.net

LE doesn't use such public DNS systems.

3 Likes

Agree; but that IPv4 Address I see the Server is Apache.

$ nmap -Pn -p80,443 vr.camc[.]sa
Starting Nmap 7.80 ( https://nmap.org ) at 2024-05-13 18:51 UTC
Nmap scan report for vr.camc[.]sa (50.87.184.136)
Host is up (0.053s latency).
rDNS record for 50.87.184.136: box2547.bluehost.com

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

Nmap done: 1 IP address (1 host up) scanned in 0.14 seconds

Server: Apache

$ curl -Ii http://vr.camc[.]sa/
HTTP/1.1 301 Moved Permanently
Date: Mon, 13 May 2024 18:51:52 GMT
Server: Apache
X-Redirect-By: WordPress
Set-Cookie: pll_language=en; expires=Tue, 13 May 2025 18:51:53 GMT; Max-Age=31536000; path=/; SameSite=Lax
Upgrade: h2,h2c
Connection: Upgrade
Location: https://camc[.]sa/
Cache-Control: max-age=7200
Expires: Mon, 13 May 2024 20:51:52 GMT
host-header: c2hhcmVkLmJsdWVob3N0LmNvbQ==
X-Endurance-Cache-Level: 2
X-nginx-cache: WordPress
Content-Type: text/html; charset=UTF-8

This is why I had asked for

Edit:

@MuhammadSanaullah123,

Just to help clarify the why for the question

Let’s Encrypt offers Domain Validation (DV) certificates.

Let's Encrypt uses Multi-Perspective Validation Improves Domain Validation Security - Let's Encrypt

Since these are Domain Validation (DV) certificates the Domain Name System (DNS) is used extensively in the validation process as well a allowing us to assist here on Let's Encrypt community.
DNS Queries need to give consistent results from any location on the Internet, all your authoritative DNS Servers for the Domain need to also give consistent results as well.

Edit: @MuhammadSanaullah123 given this possibly waiting for the DNS to sync-up

1 Like

Yes, thus why we asked to see the real IP at the server now:
curl -4 ifconfig.me

2 Likes

There seems to be an issue with the domain registrar.
Where it hasn't synced with the Internet DNS system.

WHOIS info shows:

Name Servers:
ns1.bluehost.com
ns2.bluehost.com

see: Whois camc.sa

But the DNS for the SA TLD still show:

camc[.]sa nameserver = ns-991.awsdns-59.net
camc[.]sa nameserver = ns-64.awsdns-08.com
camc[.]sa nameserver = ns-1423.awsdns-49.org
camc[.]sa nameserver = ns-1925.awsdns-48.co.uk

See: nslookup -q=ns camc[.]sa m1.dns.sa

3 Likes