Certbot: install, configure and renew certificates

Certbot can automate issuance and renewal on Linux, macOS, BSD and Windows, with plugins that install certificates into web servers. This page covers the setup, the renewal schedule and the checks that keep renewals running.

On this page

How can Certbot automate renewal on my Linux servers?

Certbot automates both issuance and renewal through a scheduled certbot renew run, and its Apache and Nginx plugins can also install the certificates into the web server configuration. If you renew by hand today, shorter certificate lifetimes change that work: the more often certificates expire, the more often someone has to remember a command, check the result and reload the service, so manual renewal becomes a recurring risk rather than an occasional task. Automation removes that dependency on memory. Certbot checks each certificate and renews it only when it is due. As of Certbot 4.0.0, a certificate is due for renewal when less than one third of its lifetime remains, and the settings for each certificate are stored in /etc/letsencrypt/renewal/CERTNAME.conf.

Most installations come with renewal already preconfigured, but you should verify it rather than assume it. The Certbot user guide says you can look for a certbot renew entry in /etc/crontab, in the files under /etc/cron.*/, or in the output of systemctl list-timers. If your install uses the manual cron approach, the guide's example line is 0 0,12 * * * root sleep $SLEEPTIME && certbot renew -q, which runs twice a day with a random sleep. Confirm that the job runs as root, that it runs on a schedule your hosts actually keep, and that it survives reboots. Use certbot renew --dry-run to test the renewal path against the Let's Encrypt staging server without saving certificates. Avoid --force-renewal in scheduled jobs, since the guide notes that CA rate limits make it unsuitable to run daily.

The people who must act are the sysadmins who own each Linux server, and the owner of any service that needs a reload after renewal. If the Apache or Nginx plugin is not installing certificates into the server, use --deploy-hook to run a script only after a successful renewal, or --pre-hook and --post-hook for steps around the renewal itself. The guide's example of stopping and starting Nginx around renewal is useful, but a stop is an outage, so test it before you rely on it. Certificates from the Manual plugin do not renew automatically unless you supply authentication hook scripts, so check the plugin on every certificate you hold. Ask your platform team to confirm which hosts are covered by the job, and treat any host without a verified renewal entry as a gap to close before the next expiry.

What Certbot's renewal rule means for certificate schedules

This table compares Certbot's renewal trigger with what it means for a server's renewal schedule, from how often the check runs to what happens when a renewal is missed. Read each row against the lifetime your certificate authority publishes, since Certbot's rule is a fraction of that lifetime and not a fixed number of days.

ItemWhat the sources sayWhat it means on a server
Renewal triggerA certificate is due for renewal when less than one third of its lifetime remains, as of Certbot 4.0.0.Renewal timing follows the certificate's own lifetime, so shorter lifetimes mean renewals fall due sooner. Confirm the lifetime your CA publishes.
Lifetime sourceThe sources do not give a validity period for Let's Encrypt or other CAs.Check the CA's published lifetime for your certificate type before estimating renewals per year.
Check frequencyThe manual example runs at 0:00 and 12:00 daily: 0 0,12 * * * root sleep $SLEEPTIME && certbot renew -q.Twice-daily checks give repeated chances to renew if a run fails. Confirm the schedule your installation uses.
Where renewal is scheduledRenewal is usually preconfigured. Check /etc/crontab, /etc/cron.*/* or systemctl list-timers for a certbot renew entry.Confirm a scheduled job exists after install, and that it survives reboots.
Renewals per yearThe sources do not state a count; it follows from the CA's lifetime and the one-third rule.Count renewals by dividing the lifetime by the renewal window. Ask the CA or check its documentation for the figure.
Renewal settingsStored per certificate in /etc/letsencrypt/renewal/CERTNAME.conf.Review these files when a renewal fails or when you change plugins or hooks.
Forced renewal--force-renewal is not appropriate to run daily because of CA rate limits.Do not add forced renewals to the daily schedule. Use it only for targeted testing.
If a renewal is skippedThe sources do not describe the outcome of a missed renewal.The certificate expires at the end of its lifetime. Monitor expiry dates and alert before the one-third window closes.

How does Certbot store certificates and reload services?

Certbot is the client that requests certificates from the certificate authority, proves control of each name and saves the results. Its work is split between two plugin roles. An authenticator plugin answers the challenge that proves control of the name, for example the Webroot, Standalone, DNS or Manual plugin. An installer plugin places the issued certificate into the web server configuration. The Apache and Nginx plugins act as both authenticator and installer, while the Webroot, Standalone, DNS and Manual plugins act only as authenticator. That split matters when you plan a deployment: if you use a plugin that is authenticator only, you must still wire the new certificate into your service yourself, usually with a deploy hook.

Each certificate has its own renewal settings file at /etc/letsencrypt/renewal/CERTNAME.conf, which records the choices made at issuance, such as the plugin and challenge type. Renewal is run with certbot renew, and the Certbot user guide says that as of Certbot 4.0.0 a certificate becomes due when less than one third of its lifetime remains. Most installations come with renewal already scheduled. You can confirm this by looking for a certbot renew entry in /etc/crontab, in /etc/cron.*/* or in the output of systemctl list-timers. Check that the schedule is present on every host after a reboot or a rebuild, because a missing entry means certificates quietly expire.

Reloading the service after renewal is handled with hooks. certbot renew --deploy-hook /path/to/deploy-hook-script runs a script only after a successful renewal, which is the usual way to make a web server pick up the new certificate. --pre-hook and --post-hook run commands before and after the renewal step, as in certbot renew --pre-hook "service nginx stop" --post-hook "service nginx start". Stopping a server for every renewal causes downtime, so prefer a deploy hook that reloads the service gracefully. Confirm the exact reload command for your web server in its own documentation, and test the hook with certbot renew --dry-run, which runs against the Let's Encrypt staging server without saving certificates.

Which Certbot plugin and challenge type fits my server?

The Apache and Nginx plugins act as both authenticator and installer. They prove control of the name by editing the running web server's configuration, and they then write the certificate into that configuration, so they suit a host where Apache or Nginx already serves the site and you want Certbot to handle both steps. Certbot documents these plugins as the path where it configures the web server itself rather than only obtaining the certificate.

  • Authenticator and installer: the plugin both answers the challenge and installs the certificate into the server's configuration.
  • Server must be running: the matching web server needs to be installed and serving the site, with the plugin available for it.
  • Port 80 open: the install guide says port 80 must be open and that Certbot is meant to run directly on a web server.
  • Renewal still runs: renewal is handled through the scheduled certbot renew entry, which the plugin sets up in most installations.
  • Wildcards are not covered here: the user guide says only the DNS plugins can issue wildcard certificates.

Before you choose this tab, confirm that the server's configuration is managed by hand or by Certbot, because editing it is what the plugin does, and check the plugin documentation for the version you run.

How do I install Certbot and schedule renewal step by step?

This sequence takes a Linux web server from a checked install of Certbot to a certificate issued and renewing on a schedule, with each step confirming the one before it. The order matters because the plugin choice and the staging test decide whether the first real issuance and the later automated renewals succeed.

  1. Confirm operating system and root access

    Check that the server runs a Linux distribution that uses systemd, and that you can act as root, because the Certbot install guide recommends root access on Linux and BSD. Certbot is supported on Linux, macOS, BSD and Windows, but this sequence uses the Linux path. Run the commands below from a root shell or with sudo. You know this step is done when you can run commands as root and confirm the distribution and its init system. If you are unsure which distribution or init system you have, check the documentation for your platform before continuing.

  2. Open port 80 to the internet

    Make sure inbound traffic on port 80 reaches the server, because the Certbot install guide says port 80 must be open and that Certbot is meant to run directly on a web server. This is the port the ACME challenge uses to confirm you control the domain. Check the firewall rules on the host and any load balancer or cloud security group in front of it. You know this step is done when an outside test request to the domain on port 80 reaches the server. Confirm the exact firewall tool and its syntax in your platform's documentation.

  3. Install Certbot with snap

    Install Certbot with the snap package, which the Certbot install guide recommends for most modern Linux distributions that use systemd. Snap is built for x86_64, ARMv7 and ARMv8 processors. Use the install commands from the install guide, which you should copy from the page as the current version may differ from what you remember. If the server still has certbot-auto installed, the guide says it is deprecated and no longer supported, and that its leftover cron entry and files should be removed. Remove them before going further so that two clients do not both try to renew. You know this step is done when running certbot --version returns a version number.

  4. Choose the authenticator and installer plugin

    Select the plugin that fits your web server and how you prove domain control. The Apache and Nginx plugins act as both authenticator and installer, so Certbot can edit the server configuration for you. The Webroot, Standalone, DNS and Manual plugins act as authenticator only, which means you install the certificate yourself. The Standalone plugin runs its own web server on port 80, so that port must be free. DNS plugins use DNS TXT records and are the only way to get wildcard certificates. The Manual plugin does not auto-renew unless you supply authentication hook scripts. You know this step is done when you have written down the plugin and the domain names it will cover.

  5. Test issuance with a dry run

    Run a dry run against the Let's Encrypt staging server before any real issuance. The user guide says --dry-run tests renew or certonly against staging without saving certificates, so nothing is installed and the production rate limits are not used. Pass the plugin and domain names you chose in the previous step. Read the output for errors about port access, DNS records or the web server configuration. You know this step is done when the dry run finishes with a success message and no challenge failures. Fix any error and repeat the dry run before moving on.

  6. Run the first real issuance

    Request the first production certificate using the same plugin and domain names that passed the dry run. Leave out --dry-run this time, so the certificate is saved and, with the Apache or Nginx plugins, installed into the server configuration. Do not use --force-renewal for routine work, because the user guide says it is not appropriate to run daily because of CA rate limits. You know this step is done when Certbot reports where the certificate and key were saved, and the web server serves the new certificate on the domain.

  7. Add deploy hooks for services that read certificates

    If the certificate is used by a service other than the web server Certbot already configured, such as a mail or API service, add a deploy hook. The user guide says a deploy hook runs a script only after a successful renewal, and is passed with certbot renew --deploy-hook followed by the path to the script. Hooks around renewal can also stop and start a service, as in the user guide example with a pre-hook and a post-hook. Keep these scripts short and check that each service reloads cleanly. You know this step is done when a manual renewal run with the hook completes and the dependent service serves the renewed certificate.

  8. Verify the renewal schedule

    Confirm that automatic renewal is running, because the user guide says most installations come with renewal preconfigured. Check for a certbot renew entry in /etc/crontab, in /etc/cron.*/*, or in the output of systemctl list-timers. The user guide's manual example runs certbot renew twice a day with a random sleep, and renewal is only attempted when a certificate is due. As of Certbot 4.0.0, a certificate is due when less than one third of its lifetime remains, and renewal settings are stored in /etc/letsencrypt/renewal/CERTNAME.conf. You know this step is done when a timer or cron entry is listed, and a dry-run renewal succeeds.

What has to be in place before Certbot can renew

Certbot renewal depends on a few conditions being true on the host before any certificate is issued. Check the operating system and access level, the network path for validation, the DNS access your challenge type needs, the install method and the scheduler that runs renewals.

Supported systems and root access

The Certbot install guide lists Linux, macOS, BSD and Windows as supported systems. On Linux and BSD it recommends running with root access, so that Certbot can write to the live certificate directory and reload services. On Windows it requires Administrator access. Confirm your system and privilege level before you plan any renewal automation, because a renewal job that runs without the rights to write certificates or reload a service will fail quietly until a certificate expires.

Certbot install docs

Port 80 reachable for validation

The install guide states that port 80 must be open and that Certbot is meant to run directly on a web server. Standalone validation needs port 80 free for Certbot's own temporary server, and HTTP-01 validation needs the Certbot-served or webroot path reachable from the public internet. Check that firewalls, load balancers and cloud security groups forward port 80 to the host for every renewal, not only the first issuance.

Certbot user guide

DNS access for DNS plugins

DNS plugins prove control of a name by creating DNS TXT records, and they are the only way the Certbot user guide describes to get wildcard certificates. Before choosing a DNS plugin, confirm that the host holds credentials for your DNS provider with rights to create and remove TXT records on the zone. Store those credentials with restricted file permissions, and test them with a dry run before relying on them for scheduled renewals.

Systemd for the snap package

The install guide recommends the snap package and says it works on most modern Linux distributions that use systemd. The snap is built for x86_64, ARMv7 and ARMv8. Hosts without systemd, or with architectures outside that list, need another install method, so check both before you standardize on snap across a fleet. Confirm that the snap service and its renewal timer are active after installation.

Install method limits

The install guide says the Docker image can obtain certificates but cannot install them or configure the web server, so a containerized Certbot needs a separate step to place certificates where the server reads them. It also says pip is supported only on a best-effort basis inside a virtual environment. The guide notes that certbot-auto is deprecated and no longer supported, and that its leftover cron entry and files should be removed. Choose the install method that matches where your certificates must be installed.

Scheduled renewal in place

The user guide says most installations come with renewal preconfigured. Check for a certbot renew entry in /etc/crontab, /etc/cron.*/* or systemctl list-timers. If none exists, add a job that runs certbot renew twice daily, as in the guide's example line. Confirm the schedule survives a reboot, since a renewal that only ran in a shell session will stop once that session ends.

Certbot user guide

How do I confirm Certbot renewals keep happening?

Confirm that renewal is scheduled before you trust it. Most Certbot installations come with renewal already preconfigured, and the Certbot user guide says you can check for it as a certbot renew entry in /etc/crontab, in the files under /etc/cron.*/*, or in the output of systemctl list-timers. If you installed Certbot by hand, the guide gives a manual example line, 0 0,12 * * * root sleep $SLEEPTIME && certbot renew -q, which runs twice a day. Find the entry on each host, note which mechanism runs it, and check that the schedule still exists after a reboot, since the goal is renewals that survive restarts. Remove any leftover certbot-auto cron entry, because the install guide says that tool is deprecated and no longer supported.

Next, test the renewal path without touching live certificates. The --dry-run flag tests renew or certonly against the Let's Encrypt staging server and does not save the certificates it obtains, so it shows whether the challenge and plugin setup still works. Run certbot renew --dry-run on each host after any change to DNS, web server configuration or hooks. Do not use --force-renewal as a daily test, because the user guide says it is not appropriate to run daily because of CA rate limits. For each certificate, check its expiry date directly, and remember that as of Certbot 4.0.0 a certificate is due for renewal when less than one third of its lifetime remains. The per-certificate settings live in /etc/letsencrypt/renewal/CERTNAME.conf, so review them when a renewal fails or a hook changes.

For the record an auditor or customer may ask for, keep three things: the scheduled renewal entry for each host, the output of the dry-run and real renewal runs, and a dated list of certificate names with their expiry dates. Write down which timer or cron file performs renewal and when you last verified it, and store the output of certbot renew runs in your logging system. If you use deploy or pre and post hooks, record the scripts they call, because those hooks decide whether a renewed certificate reaches the service. Set your own alert thresholds for expiry; the sources do not give one, so decide it in your own runbook. Confirm the exact log file location and log format on your distribution against the Certbot user guide, since the sources listed here do not name it.

How the Certbot issuance and renewal flow runs on a server

The flow starts with a scheduled certbot renew run, usually set up in /etc/crontab, /etc/cron.* or as a systemd timer. Certbot asks the certificate authority for a new certificate and the CA issues a challenge that the chosen plugin must answer, such as by writing a file for the Webroot plugin or a DNS TXT record for a DNS plugin. When the renewal succeeds, the deploy hook runs your script, which typically reloads the web server so it picks up the new certificate. Check that the scheduled entry exists, that port 80 or the DNS record is reachable, and that the deploy hook actually reloads the service.

Renewal runs on a schedule, validates through a plugin, then reloads the web server via the deploy hook.

Common questions about automating Certbot renewals

Does Certbot support ACME and wildcard certificate names?

Certbot is an ACME client, so it requests certificates from ACME-compatible certificate authorities. Wildcard names are the exception to the usual method: the Certbot user guide says DNS plugins are the only way to get wildcard certificates, because they prove control of a name by creating DNS TXT records. The Webroot, Standalone and Manual plugins cannot issue wildcard certificates. Confirm which certificate authority you use supports the wildcard and DNS validation you need, and check the Certbot user guide for the exact flags for your DNS plugin.

Which Certbot plugin should I choose for renewals?

The right plugin depends on where your web server runs and whether you need wildcard names. The Apache and Nginx plugins can both authenticate and install certificates into the server configuration. The Webroot plugin authenticates only, so you install the certificate yourself. The Standalone plugin runs its own web server on port 80, which must be free. The DNS plugins are required for wildcard certificates. The Manual plugin does not renew automatically unless you supply authentication hook scripts. Use the Certbot user guide to confirm plugin options for your platform before you schedule renewals.

When does Certbot renew a certificate?

As of Certbot 4.0.0, the Certbot user guide says a certificate is due for renewal when less than one third of its lifetime remains. Certbot stores renewal settings for each certificate in /etc/letsencrypt/renewal/CERTNAME.conf. Most installations come with renewal preconfigured. To check, look for a certbot renew entry in /etc/crontab, /etc/cron.*/* or the output of systemctl list-timers. Running certbot renew only renews certificates that are due, so it is safe to run on a schedule. Confirm the lifetime behavior against the Certbot user guide for your installed version.

