Challenges

Digital certificates can only be issued to people who are entitled to them. For example, assuming you don’t run google.com, you’re not entitled to a certificate for it. Nor is someone else entitled to receive a certificate for your web site.

In order to receive a certificate from Let’s Encrypt certificate authority (CA), you have to prove your control over each of the domain names that will be listed in the certificate. You can do so by making certain publicly-visible changes, proving that the person who’s requested a particular certificate is the same person who controls the site(s) that the certificate will refer to.

Let’s Encrypt specifies three different ways to prove your control over a domain (each of which Certbot may be able to do for you). These are called “challenges,” because you are being challenged to perform tasks that only someone who controls the domain should be able to accomplish.

When you use Certbot, it will attempt to help you prove control over your domains automatically in a way that’s acceptable to the CA. Especially if this doesn’t work the way you expected, it can be helpful to understand what Certbot is trying to do in each case.

The three ways to prove your control over a domain for the Let’s Encrypt CA are:

This method is called the HTTP-01 challenge. In this challenge, the certificate authority will expect a specified file to be posted in a specified location on a web site. The file will be downloaded using an HTTP request on TCP port 80. Since part of what this challenge shows is the ability to create a file at an arbitrary location, you cannot choose a different location or port number.

This method is called the TLS-SNI-01 challenge. In this challenge, the certificate authority will expect a specified digital certificate to be provided by the web server in response to an HTTPS request using a particular made-up domain name. The request will be made using HTTPS on TCP port 443. You cannot choose a different port number.

This certificate is a self-signed certificate created by Certbot. You use it only temporarily to prove your control over a domain name. It’s not the same as the certificate for your site that will later be issued by Let’s Encrypt once you’ve proven that you control the site.

This method is called the DNS-01 challenge. In this challenge, the certificate authority will expect a specified DNS record to be present in your DNS zone when queried for. The record will be a TXT record for a specific subdomain of the name you’re proving your control over.

For each kind of challenge, the challenge can potentially be completed automatically (Certbot directly makes the necessary changes itself, or runs another program that does so), or manually (Certbot tells you to make a certain change, and you edit a configuration file of some kind in order to accomplish it). Certbot’s design emphasizes performing challenges automatically, and this is the normal case for most uses of Certbot.

Some Certbot plugins offer the functionality of an authenticator, which simply means that they can satisfy challenges. Different plugins can satisfy different kinds of challenges, as follows:

apache plugin: Can only use TLS-SNI-01. Tries to edit your Apache configuration files in order to temporarily serve a specified Certbot-generated certificate for a specified name. This can work when you’re running Certbot on a web server with an existing installation of Apache that is able to listen on port 443. This makes certain assumptions about your Apache configuration.

nginx plugin: Can only use TLS-SNI-01. Tries to edit your nginx configuration files in order to temporarily serve a specified Certbot-generated certificate for a specified name. This can work when you’re running Certbot on a web server with an existing installation of nginx that is able to listen on port 443. This makes certain assumptions about your nginx configuration.

webroot plugin: Can only use HTTP-01. Tries to place a file into an appropriate place in order for that file to be served over HTTP on port 80 by an existing web server running on your system. This can work when you’re running Certbot on a web server with any existing server application that already listens to web requests on port 80, and that serves files from disk in response.

standalone plugin: Can use either TLS-SNI-01 or HTTP-01. (You can choose with the –preferred-challenges option.) Tries to run its own temporary web server which will speak either HTTP on port 80 (for HTTP-01) or HTTPS on port 443 (for TLS-SNI-01). This can work if either of these ports is free to receive incoming connections at the moment that you run Certbot, because there’s no existing program listening to them or because you’ve temporarily shut down any server application that was listening to them.

manual plugin: Can use either DNS-01 or HTTP-01. May tell you what changes you are expected to make to your configuration. Or, using an external script, can update your DNS records (for DNS-01) or your webroot (for HTTP-01). This can work if you have appropriate technical knowledge of how to make these kinds of changes yourself when asked to do so. Note that this will prevent automated renewal of your certificate using certbot renew. [Can manual also use TLS-SNI-01??]

Common problems with passing different challenges

HTTP-01 challenge: * (With webroot plugin) You aren’t running Certbot on your web server

Most people should install and run Certbot on their web server hosting their website, not on their laptops or some other computer. While you can use Certbot in manual mode on a laptop and then separately set up the appropriate files on your webserver, it’s not likely to be the most convenient way to get a certificate for most users.

TLS-SNI-01 challenge: * You aren’t running Certbot on your web server

Most people should install and run Certbot on their web server hosting their website, not on their laptops or some other computer. While you can use Certbot in manual mode on a laptop and then separately set up the appropriate files on your webserver, it’s not likely to be the most convenient way to get a certificate for most users.

DNS-01 challenge: