Cannot vertify for SSL

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: www.dreams-cloud.com

I ran this command: sudo certbot --apache

It produced this output:

Certbot failed to authenticate some domains (authenticator: apache). The Certificate Authority reported these problems:
Domain: www.dreams-cloud.com
Type: unauthorized
Detail: The key authorization file from the server did not match this challenge "URFQJ0T1VPAFxjgDE2JT8pnvqqhoqmfjEbfLpCnlk0M.25o8YhyJeVp8dxc450aB3a4BIh-pFHeD26BKvNMSdqQ" != "404 File Not Found\nThe requested URL was not found on this server"

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

Some challenges have failed.
Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /var/log/letsencrypt/letsencrypt.log or re-run Certbot with -v for more details.

My web server is (include version): Apache Server version: Apache/2.4.41 (Ubuntu)
Server built: 2021-10-14T16:24:43

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

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

1 Like

When I visit your domain, I am seeing something other than your Apache server:

For Certbot to be able to obtain a certificate, your domain should be pointing at your Apache server.

2 Likes

My fault I have been trying to get it to work the last few days and today reinstalled about 5 times :frowning:
I have almost given up and going to use nextcloud for internal network use only, this is all my current configs:

sudo apache2ctl -S

*:443                  dreams-cloud.com (/etc/apache2/sites-enabled/default-ssl.conf:2)
*:80                   192.168.1.50 (/etc/apache2/sites-enabled/nextcloud.conf:1)
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex ssl-stapling: using_defaults
Mutex proxy: using_defaults
Mutex ssl-cache: using_defaults
Mutex default: dir="/var/run/apache2/" mechanism=default 
Mutex mpm-accept: using_defaults
Mutex watchdog-callback: using_defaults
Mutex rewrite-map: using_defaults
Mutex ssl-stapling-refresh: using_defaults
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www-data" id=33
Group: name="www-data" id=33

sudo gedit 000-default.conf

<VirtualHost *:80>
	# The ServerName directive sets the request scheme, hostname and port that
	# the server uses to identify itself. This is used when creating
	# redirection URLs. In the context of virtual hosts, the ServerName
	# specifies what hostname must appear in the request's Host: header to
	# match this virtual host. For the default virtual host (this file) this
	# value is not decisive as it is used as a last resort host regardless.
	# However, you must set it for any further virtual host explicitly.
	#ServerName www.example.com

	ServerAdmin peter.wilson.uk@pm.me
	DocumentRoot /var/www/nextcloud

	# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
	# error, crit, alert, emerg.
	# It is also possible to configure the loglevel for particular
	# modules, e.g.
	#LogLevel info ssl:warn

	ErrorLog ${APACHE_LOG_DIR}/error.log
	CustomLog ${APACHE_LOG_DIR}/access.log combined

	# For most configuration files from conf-available/, which are
	# enabled or disabled at a global level, it is possible to
	# include a line for only one particular virtual host. For example the
	# following line enables the CGI configuration for this host only
	# after it has been globally disabled with "a2disconf".
	#Include conf-available/serve-cgi-bin.conf
</VirtualHost>

sudo gedit default-ssl.conf

<IfModule mod_ssl.c>
	<VirtualHost *:443>
		ServerAdmin peter.wilson.uk@pm.me
		ServerName dreams-cloud.com
		ServerAlias www.dreams-cloud.com
		DocumentRoot /var/www/nextcloud

		# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
		# error, crit, alert, emerg.
		# It is also possible to configure the loglevel for particular
		# modules, e.g.
		#LogLevel info ssl:warn

		ErrorLog ${APACHE_LOG_DIR}/error.log
		CustomLog ${APACHE_LOG_DIR}/access.log combined

		# For most configuration files from conf-available/, which are
		# enabled or disabled at a global level, it is possible to
		# include a line for only one particular virtual host. For example the
		# following line enables the CGI configuration for this host only
		# after it has been globally disabled with "a2disconf".
		#Include conf-available/serve-cgi-bin.conf

		#   SSL Engine Switch:
		#   Enable/Disable SSL for this virtual host.
		SSLEngine on

		#   A self-signed (snakeoil) certificate can be created by installing
		#   the ssl-cert package. See
		#   /usr/share/doc/apache2/README.Debian.gz for more info.
		#   If both key and certificate are stored in the same file, only the
		#   SSLCertificateFile directive is needed.
		SSLCertificateFile	/etc/ssl/certs/ssl-cert-snakeoil.pem
		SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key

		#   Server Certificate Chain:
		#   Point SSLCertificateChainFile at a file containing the
		#   concatenation of PEM encoded CA certificates which form the
		#   certificate chain for the server certificate. Alternatively
		#   the referenced file can be the same as SSLCertificateFile
		#   when the CA certificates are directly appended to the server
		#   certificate for convinience.
		#SSLCertificateChainFile /etc/apache2/ssl.crt/server-ca.crt

		#   Certificate Authority (CA):
		#   Set the CA certificate verification path where to find CA
		#   certificates for client authentication or alternatively one
		#   huge file containing all of them (file must be PEM encoded)
		#   Note: Inside SSLCACertificatePath you need hash symlinks
		#		 to point to the certificate files. Use the provided
		#		 Makefile to update the hash symlinks after changes.
		#SSLCACertificatePath /etc/ssl/certs/
		#SSLCACertificateFile /etc/apache2/ssl.crt/ca-bundle.crt

		#   Certificate Revocation Lists (CRL):
		#   Set the CA revocation path where to find CA CRLs for client
		#   authentication or alternatively one huge file containing all
		#   of them (file must be PEM encoded)
		#   Note: Inside SSLCARevocationPath you need hash symlinks
		#		 to point to the certificate files. Use the provided
		#		 Makefile to update the hash symlinks after changes.
		#SSLCARevocationPath /etc/apache2/ssl.crl/
		#SSLCARevocationFile /etc/apache2/ssl.crl/ca-bundle.crl

		#   Client Authentication (Type):
		#   Client certificate verification type and depth.  Types are
		#   none, optional, require and optional_no_ca.  Depth is a
		#   number which specifies how deeply to verify the certificate
		#   issuer chain before deciding the certificate is not valid.
		#SSLVerifyClient require
		#SSLVerifyDepth  10

		#   SSL Engine Options:
		#   Set various options for the SSL engine.
		#   o FakeBasicAuth:
		#	 Translate the client X.509 into a Basic Authorisation.  This means that
		#	 the standard Auth/DBMAuth methods can be used for access control.  The
		#	 user name is the `one line' version of the client's X.509 certificate.
		#	 Note that no password is obtained from the user. Every entry in the user
		#	 file needs this password: `xxj31ZMTZzkVA'.
		#   o ExportCertData:
		#	 This exports two additional environment variables: SSL_CLIENT_CERT and
		#	 SSL_SERVER_CERT. These contain the PEM-encoded certificates of the
		#	 server (always existing) and the client (only existing when client
		#	 authentication is used). This can be used to import the certificates
		#	 into CGI scripts.
		#   o StdEnvVars:
		#	 This exports the standard SSL/TLS related `SSL_*' environment variables.
		#	 Per default this exportation is switched off for performance reasons,
		#	 because the extraction step is an expensive operation and is usually
		#	 useless for serving static content. So one usually enables the
		#	 exportation for CGI and SSI requests only.
		#   o OptRenegotiate:
		#	 This enables optimized SSL connection renegotiation handling when SSL
		#	 directives are used in per-directory context.
		#SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire
		<FilesMatch "\.(cgi|shtml|phtml|php)$">
				SSLOptions +StdEnvVars
		</FilesMatch>
		<Directory /usr/lib/cgi-bin>
				SSLOptions +StdEnvVars
		</Directory>

		#   SSL Protocol Adjustments:
		#   The safe and default but still SSL/TLS standard compliant shutdown
		#   approach is that mod_ssl sends the close notify alert but doesn't wait for
		#   the close notify alert from client. When you need a different shutdown
		#   approach you can use one of the following variables:
		#   o ssl-unclean-shutdown:
		#	 This forces an unclean shutdown when the connection is closed, i.e. no
		#	 SSL close notify alert is send or allowed to received.  This violates
		#	 the SSL/TLS standard but is needed for some brain-dead browsers. Use
		#	 this when you receive I/O errors because of the standard approach where
		#	 mod_ssl sends the close notify alert.
		#   o ssl-accurate-shutdown:
		#	 This forces an accurate shutdown when the connection is closed, i.e. a
		#	 SSL close notify alert is send and mod_ssl waits for the close notify
		#	 alert of the client. This is 100% SSL/TLS standard compliant, but in
		#	 practice often causes hanging connections with brain-dead browsers. Use
		#	 this only for browsers where you know that their SSL implementation
		#	 works correctly.
		#   Notice: Most problems of broken clients are also related to the HTTP
		#   keep-alive facility, so you usually additionally want to disable
		#   keep-alive for those clients, too. Use variable "nokeepalive" for this.
		#   Similarly, one has to force some clients to use HTTP/1.0 to workaround
		#   their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and
		#   "force-response-1.0" for this.
		# BrowserMatch "MSIE [2-6]" \
		#		nokeepalive ssl-unclean-shutdown \
		#		downgrade-1.0 force-response-1.0

	</VirtualHost>
</IfModule>

sudo gedit nextlcoud.conf

<VirtualHost *:80>
        DocumentRoot "/var/www/nextcloud"
        ServerName 192.168.1.50
        ErrorLog ${APACHE_LOG_DIR}/nextcloud.error
        CustomLog ${APACHE_LOG_DIR}/nextcloud.access combined

        <Directory /var/www/nextcloud/>
            Require all granted
            Options FollowSymlinks MultiViews
            AllowOverride All

           <IfModule mod_dav.c>
               Dav off
           </IfModule>
           
           RewriteEngine On
        RewriteRule ^/\.well-known/carddav https://%{SERVER_NAME}/remote.php/dav/ [R=301,L]
        RewriteRule ^/\.well-known/caldav https://%{SERVER_NAME}/remote.php/dav/ [R=301,L]
        RewriteRule ^/\.well-known/host-meta https://%{SERVER_NAME}/public.php?service=host-meta [QSA,L]
        RewriteRule ^/\.well-known/host-meta\.json https://%{SERVER_NAME}/public.php?service=host-meta-json [QSA,L]
        RewriteRule ^/\.well-known/webfinger https://%{SERVER_NAME}/public.php?service=webfinger [QSA,L]

        SetEnv HOME /var/www/nextcloud
        SetEnv HTTP_HOME /var/www/nextcloud
        Satisfy Any

       </Directory>
