Managed to create certificates for sites on the httpd server and renew seems to be working but do not see where systemd services for certbot was installed, appears something was missed. What is the best way to install/configure the systemd services without impacting existing sites or certificates?
My domain is: nanocode.net
I ran this command:
certbot renew --cert-name nanocode.net
It produced this output:
Saving debug log to /var/log/letsencrypt/letsencrypt.log
The following certificates are not due for renewal yet:
/etc/letsencrypt/live/nanocode.net/fullchain.pem expires on 2027-01-06 (skipped)
No renewals were attempted.
My web server is (include version):
Server version: Apache/2.4.66 (Fedora Linux)
The operating system my web server runs on is (include version):
Fedora Server
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 5.5.0
That won't touch your existing certificates or Apache config. It just runs certbot renew twice a day, and certbot only renews certs that are close to expiry. Extra options for that service (hooks etc.) go in /etc/sysconfig/certbot.
You can confirm the whole renewal path works with:
sudo certbot renew --dry-run
If the unit isn't there at all, certbot was probably installed another way (pip or snap). In that case rpm -q certbot and which certbot will tell you which one you're running.
This is interesting. Certbot is not listed as installed with sudo dnf list --installed and nothing is listed from sudo systemctl list-unit-files 'certbot*', but certbot is available.
sudo certbot renew --dry-run nanocode.net executed successfully yesterday but today there is an error (note server has been rebooted):
Processing /etc/letsencrypt/renewal/nanocode.net.conf
Failed to renew certificate nanocode.net with error: The manual plugin is not working; there may be problems with your existing configuration.
The error was: PluginError('An authentication script must be provided with --manual-auth-hook when using the manual plugin non-interactively.')
All simulated renewals failed. The following certificates could not be renewed:
/etc/letsencrypt/live/nanocode.net/fullchain.pem (failure)
Since it's not from dnf, certbot was installed some other way, so there's no timer shipped with it. This shows where it lives:
which certbot
readlink -f $(which certbot)
/opt/certbot/... means the pip install from the certbot instructions, and that method expects you to add the renewal cron job yourself. /snap/... would come with its own snap.certbot.renew.timer, which isn't in your list.
The bigger problem is the second one: the cert was issued with the manual plugin. Check authenticator in /etc/letsencrypt/renewal/nanocode.net.conf, it will say manual. Manual certs can't renew unattended without auth hooks, so even with a timer the renewal would fail. The dry run probably only worked yesterday because you ran it interactively.
Since you run Apache on the same machine, the easiest fix is to reissue with a plugin that can renew by itself, e.g.:
(adjust the names to what's on the current cert). If you need a wildcard, use the DNS plugin for your DNS provider instead. Then sudo certbot renew --dry-run should pass without prompting, and you can add the timer or cron job. You have until January, so no rush.
Did you use sudo yesterday? Your first post did not show it. Sometimes systems have different paths for sudo and not so perhaps this explains the change?
Sure, the Certbot renewal service technically could be configured for hooks etc but is not "best practice". It is best to use the built-in Certbot features for those. The Certbot features are then active regardless of how you invoke the renew such when doing sudo certbot renew --dry-run.
You can specify Certbot hooks globally or even per-cert. Same with other options. These are explained in the Certbot docs. You cannot specify per-cert options by customizing the renewal service.
Your posts are mostly correct but sound like an AI giving advice. I apologize if not but please be careful when copy/pasting AI comments.
@bcs It is worth sorting out how you have a Certbot running with inconsistent results day to day. Sounds like you have kind of a mess and would be best to unravel that so you have a manageable system going forward.
For sudo certbot --apache -d nanocode.net -d www.nanocode.net:
1: Attempt to reinstall this existing certificate
2: Renew & replace the certificate (may be subject to CA rate limits) 1 or 2?
That looks like a probable pip venv install. Does that mean anything to you?
That would also explain why no systemd services were setup as the pip install is a DIY effort
Those installs should use the instructions found here: Certbot Instructions They show setting up a cronjob for auto-renew. You don't have to use systemd timer. A cronjob is probably easier unless you are well-versed in systemd services.
Before sorting out your cert choices, what are the outputs of these:
sudo certbot --version
sudo certbot certificates
I'd also like to see output of:
sudo httpd -t -D DUMP_VHOSTS
And, while I"m asking I see a lot of wildcard certs in your recent history. Are these necessary or was that just expedient? Because using the --apache option won't be able to issue a wildcard cert even though it may be easier for discrete names in a VirtualHost. Best to sort that out in advance.
sudo httpd -t -D DUMP_VHOSTS:
VirtualHost configuration:
*:80 is a NameVirtualHost
default server 10.0.1.212 (/etc/httpd/sites-enabled/cookingaverse.com.conf:1)
port 80 namevhost 10.0.1.212 (/etc/httpd/sites-enabled/cookingaverse.com.conf:1)
port 80 namevhost lakecam.net (/etc/httpd/sites-enabled/lakecam.net.conf:1)
port 80 namevhost 10.0.1.212 (/etc/httpd/sites-enabled/nanocode.net.conf:1)
port 80 namevhost 10.0.1.212 (/etc/httpd/sites-enabled/nanomail.net.conf:1)
port 80 namevhost 10.0.1.212 (/etc/httpd/sites-enabled/ss.nanocode.net.conf:1)
port 80 namevhost 10.0.1.212 (/etc/httpd/sites-enabled/w.nanocode.net.conf:1)
*:443 is a NameVirtualHost
default server 10.0.1.212 (/etc/httpd/conf.d/ssl.conf:56)
port 443 namevhost 10.0.1.212 (/etc/httpd/conf.d/ssl.conf:56)
port 443 namevhost cookingaverse.com (/etc/httpd/sites-available/cookingaverse.com-le-ssl.conf:2)
port 443 namevhost nanocode.net (/etc/httpd/sites-available/nanocode.net-le-ssl.conf:2)
port 443 namevhost nanomail.net (/etc/httpd/sites-available/nanomail.net-le-ssl.conf:2)
Output of this: sudo dnf list --installed certbot
would be interesting. Pretty sure you or something installed it via pip though and not dnf. Something had to install it.
Yes, with an asterisk. Most definitely there were wildcard certs issued. See: nanocode.net CT search results | CertObserver
Both Let's Encrypt and Google Trust Services have issued wildcard certs. Can you explain that?
I don't see any wildcard certs in your Certbot list. Is some other system requesting them?
That's odd that your port 443 VirtualHosts are in sites-available but port 80 in sites-enabled. Do you know why that is? Just trying to understand what you have before we start actually modifying it.
sudo dnf list --installed certbot
No matching packages to list. Been awhile but I think certbot may have been installed with the OS, although that seems odd.
nanocode.net CT search results | CertObserver
This server is a new install as part of a migration off an existing server. The wildcard are there which I must have done but do not have a record of it. Note several of these were errors do to my learning curve and should reflect the recent certbot certificate output.
That's odd that your port 443 VirtualHosts are in sites-available but port 80 in sites-enabled.
Probable due to an error on my part. It works without visible errors so did not pursue it further. Was the same on previous server.
Will update the links. Should links exist for both port 80 and 443 or just 443?
Thank you for your patience with all this, the advice and willingness to pursue it.
@MikeMcQ Did some checking and what happened with sites-enabled is I split the files but was not was aware both ports needed to be represented. Worked so did not question it. Fixing it now.
Copied the colon with DUMP_VHOSTS:
VirtualHost configuration:
*:80 is a NameVirtualHost
default server 10.0.1.212 (/etc/httpd/sites-enabled/cookingaverse.com-le-ssl.conf:1)
port 80 namevhost 10.0.1.212 (/etc/httpd/sites-enabled/cookingaverse.com-le-ssl.conf:1)
port 80 namevhost lakecam.net (/etc/httpd/sites-enabled/lakecam.net.conf:1)
port 80 namevhost 10.0.1.212 (/etc/httpd/sites-enabled/nanocode.net-le-ssl.conf:1)
port 80 namevhost 10.0.1.212 (/etc/httpd/sites-enabled/nanomail.net-le-ssl.conf:1)
port 80 namevhost 10.0.1.212 (/etc/httpd/sites-enabled/ss.nanocode.net-le-ssl.conf:1)
port 80 namevhost 10.0.1.212 (/etc/httpd/sites-enabled/w.nanocode.net-le-ssl.conf:1)
port 80 namevhost 10.0.1.212 (/etc/httpd/sites-available/cookingaverse.com-le-ssl.conf:1)
port 80 namevhost 10.0.1.212 (/etc/httpd/sites-available/nanocode.net-le-ssl.conf:1)
port 80 namevhost 10.0.1.212 (/etc/httpd/sites-available/nanomail.net-le-ssl.conf:1)
*:443 is a NameVirtualHost
default server 10.0.1.212 (/etc/httpd/conf.d/ssl.conf:56)
port 443 namevhost 10.0.1.212 (/etc/httpd/conf.d/ssl.conf:56)
port 443 namevhost cookingaverse.com (/etc/httpd/sites-enabled/cookingaverse.com-le-ssl.conf:8)
port 443 namevhost nanocode.net (/etc/httpd/sites-enabled/nanocode.net-le-ssl.conf:8)
port 443 namevhost nanomail.net (/etc/httpd/sites-enabled/nanomail.net-le-ssl.conf:8)
port 443 namevhost ss.nanocode.net (/etc/httpd/sites-enabled/ss.nanocode.net-le-ssl.conf:8)
port 443 namevhost w.nanocode.net (/etc/httpd/sites-enabled/w.nanocode.net-le-ssl.conf:8)
port 443 namevhost cookingaverse.com (/etc/httpd/sites-available/cookingaverse.com-le-ssl.conf:8)
port 443 namevhost nanocode.net (/etc/httpd/sites-available/nanocode.net-le-ssl.conf:8)
port 443 namevhost nanomail.net (/etc/httpd/sites-available/nanomail.net-le-ssl.conf:8)
Most port 80 sites are using the same vhostname: "10.0.1.212".
Which means only the first will ever be used for that "name" - and the rest are redundant/useless.
The port 443 side is much better...
But still has some overlaps:
port 443 namevhost cookingaverse.com (/etc/httpd/sites-available/cookingaverse.com-le-ssl.conf:8)
port 443 namevhost cookingaverse.com (/etc/httpd/sites-enabled/cookingaverse.com-le-ssl.conf:8)
port 443 namevhost nanocode.net (/etc/httpd/sites-available/nanocode.net-le-ssl.conf:8)
port 443 namevhost nanocode.net (/etc/httpd/sites-enabled/nanocode.net-le-ssl.conf:8)
port 443 namevhost nanomail.net (/etc/httpd/sites-available/nanomail.net-le-ssl.conf:8)
port 443 namevhost nanomail.net (/etc/httpd/sites-enabled/nanomail.net-le-ssl.conf:8)
They exist in both (available and enabled), but all should only exist in one (pick one and put them all there).
Not sure how to make that work other than deleting the offending files from sites-available. Since httpd uses a link for sites-enabled seems the files not pointed to should be irrelevant. Will move the other files and see what happens.
Seems like different methods have been used over time to add sites to the config:
Yes, over time different methods were probably used. Been awhile for some of these.
Most port 80 sites are using the same vhostname: "10.0.1.212". Which means only the first will ever be used for that "name" - and the rest are redundant/useless.
All configuration files contain a redirect from the http port 80 url to the https url. The original http port 80 files were modified by certbot (I think) and used for sites-enabled links. Please correct me if this is not something certbot would have done.
Moved the original non ssl files, reloaded httpd and reran httpd -t -D DUMP_VHOSTS - results appear to have be unchanged.
VirtualHost configuration:
*:80 is a NameVirtualHost
default server 10.0.1.212 (/etc/httpd/sites-enabled/cookingaverse.com-le-ssl.conf:1)
port 80 namevhost 10.0.1.212 (/etc/httpd/sites-enabled/cookingaverse.com-le-ssl.conf:1)
port 80 namevhost lakecam.net (/etc/httpd/sites-enabled/lakecam.net.conf:1)
port 80 namevhost 10.0.1.212 (/etc/httpd/sites-enabled/nanocode.net-le-ssl.conf:1)
port 80 namevhost 10.0.1.212 (/etc/httpd/sites-enabled/nanomail.net-le-ssl.conf:1)
port 80 namevhost 10.0.1.212 (/etc/httpd/sites-enabled/ss.nanocode.net-le-ssl.conf:1)
port 80 namevhost 10.0.1.212 (/etc/httpd/sites-enabled/w.nanocode.net-le-ssl.conf:1)
port 80 namevhost 10.0.1.212 (/etc/httpd/sites-available/cookingaverse.com-le-ssl.conf:1)
port 80 namevhost 10.0.1.212 (/etc/httpd/sites-available/nanocode.net-le-ssl.conf:1)
port 80 namevhost 10.0.1.212 (/etc/httpd/sites-available/nanomail.net-le-ssl.conf:1)
*:443 is a NameVirtualHost
default server 10.0.1.212 (/etc/httpd/conf.d/ssl.conf:56)
port 443 namevhost 10.0.1.212 (/etc/httpd/conf.d/ssl.conf:56)
port 443 namevhost cookingaverse.com (/etc/httpd/sites-enabled/cookingaverse.com-le-ssl.conf:8)
port 443 namevhost nanocode.net (/etc/httpd/sites-enabled/nanocode.net-le-ssl.conf:8)
port 443 namevhost nanomail.net (/etc/httpd/sites-enabled/nanomail.net-le-ssl.conf:8)
port 443 namevhost ss.nanocode.net (/etc/httpd/sites-enabled/ss.nanocode.net-le-ssl.conf:8)
port 443 namevhost w.nanocode.net (/etc/httpd/sites-enabled/w.nanocode.net-le-ssl.conf:8)
port 443 namevhost cookingaverse.com (/etc/httpd/sites-available/cookingaverse.com-le-ssl.conf:8)
port 443 namevhost nanocode.net (/etc/httpd/sites-available/nanocode.net-le-ssl.conf:8)
port 443 namevhost nanomail.net (/etc/httpd/sites-available/nanomail.net-le-ssl.conf:8)
Example sites-available file (modified to retain only the redirect for port 80)