Certificate served but invalid

#1

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. https://crt.sh/?q=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:
soerendip.com

I ran this command:
$ sudo certbot --apache

It produced this output:
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache

Which names would you like to activate HTTPS for?


1: soerendip.com


Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter ‘c’ to cancel):
Cert not yet due for renewal

You have an existing certificate that has exactly the same domains or certificate name you requested and isn’t close to expiry.
(ref: /etc/letsencrypt/renewal/soerendip.com.conf)

What would you like to do?


1: Attempt to reinstall this existing certificate
2: Renew & replace the cert (limit ~5 per 7 days)


Select the appropriate number [1-2] then [enter] (press ‘c’ to cancel): 1
Keeping the existing certificate
Deploying Certificate to VirtualHost /etc/apache2/sites-enabled/000-default-le-ssl.conf

Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.


1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you’re confident your site works on HTTPS. You can undo this
change by editing your web server’s configuration.


Select the appropriate number [1-2] then [enter] (press ‘c’ to cancel): 2
Created redirect file: le-redirect-soerendip.com.conf
Rollback checkpoint is empty (no changes made?)


Congratulations! You have successfully enabled https://soerendip.com

You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=soerendip.com


IMPORTANT NOTES:

  • Congratulations! Your certificate and chain have been saved at:
    /etc/letsencrypt/live/soerendip.com/fullchain.pem
    Your key file has been saved at:
    /etc/letsencrypt/live/soerendip.com/privkey.pem
    Your cert will expire on 2019-06-10. To obtain a new or tweaked
    version of this certificate in the future, simply run certbot again
    with the “certonly” option. To non-interactively renew all of
    your certificates, run “certbot renew”

  • If you like Certbot, please consider supporting our work by:

    Donating to ISRG / Let’s Encrypt: https://letsencrypt.org/donate
    Donating to EFF: https://eff.org/donate-le

My web server is (include version):
Server version: Apache/2.4.29 (Ubuntu)

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

My hosting provider, if applicable, is:

I can log in 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 0.28.0

#2

Hi @soerendip