</VirtualHost>

sudo gedit /etc/hosts

127.0.0.1 localhost
127.0.1.1 dreamcoder-srv
127.0.0.1 localhost dreams-cloud.com 192.168.1.50

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

sudo gedit next cloud config.php

$CONFIG = array (
  'instanceid' => 
  'passwordsalt' => 
  'secret' => '
  'trusted_domains' => 
  array (
    0 => '192.168.1.50',
    1 => 'http://www.dreams-cloud.com',
    2 => 'http://dreams-cloud.com',
    3 => 'dreams-cloud.com',
  ),

I did previously manage to be able to access nextcloud using the domain www.dreams-cloud.com but could not get SSL to work so I give up after multiple tries and used my home IP after a plethora of installations.

I have just changed it to the above settings and can once again access my nextcloud using the domain dreams-cloud.com

however

still fails:

https://justpaste.it/84mdg

1 Like

There is no HTTP vhost for dreams-cloud.com (and www.dreams-cloud.com).
Make one for it OR try using --webroot instead:

sudo certbot certonly \
--webroot -w /var/www/nextcloud \
-d dreams-cloud.com -d www.dreams-cloud.com

000-default.conf is NOT enabled.

2 Likes

sudo certbot certonly \

--webroot -w /var/www/nextcloud
-d dreams-cloud.com -d www.dreams-cloud.com
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator webroot, Installer None
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for dreams-cloud.com
http-01 challenge for www.dreams-cloud.com
Using the webroot path /var/www/nextcloud for all unmatched domains.
Waiting for verification...
Challenge failed for domain dreams-cloud.com
Challenge failed for domain www.dreams-cloud.com
http-01 challenge for dreams-cloud.com
http-01 challenge for www.dreams-cloud.com
Cleaning up challenges
Some challenges have failed.

IMPORTANT NOTES:

  • The following errors were reported by the server:

    Domain: dreams-cloud.com
    Type: unauthorized
    Detail: The key authorization file from the server did not match
    this challenge
    "rsD252ugH0_QYRwzMPjAXkjZMw-K_N5wxYv_jxn9AhE.W8tjB5t3OeiDOXwnZzKOa8iXV_dZBHyEeCAtw1jUC4s"
    != "404 File Not Found\nThe
    requested URL was not found on this server"

    Domain: www.dreams-cloud.com
    Type: unauthorized
    Detail: The key authorization file from the server did not match
    this challenge
    "hw25FoJnWILQjGoghboJ8zbEY2lFmfpKcPfT9247QFo.W8tjB5t3OeiDOXwnZzKOa8iXV_dZBHyEeCAtw1jUC4s"
    != "404 File Not Found\nThe
    requested URL was not found on this server"

    To fix these errors, please make sure that your domain name was
    entered correctly and the DNS A/AAAA record(s) for that domain
    contain(s) the right IP address.

1 Like

sudo a2ensite 000-default.conf
Site 000-default already enabled

That seems to contradict:

2 Likes

Then you have made changes between one post and the other.

None-the-less they both use the same DocumentRoot.
So I can't see why it now fails.

2 Likes

Please show the tail of this file:

2 Likes

tail -f nextcloud.error
[Sat Nov 13 18:41:19.548429 2021] [proxy_fcgi:error] [pid 26699] [client 192.168.1.50:34716] AH01071: Got error 'PHP message: PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 231177464 bytes) in /var/www/nextcloud/lib/private/Installer.php on line 299'

Try placing a file in the DocumentRoot folder and see if it can be accessed from the Internet.

1 Like

I don't think the Apache configuration is the problem. If you make a request to the domain, a non-Apache webserver responds:

$ curl -I www.dreams-cloud.com
HTTP/1.0 200 OK
Content-type: text/html
Expires: 0

It seems more likely to me that there is a port forwarding/IP address issue at play.

2 Likes

i do use afraid dns to forward however it worked fine previously .. :frowning:

Do you recognize the webpage from the screenshot in my earlier post?

Do you know if that is the login page for your router, or maybe some camera system, or something like that?

2 Likes

it is the page i got many times i do not know what it is and could never log in i imagine be the phpmyadmin page....

It's not phpMyAdmin.

If you visit your router's IP address, do you see the same interface?

2 Likes

Nope I am running ddwrt

Well, you could try login to DD-WRT and check what your port forwarding setup is for port 80.

That should narrow down where that login page is coming from and why we aren't seeing your Apache server instead.

2 Likes

1 Like