Certbot

On this page 7

Certbot is a free, open-source ACME client that requests, installs and renews TLS certificates from Let’s Encrypt and other ACME-compatible certificate authorities. In Internet trust, it is the reference tool that turned HTTPS from a manual, paid procedure into an automated routine on ordinary web servers.

Certbot is developed by the Electronic Frontier Foundation (EFF) and written in Python. It runs on Linux and other Unix-like systems, proves control of a domain through the ACME protocol defined in RFC 8555, stores keys and certificates locally, and can reconfigure servers such as Apache and Nginx so that the new certificate is used immediately.

How Certbot obtains a certificate

Certbot obtains a certificate by running the ACME issuance workflow on behalf of the server administrator. It registers an ACME account key, asks the certificate authority for an order covering one or more domain names, completes a challenge for each name, and then submits a certificate signing request for the server key.

The certificate authority issues only Domain Validation certificates this way, because the challenge proves control of the name, not the identity of an organization. Let’s Encrypt certificates have historically been valid for 90 days, and the CA/Browser Forum has approved a schedule that shortens maximum lifetimes further, which makes automated renewal essential rather than optional.

  1. Account registration with an email address for expiry notices.
  2. Order creation for the requested domain names.
  3. Challenge completion to prove control of each name.
  4. Finalization with a CSR and download of the certificate chain.
  5. Installation into the web server, if an installer plugin is used.

Challenge types supported by Certbot

Certbot proves domain control through ACME challenges, and the choice of challenge determines which certificates are possible and which network conditions are required. The table below compares the challenge types it supports.

ChallengeHow control is provenWildcard supportTypical requirement
HTTP-01File served under /.well-known/acme-challenge/NoPort 80 reachable from the Internet
DNS-01TXT record at _acme-challengeYesAPI access to the DNS provider
TLS-ALPN-01Special certificate on port 443NoServer support for the ALPN extension
ACME challenges available in Certbot

HTTP-01 is the default and the simplest choice for a single public web server. DNS-01 is the only path to a wildcard certificate and also works for hosts that are not reachable from the Internet. Certbot itself mainly targets HTTP-01 and DNS-01, while TLS-ALPN-01 is more common in other ACME clients and reverse proxies.

Plugins and operating modes

Certbot separates authenticator plugins, which complete challenges, from installer plugins, which configure the server. This design lets one tool cover very different environments, from a single virtual machine to a containerized cluster.

PluginRoleWhen to use it
apacheAuthenticator and installerApache servers where automatic configuration is wanted
nginxAuthenticator and installerNginx servers where automatic configuration is wanted
webrootAuthenticatorA running server whose configuration stays manual
standaloneAuthenticatorNo web server running, or port 80 temporarily free
dns-cloudflare and similarAuthenticatorWildcard names or hosts behind firewalls
manualAuthenticatorOne-off tests, not suitable for unattended renewal
Common Certbot plugins and their use

The command certbot certonly only obtains a certificate and leaves installation to the administrator, while certbot --nginx or certbot --apache also edits the server configuration, including an optional HTTP-to-HTTPS redirect. Files are kept under /etc/letsencrypt/live/, where stable symbolic links always point to the newest certificate.

Automatic renewal and its pitfalls

Certbot renews certificates through `certbot renew`, which is normally executed twice a day by a systemd timer or cron job installed with the package. The command renews only certificates that are close to expiry, by default those with fewer than 30 days remaining, so frequent runs are harmless.

Renewal reuses the plugin and options recorded in the renewal configuration file for each certificate. Services that read certificates only at startup need a deploy hook, such as a command that reloads Nginx or a mail server, otherwise they keep serving the old certificate until a restart.

The table below lists frequent renewal failures, their causes and fixes.

SymptomLikely causeFix
HTTP-01 challenge failsPort 80 blocked or redirected incorrectlyAllow port 80 and exempt the challenge path
Renewed but old certificate servedService not reloadedAdd a deploy hook that reloads the service
Rate limit errorToo many repeated issuance attemptsTest with --dry-run against the staging environment
DNS-01 fails intermittentlySlow DNS propagationIncrease the propagation wait setting
Renewal never runsTimer or cron job missingCheck scheduled jobs and run certbot renew --dry-run
Typical Certbot renewal problems

Certbot among other ACME clients

Certbot is the most widely documented ACME client, but not the only one. Lightweight shell clients such as acme.sh suit minimal systems, and web servers such as Caddy include built-in ACME support that removes the need for a separate tool entirely.

Certbot is a strong choice for traditional Linux servers running Apache or Nginx. For container platforms and Kubernetes, administrators usually prefer integrated certificate controllers, while large organizations needing Organization Validation or Extended Validation certificates still rely on commercial certificate authority processes that Certbot does not replace.

Security practice matters as well. Certbot needs root privileges to bind ports and edit configuration, and the private keys in /etc/letsencrypt must stay readable only by trusted processes. DNS plugin credentials should be scoped to the minimum zone permissions required for the TXT record.

Put simply

A website needs a certificate to show the padlock in the browser, much as a shop needs a valid license on the wall. Certificates expire after a few months, and renewing them by hand is easy to forget.

Certbot is a helper program that handles this paperwork automatically. It proves to the certificate issuer that the website owner really controls the domain, fetches the certificate, installs it and renews it before it expires, so visitors keep a secure connection without anyone remembering a deadline.

In practice

A municipal library runs its catalog website on a single Ubuntu server with Nginx. The administrator installs Certbot from the distribution packages and runs certbot --nginx -d catalog.example.org -d www.catalog.example.org. Certbot completes the HTTP-01 challenge, obtains a 90-day certificate and adds a redirect from HTTP to HTTPS within about a minute.

The package also installs a systemd timer that checks renewal twice a day. The administrator runs certbot renew --dry-run once to confirm that renewal works against the staging environment and adds a deploy hook that reloads Nginx after each successful renewal.

Over the following two years the certificate renews automatically about every 60 days. The only incident occurs when a new firewall rule blocks port 80; the expiry email from the certificate authority alerts staff, they reopen the port, and the next scheduled run renews the certificate without downtime.