there are some problems, but it should be easy to fix that ( https://check-your-website.server-daten.de/?q=soerendip.com ):

First, you have a new certificate:

CN=soerendip.com
	12.03.2019
	10.06.2019
expires in 90 days	soerendip.com - 1 entry

Valid 90 days, created today. So the most important things are working.

But: Your certificate has only one domain name. So your www version isn’t secure. So create one certificate with two domain names:

sudo certbot --apache -d soerendip.com -d www.soerendip.com

Perhaps you have first to change your port 80 vHost (add a ServerAlias www.soerendip.com).

And you have a wrong redirect to your ip address:

Domainname Http-Status redirect Sec. G
http://soerendip.com/
136.159.234.66 200 0.374 H
http://www.soerendip.com/
136.159.234.66 200 0.370 H
https://136.159.234.66 302 https://136.159.234.66 2.960 L
Certificate error: RemoteCertificateNameMismatch
https://soerendip.com/
136.159.234.66 302 https://136.159.234.66 3.180 A
https://www.soerendip.com/
136.159.234.66 302 https://136.159.234.66 3.033 N
Certificate error: RemoteCertificateNameMismatch

Your https + www isn’t secure (your certificate doesn’t have the www).

Your https + non-www redirects to your ip address. But your certificate doesn’t have your ip address as domain name, so the result is insecure.

So find that redirect and remove it.

Perhaps later add a redirect http -> https.

#3

Maybe you just needed to restart/reload your web server, but the cert now being served looks valid.
[as noted by @JuergenAuer, the cert doesn’t cover the “www” name and that may cause issues later]

#4

I did sudo service apache2 restart several times.
Did you try https://soerendip.com ? That is where I get the message that the website is not trusted.

sudo certbot --apache -d soerendip.com -d www.soerendip.com gives:

Unable to find a virtual host listening on port 80 which is currently needed for Certbot to prove to the CA that you control your domain. Please add a virtual host for port 80

#5

I clicked the test link above (as suggested) and it found no problems with your cert/site.
[returned an A+ rating]

Can you show the error you are seeing?
Can you show the IP that your system resolves that name to?

#6

Could it be the browser cache that is causing the trouble? Chrome is particularly paranoid about certificates it seems. But the error show up on my phone as well.

#7

Perhaps…
If it is also happening on other browsers, then there may be more to this.

#8

Do I have to do sudo certbot --apache -d soerendip.com -d www.soerendip.com -d 136.159.234.66?? I cannot because of a vitual host issue.

#9

Remove the IP.
LE won’t provide certs for IPs.

#10

I don’t know what that means. Is that redirect at the server (my desktop) or the provider (google) or both?

#11

Somewhere in your apache configuration…
There is a port 80 block
That (attempts to) redirect all HTTP to HTTPS.
Sadly it is configured to the HTTPS://IP.ADDRESS.
You need to find that block and fix it to the name.

Try:
grep -Eri '136.159.234.66|redirect|rewrite|return' /etc/apache2

#12

I am looking at sites-enabled. There is just one file that contains this entry:

# Redirect "/" "https://136.159.234.66"

That I commented out now, but it has no effect.

grep -Eri '136.159.234.66|redirect|rewrite|return' /etc/apache2
/etc/apache2/conf-available/localized-error-pages.conf:# 2) local redirects
/etc/apache2/conf-available/localized-error-pages.conf:# 3) external redirects
/etc/apache2/conf-available/localized-error-pages.conf:# We use Alias to redirect any /error/HTTP_<error>.html.var response to
/etc/apache2/conf-available/security.conf:# This directive configures what you return as the Server HTTP response
/etc/apache2/sites-available/000-default-le-ssl.conf:	# redirection URLs. In the context of virtual hosts, the ServerName
/etc/apache2/sites-available/000-default-le-ssl.conf:	#Redirect "/" "https://136.159.234.66"
/etc/apache2/sites-available/le-redirect-soerendip.com.conf:RewriteEngine On
/etc/apache2/sites-available/le-redirect-soerendip.com.conf:RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
/etc/apache2/sites-available/le-redirect-soerendip.com.conf:ErrorLog /var/log/apache2/redirect.error.log
/etc/apache2/sites-available/000-default.conf:	# redirection URLs. In the context of virtual hosts, the ServerName
/etc/apache2/sites-available/000-default.conf:	Redirect "/" "https://136.159.234.66"
/etc/apache2/sites-available/000-default.conf:RewriteEngine on
/etc/apache2/sites-available/000-default.conf:RewriteCond %{SERVER_NAME} =soerendip.com
/etc/apache2/sites-available/000-default.conf:RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
/etc/apache2/sites-available/default-ssl.conf:		ServerName 136.159.234.66
/etc/apache2/magic:0	string		Return-Path:	message/rfc822	7bit
/etc/apache2/mods-available/setenvif.conf:	# The following directive disables redirects on non-GET requests for
/etc/apache2/mods-available/setenvif.conf:	# redirects for folders with DAV methods.
/etc/apache2/mods-available/setenvif.conf:	BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully
/etc/apache2/mods-available/setenvif.conf:	BrowserMatch "MS FrontPage" redirect-carefully
/etc/apache2/mods-available/setenvif.conf:	BrowserMatch "^WebDrive" redirect-carefully
/etc/apache2/mods-available/setenvif.conf:	BrowserMatch "^WebDAVFS/1.[012]" redirect-carefully
/etc/apache2/mods-available/setenvif.conf:	BrowserMatch "^gnome-vfs/1.0" redirect-carefully
/etc/apache2/mods-available/setenvif.conf:	BrowserMatch "^gvfs/1" redirect-carefully
/etc/apache2/mods-available/setenvif.conf:	BrowserMatch "^XML Spy" redirect-carefully
/etc/apache2/mods-available/setenvif.conf:	BrowserMatch "^Dreamweaver-WebDAV-SCM1" redirect-carefully
/etc/apache2/mods-available/setenvif.conf:	BrowserMatch " Konqueror/4" redirect-carefully
/etc/apache2/mods-available/rewrite.load:LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so
#13

Let us have a look at this file:
/etc/apache2/sites-available/000-default.conf

#14

That has an effect, now this part is good:

Domainname Http-Status redirect Sec. G
http://soerendip.com/
136.159.234.66 200 0.317 H
http://www.soerendip.com/
136.159.234.66 200 0.317 H
https://soerendip.com/
136.159.234.66 200 2.883 A
https://www.soerendip.com/
136.159.234.66 200 2.663 N
Certificate error: RemoteCertificateNameMismatch

You can’t check such redirects with a browser, that’s one important reason I’ve startet that tool.

Your https + non-www is now ok.

So find your port 80 vHost, add there the ServerAlias and create a certificate with both domain names.

#15

How did you generate that output?

I added a virtualHost 80 to the configuration file.

#16

See post #2

#17

There is the link you can use

Or use https://check-your-website.server-daten.de/ and check another domain.

#18

Ok,

I added the virtual server for port 80 and now was able to add www.soerendip.com to the certificates file. That looks good. But I still get the privacy error when navigating via https. When I look at the certificate Chrome tells me it is invalid.

Correction, everything is fine with firefox.

#19
#20

Nope, it was just a matter of time. Now, it is working.

Thank you all, that was amazing!!

1 Like