What happens when a Certbot renewal fails?

The Certbot user guide describes the renewal command, certbot renew, and the deploy hook, which runs a script only after a successful renewal. Use --pre-hook and --post-hook to run commands around renewal, for example to stop and start a web server. Hooks are the usual way to reload a service when a certificate changes. Check your renewal logs and your scheduled task after any failure, and use the --dry-run flag to test renewal against the Let's Encrypt staging server without saving certificates. Do not use --force-renewal on a daily schedule, because the Certbot user guide says certificate authority rate limits apply.

Can Certbot issue certificates for internal names?

The sources listed on this page do not say whether Certbot can issue certificates for internal names. Public ACME validation requires that the name is publicly resolvable and that you can answer the validation challenge, so internal-only names generally need a different approach. Confirm with your certificate authority which names it accepts, and check the Certbot user guide for the challenge types available in your setup. For a private certificate authority, review the private PKI migration guidance before you plan renewals.

Is Certbot installation supported on my operating system?

The Certbot install guide lists Linux, macOS, BSD and Windows as supported systems. It recommends running as root on Linux and BSD, and requires Administrator access on Windows. Port 80 must be open, and Certbot is meant to run directly on the web server. The guide recommends the snap package for most modern Linux distributions that use systemd. The Docker image can obtain certificates but cannot install them or configure your web server. The install guide says certbot-auto is deprecated and no longer supported, so remove any leftover cron entry and files that it created.

When should I get outside help with Certbot renewals?

Get outside help when renewals depend on systems you cannot easily change, or when the certificate scope is wide. Typical cases include wildcard certificates through DNS providers, internal or private names, renewal across many servers or platforms, and any path that uses the Manual plugin without hook scripts. DeployOpen plans, implements, configures and documents self-hosted platforms, including certificate renewal in the client's own infrastructure, on a fixed scope agreed in writing. Ask for the written scope, deliverables and timeline before work starts. DeployOpen does not publish a price list, and a quote follows from that scope.

How DeployOpen works on this

DeployOpen plans and implements Certbot setups inside your own infrastructure, covering install method, plugin and challenge choices, and renewal scheduling. Each engagement is scoped in writing before work starts, and the result is documented so your platform team can operate it.

How we scope

  • We inventory which servers, web servers and names need certificates and which plugins each one requires.
  • We confirm whether port 80 can stay open for HTTP validation or whether DNS validation is needed for wildcard names.
  • The written scope records the Certbot install method, plugins, renewal schedule and the systems in each deliverable.

How we build

  • We install Certbot using the method your distribution supports, such as the snap package on systemd-based Linux.
  • We configure Apache or Nginx plugins, or Webroot, Standalone, or DNS plugins where the web server layout calls for them.
  • We confirm renewal runs through certbot renew, using a dry run against staging before any production change.

How we hand over

  • We document each renewal entry, its schedule in cron or systemd timers, and where renewal settings are stored.
  • We set deploy and pre or post hooks so services reload after renewal, and record each hook's purpose.
  • We remove leftover certbot-auto files and cron entries, then deliver the runbook to your operations team.

How we support

  • Ongoing support, upgrades and continuous testing are available as retainers after handover.
  • We can review renewal logs and hook behavior when your team changes web servers or DNS providers.
  • Questions about ACME profiles and renewal windows are checked against the Certbot user guide before we advise a change.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.