Trouble with setup Lets Encrypt for Unifi

Hello all,

I am having some problems with the certificate for my site https://networkstats.tk

I think there is some issues with the forwarding perhaps.

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: networkstats.tk

I ran this command: sudo certbot --apache

It produced this output:
root@fs-media:/home/anders# sudo certbot --apache --domains networkstats.tk
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for networkstats.tk
Waiting for verification…
Cleaning up challenges

We were unable to find a vhost with a ServerName or Address of networkstats.tk.
Which virtual host would you like to choose?


1: 000-default.conf | | | Enabled
2: 000-default-le-ssl.conf | networkstats.ml | HTTPS | Enabled


Select the appropriate number [1-2] then [enter] (press ‘c’ to cancel): 2
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
Enhancement redirect was already set.


Congratulations! You have successfully enabled https://networkstats.tk

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


IMPORTANT NOTES:

  • Congratulations! Your certificate and chain have been saved at:
    /etc/letsencrypt/live/networkstats.tk/fullchain.pem
    Your key file has been saved at:
    /etc/letsencrypt/live/networkstats.tk/privkey.pem
    Your cert will expire on 2020-04-26. 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): Apache

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

My hosting provider, if applicable, is: Freenom

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

The version of my client is (e.g. output of certbot --version or certbot-auto --version if you’re using Certbot): N/A

1 Like

Hi @andersovreseth

if you have such a message, your configuration is buggy.

There are checks of your domain, last is 15 minutes old - https://check-your-website.server-daten.de/?q=networkstats.tk

The certificate is wrong

CN=UniFi, OU=UniFi, O=ubnt.com, L=San Jose, S=CA, C=US
	01.12.2019
	05.03.2022
expires in 767 days	UniFi - 1 entry

but you have created a certificate:

Issuer not before not after Domain names LE-Duplicate next LE
Let’s Encrypt Authority X3 2020-01-27 2020-04-26 networkstats.tk
1 entries duplicate nr. 1

What says

apachectl -S
1 Like

Hi @andersovreseth,

Can you please post your apache vhost configurations and the unifi system.properties file? You may want to check out this project. https://github.com/stevejenkins/unifi-linux-utils

1 Like

Hello! Thanks for the reply! I ran the command;

root@fs-media:/home/anders# apachectl -S
VirtualHost configuration:
*:443 networkstats.ml (/etc/apache2/sites-enabled/000-default-le-ssl.conf:4)
*:80 fs-media.localdomain (/etc/apache2/sites-enabled/000-default.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 watchdog-callback: using_defaults
Mutex proxy-balancer-shm: 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
root@fs-media:/home/anders#

1 Like

There

you see the problem. There is no port 80 vHost with networkstats.ml.

Perhaps delete / disable the 443 vHost (first: Make a backup), create a correct port 80 vHost.

Then again apachectl -S.

If that is ok, try

certbot --reinstall -d networkstats.ml

Certbot should find the existing certificate and should create a correct port 443 vHost.

2 Likes

Great, thanks that solved it for me!

3 Likes