Completeley remove everything certbot including certificates and start again

I am running up to date Ubuntu 20.04.1 LTS and Apache2.
Certbot was installed using Snap, which is the latest version.

I installed cerbot a couple of months back and it worked flawlessly for the domain name we had then. Since then we have changed our domain name to a differemt domain name.

I have clearly made a mess of installing the new certbot certs as they don't work.
I thought all I was going to have to do was follow these instructions


which I did but that did not give me the padlock for the new domain, in fact I've been going in circles for 20 mins now.

Does someone have commands to completley remove all of certbot so I can start again.

2 Likes

I'm pretty sure removing everything and start over isn't necessary. We probably can help you further without doing that. But we need more information to work with to do that.

What's the output of certbot certificates?

3 Likes

And what says:
apachectl -S

3 Likes

kes@wordpress:/etc/apache2/sites-enabled$ sudo certbot certificates
Saving debug log to /var/log/letsencrypt/letsencrypt.log


No certificates found.


2 Likes

Well, at least there isn't anything to remove :grin:

How did you try to get a certificate? With what command? And what was the output?

4 Likes

kes@wordpress:/etc/apache2/sites-enabled$ apachectl -S
VirtualHost configuration:
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex ssl-stapling: 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 not_used
Group: name="www-data" id=33 not_used

1 Like

Apache is no longer displaying the web page.
In the browser I get
"This site can’t provide a secure connection
floheating.co.uk sent an invalid response.
ERR_SSL_PROTOCOL_ERROR"

2 Likes

Well there is no virtual host file, so no names are being served :frowning:
And I see:

may be involved too?

3 Likes

kes@wordpress:~$ sudo certbot certonly --apache

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache
No names were found in your configuration files. Please enter in your domain
name(s) (comma and/or space separated) (Enter 'c' to cancel): floheating.co.uk www.floheating.co.uk
Requesting a certificate for floheating.co.uk and www.floheating.co.uk

IMPORTANT NOTES:

  • Congratulations! Your certificate and chain have been saved at:
    /etc/letsencrypt/live/floheating.co.uk/fullchain.pem
    Your key file has been saved at:
    /etc/letsencrypt/live/floheating.co.uk/privkey.pem
    Your certificate will expire on 2021-04-11. To obtain a new or
    tweaked version of this certificate in the future, simply run
    certbot again. 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

2 Likes

It seems your Apache doesn't have a virtualhost configured. That's not a major issue if you just have one site. However, the apache module of certbot cannot install or authenticate your hostnamethe certificate like that. But you can use the webroot plugin as authenticator and manually install the certificate.

4 Likes

Currently in browser floheating.co.uk produces this page error
"This site can’t provide a secure connection www.floheating.co.uk sent an invalid response.
ERR_SSL_PROTOCOL_ERROR"
How do I use "webroot" plugin?

2 Likes

That's not necessary. I thought you couldn't get a certificate with the apache plugin without a virtualhost, but it seems that was wrong. As you actually did get a certificate just now, right?

In any case:

I'm getting the following error from CURL:

  • error:1408F10B:SSL routines:ssl3_get_record:wrong version number

It seems your Apache is using HTTP on port 443. Apache should "speak" HTTPS, not HTTP. Your Apache is very misconfigured.

3 Likes

OR none at all.
There is no vhost configuration file (at all).

And then there is also this output:

curl -Iki http://www.floheating.co.uk:443/
HTTP/1.1 301 Moved Permanently
Date: Mon, 11 Jan 2021 18:19:21 GMT
Server: Apache/2.4.41 (Ubuntu)
X-Redirect-By: WordPress
Location: https://www.floheating.co.uk/
Content-Type: text/html; charset=UTF-8

Plain HTTP spoken on port 443.

3 Likes

I've got a file from the configurator at https://ssl-config.mozilla.org/
But where to put it.

I have a file
sudo vim /etc/apache2/apache2.conf
but it looks nothing like the file generated.
Do I just paste it on the end ?

2 Likes

You should slow down and try to better understand how to configure an Apache server and admin a server. You've already deleted whatever configuration and certs were there.

4 Likes

I know.
I had no idea it was going to be this hard.
The initial certbot cert was a synch

2 Likes

You tried to change names and file(s) got deleted...
Life happens!
Do you have any backup of the sites-enabled or sites-available folders?

3 Likes

You can search for howto's/tutorials on how to configure a website on Apache, such as https://ubuntu.com/tutorials/install-and-configure-apache#3-creating-your-own-website

3 Likes

kes@wordpress:/etc/apache2/sites-available$ ls -la
total 24
drwxr-xr-x 2 root root 4096 Jan 11 16:34 .
drwxr-xr-x 8 root root 4096 Jan 11 18:28 ..
-rw-r--r-- 1 root root 1591 Jan 11 16:34 000-default-le-ssl.conf
-rw-r--r-- 1 root root 1667 Oct 22 15:51 000-default.conf
-rw-r--r-- 1 root root 6338 Apr 13 2020 default-ssl.conf

kes@wordpress:/etc/apache2/sites-enabled$ ls -la
total 8
drwxr-xr-x 2 root root 4096 Jan 11 18:03 .
drwxr-xr-x 8 root root 4096 Jan 11 18:28 ..
lrwxrwxrwx 1 root root 52 Oct 15 11:06 000-default-le-ssl.conf-disabled -> /etc/apache2/sites-available/000-default-le-ssl.conf
lrwxrwxrwx 1 root root 35 Oct 7 15:41 000-default-le-ssl.conf-disabled1 -> ../sites-available/000-default.conf

2 Likes

Then your day is saved by the backups!
Restore all the SITES-AVAILABLE ones.
Then you need to review them and see which you would like to ENABLE.

3 Likes