Certbot
Certbot
Certbot
Release 1.4.0.dev0
Certbot Project
1 Introduction 1
1.1 Contributing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 How to run the client . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.3 Understanding the client in more depth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2 What is a Certificate? 3
2.1 Certificates and Lineages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
3 Get Certbot 5
3.1 About Certbot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3.2 System Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3.3 Alternate installation methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
4 User Guide 11
4.1 Certbot Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
4.2 Getting certificates (and choosing plugins) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
4.3 Managing certificates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
4.4 Changing a Certificate’s Domains . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
4.5 Where are my certificates? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
4.6 Pre and Post Validation Hooks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
4.7 Changing the ACME Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
4.8 Lock Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
4.9 Configuration file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
4.10 Log Rotation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
4.11 Certbot command-line options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
4.12 Getting help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
5 Developer Guide 41
5.1 Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
5.2 Code components and layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
5.3 Coding style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
5.4 Use certbot.compat.os instead of os . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
5.5 Mypy type annotations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
5.6 Submitting a pull request . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
5.7 Asking for help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
5.8 Updating certbot-auto and letsencrypt-auto . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
5.9 Updating the documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
5.10 Running the client with Docker . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
5.11 Notes on OS dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
6 Packaging Guide 51
i
6.1 Releases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
6.2 Notes for package maintainers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
7 Backwards Compatibility 53
8 Resources 55
9 API Documentation 57
9.1 certbot package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Index 113
ii
CHAPTER
ONE
INTRODUCTION
Certbot is part of EFF’s effort to encrypt the entire Internet. Secure communication over the Web relies on HTTPS,
which requires the use of a digital certificate that lets browsers verify the identity of web servers (e.g., is that really
google.com?). Web servers obtain their certificates from trusted third parties called certificate authorities (CAs).
Certbot is an easy-to-use client that fetches a certificate from Let’s Encrypt—an open certificate authority launched by
the EFF, Mozilla, and others—and deploys it to a web server.
Anyone who has gone through the trouble of setting up a secure website knows what a hassle getting and maintaining
a certificate is. Certbot and Let’s Encrypt can automate away the pain and let you turn on and manage HTTPS with
simple commands. Using Certbot and Let’s Encrypt is free, so there’s no need to arrange payment.
How you use Certbot depends on the configuration of your web server. The best way to get started is to use our
interactive guide. It generates instructions based on your configuration settings. In most cases, you’ll need root or
administrator access to your web server to run Certbot.
Certbot is meant to be run directly on your web server, not on your personal computer. If you’re using a hosted service
and don’t have direct access to your web server, you might not be able to use Certbot. Check with your hosting
provider for documentation about uploading certificates or using certificates issued by Let’s Encrypt.
Certbot is a fully-featured, extensible client for the Let’s Encrypt CA (or any other CA that speaks the ACME protocol)
that can automate the tasks of obtaining certificates and configuring webservers to use them. This client runs on Unix-
based operating systems.
To see the changes made to Certbot between versions please refer to our changelog.
Until May 2016, Certbot was named simply letsencrypt or letsencrypt-auto, depending on install method.
Instructions on the Internet, and some pieces of the software, may still refer to this older name.
1.1 Contributing
The easiest way to install and run Certbot is by visiting certbot.eff.org, where you can find the correct instructions for
many web server and OS combinations. For more information, see Get Certbot.
1
Certbot Documentation, Release 1.4.0.dev0
To understand what the client is doing in detail, it’s important to understand the way it uses plugins. Please see the
explanation of plugins in the User Guide.
1.3.1 Links
Documentation: https://certbot.eff.org/docs
Software project: https://github.com/certbot/certbot
Notes for developers: https://certbot.eff.org/docs/contributing.html
Main Website: https://certbot.eff.org
Let’s Encrypt Website: https://letsencrypt.org
Community: https://community.letsencrypt.org
ACME spec: http://ietf-wg-acme.github.io/acme/
ACME working area in github: https://github.com/ietf-wg-acme/acme
See https://certbot.eff.org/docs/install.html#system-requirements.
2 Chapter 1. Introduction
CHAPTER
TWO
WHAT IS A CERTIFICATE?
A public key or digital certificate (formerly called an SSL certificate) uses a public key and a private key to enable
secure communication between a client program (web browser, email client, etc.) and a server over an encrypted SSL
(secure socket layer) or TLS (transport layer security) connection. The certificate is used both to encrypt the initial
stage of communication (secure key exchange) and to identify the server. The certificate includes information about
the key, information about the server identity, and the digital signature of the certificate issuer. If the issuer is trusted
by the software that initiates the communication, and the signature is valid, then the key can be used to communicate
securely with the server identified by the certificate. Using a certificate is a good way to prevent “man-in-the-middle”
attacks, in which someone in between you and the server you think you are talking to is able to insert their own
(harmful) content.
You can use Certbot to easily obtain and configure a free certificate from Let’s Encrypt, a joint project of EFF, Mozilla,
and many other sponsors.
Certbot introduces the concept of a lineage, which is a collection of all the versions of a certificate plus Certbot
configuration information maintained for that certificate from renewal to renewal. Whenever you renew a certificate,
Certbot keeps the same configuration unless you explicitly change it, for example by adding or removing domains. If
you add domains, you can either add them to an existing lineage or create a new one.
See also: Re-creating and Updating Existing Certificates
3
Certbot Documentation, Release 1.4.0.dev0
THREE
GET CERTBOT
Table of Contents
• About Certbot
• System Requirements
• Alternate installation methods
– Certbot-Auto
– Problems with Python virtual environment
– Running with Docker
– Operating System Packages
– Installing from source
Certbot is meant to be run directly on a web server, normally by a system administrator. In most cases, running Certbot
on your personal computer is not a useful option. The instructions below relate to installing and running Certbot on a
server.
System administrators can use Certbot directly to request certificates; they should not allow unprivileged users to
run arbitrary Certbot commands as root, because Certbot allows its user to specify arbitrary file locations and run
arbitrary scripts.
Certbot is packaged for many common operating systems and web servers. Check whether certbot (or
letsencrypt) is packaged for your web server’s OS by visiting certbot.eff.org, where you will also find the correct
installation instructions for your system.
Note: Unless you have very specific requirements, we kindly suggest that you use the Certbot packages pro-
vided by your package manager (see certbot.eff.org). If such packages are not available, we recommend using
certbot-auto, which automates the process of installing Certbot on your system.
5
Certbot Documentation, Release 1.4.0.dev0
Certbot currently requires Python 2.7 or 3.5+ running on a UNIX-like operating system. By default, it requires root
access in order to write to /etc/letsencrypt, /var/log/letsencrypt, /var/lib/letsencrypt; to
bind to port 80 (if you use the standalone plugin) and to read and modify webserver configurations (if you use the
apache or nginx plugins). If none of these apply to you, it is theoretically possible to run without root privileges,
but for most users who want to avoid running an ACME client as root, either letsencrypt-nosudo or simp_le are more
appropriate choices.
The Apache plugin currently requires an OS with augeas version 1.0; currently it supports modern OSes based on
Debian, Ubuntu, Fedora, SUSE, Gentoo and Darwin.
Additional integrity verification of certbot-auto script can be done by verifying its digital signature. This requires a
local installation of gpg2, which comes packaged in many Linux distributions under name gnupg or gnupg2.
Installing with certbot-auto requires 512MB of RAM in order to build some of the dependencies. Installing from
pre-built OS packages avoids this requirement. You can also temporarily set a swap file. See “Problems with Python
virtual environment” below for details.
If you are offline or your operating system doesn’t provide a package, you can use an alternate method for installing
certbot.
3.3.1 Certbot-Auto
The certbot-auto wrapper script installs Certbot, obtaining some dependencies from your web server OS and
putting others in a python virtual environment. You can download and run it as follows:
wget https://dl.eff.org/certbot-auto
sudo mv certbot-auto /usr/local/bin/certbot-auto
sudo chown root /usr/local/bin/certbot-auto
sudo chmod 0755 /usr/local/bin/certbot-auto
/usr/local/bin/certbot-auto --help
To remove certbot-auto, just delete it and the files it places under /opt/eff.org, along with any cronjob or systemd timer
you may have created.
To check the integrity of the certbot-auto script, you can use these steps:
The certbot-auto command updates to the latest client release automatically. Since certbot-auto is a wrap-
per to certbot, it accepts exactly the same command line flags and arguments. For more information, see Certbot
command-line options.
For full command line help, you can type:
On a low memory system such as VPS with less than 512MB of RAM, the required dependencies of Certbot will
fail to build. This can be identified if the pip outputs contains something like internal compiler error:
Killed (program cc1). You can workaround this restriction by creating a temporary swapfile:
Disable and remove the swapfile once the virtual environment is constructed:
Docker is an amazingly simple and quick way to obtain a certificate. However, this mode of operation is unable to
install certificates or configure your webserver, because our installer plugins cannot reach your webserver from inside
the Docker container.
Most users should use the operating system packages (see instructions at certbot.eff.org) or, as a fallback,
certbot-auto. You should only use Docker if you are sure you know what you are doing and have a good
reason to do so.
You should definitely read the Where are my certificates? section, in order to know how to manage the certs manually.
Our ciphersuites page provides some information about recommended ciphersuites. If none of these make much sense
to you, you should definitely use the certbot-auto method, which enables you to use installer plugins that cover both
of those hard topics.
If you’re still not convinced and have decided to use this method, from the server that the domain you’re requesting a
certficate for resolves to, install Docker, then issue a command like the one found below. If you are using Certbot with
the Standalone plugin, you will need to make the port it uses accessible from outside of the container by including
something like -p 80:80 or -p 443:443 on the command line before certbot/certbot.
Running Certbot with the certonly command will obtain a certificate and place it in the directory /etc/
letsencrypt/live on your system. Because Certonly cannot install the certificate from within Docker, you
must install the certificate manually according to the procedure recommended by the provider of your webserver.
There are also Docker images for each of Certbot’s DNS plugins available at https://hub.docker.com/u/certbot which
automate doing domain validation over DNS for popular providers. To use one, just replace certbot/certbot in
the command above with the name of the image you want to use. For example, to use Certbot’s plugin for Amazon
Route 53, you’d use certbot/dns-route53. You may also need to add flags to Certbot and/or mount additional
directories to provide access to your DNS API credentials as specified in the DNS plugin documentation. If you
would like to obtain a wildcard certificate from Let’s Encrypt’s ACMEv2 server, you’ll need to include --server
https://acme-v02.api.letsencrypt.org/directory on the command line as well.
For more information about the layout of the /etc/letsencrypt directory, see Where are my certificates?.
Arch Linux
Debian
If you run Debian Buster or Debian testing/Sid, you can easily install certbot packages through commands like:
If you run Debian Stretch, we recommend you use the packages in Debian backports repository. First you’ll have to
follow the instructions at https://backports.debian.org/Instructions/ to enable the Stretch backports repo, if you have
not already done so. Then run:
In all of these cases, there also packages available to help Certbot integrate with Apache, nginx, or various DNS
services. If you are using Apache or nginx, we strongly recommend that you install the python-certbot-apache
or python-certbot-nginx package so that Certbot can fully automate HTTPS configuration for your server. A
full list of these packages can be found through a command like:
They can be installed by running the same installation command above but replacing certbot with the name of the
desired package.
There are no Certbot packages available for Debian Jessie and Jessie users should instead use certbot-auto.
Ubuntu
If you run Ubuntu Trusty, Xenial, or Bionic, certbot is available through the official PPA, that can be installed as
followed:
Fedora
FreeBSD
• Port: cd /usr/ports/security/py-certbot && make install clean
• Package: pkg install py27-certbot
Gentoo
The official Certbot client is available in Gentoo Portage. If you want to use the Apache plugin, it has to be installed
separately:
When using the Apache plugin, you will run into a “cannot find an SSLCertificateFile directive” or “cannot find an
SSLCertificateKeyFile directive for certificate” error if you’re sporting the default Gentoo httpd.conf. You can fix
this by commenting out two lines in /etc/apache2/httpd.conf as follows:
Change
<IfDefine SSL>
LoadModule ssl_module modules/mod_ssl.so
</IfDefine>
to
#<IfDefine SSL>
LoadModule ssl_module modules/mod_ssl.so
#</IfDefine>
For the time being, this is the only way for the Apache plugin to recognise the appropriate directives when installing
the certificate. Note: this change is not required for the other plugins.
NetBSD
• Build from source: cd /usr/pkgsrc/security/py-certbot && make install clean
• Install pre-compiled package: pkg_add py27-certbot
OpenBSD
• Port: cd /usr/ports/security/letsencrypt/client && make install clean
• Package: pkg_add letsencrypt
Other Operating Systems
OS packaging is an ongoing effort. If you’d like to package Certbot for your distribution of choice please have a look
at the Packaging Guide.
Installation from source is only supported for developers and the whole process is described in the Developer Guide.
Warning: Please do not use python certbot/setup.py install, python pip install
certbot, or easy_install certbot. Please do not attempt the installation commands as superuser/root
and/or without virtual environment, e.g. sudo python certbot/setup.py install, sudo pip
install, sudo ./venv/bin/.... These modes of operation might corrupt your operating system and are
not supported by the Certbot team!
FOUR
USER GUIDE
Table of Contents
• Certbot Commands
• Getting certificates (and choosing plugins)
– Apache
– Webroot
– Nginx
– Standalone
– DNS Plugins
– Manual
– Combining plugins
– Third-party plugins
• Managing certificates
– Re-creating and Updating Existing Certificates
• Changing a Certificate’s Domains
– Revoking certificates
– Renewing certificates
– Modifying the Renewal Configuration File
– Automated Renewals
• Where are my certificates?
• Pre and Post Validation Hooks
• Changing the ACME Server
• Lock Files
• Configuration file
• Log Rotation
• Certbot command-line options
• Getting help
11
Certbot Documentation, Release 1.4.0.dev0
Certbot uses a number of different commands (also referred to as “subcommands”) to request specific actions such as
obtaining, renewing, or revoking certificates. The most important and commonly-used commands will be discussed
throughout this document; an exhaustive list also appears near the end of the document.
The certbot script on your web server might be named letsencrypt if your system uses an older package, or
certbot-auto if you used an alternate installation method. Throughout the docs, whenever you see certbot,
swap in the correct name as needed.
The Certbot client supports two types of plugins for obtaining and installing certificates: authenticators and installers.
Authenticators are plugins used with the certonly command to obtain a certificate. The authenticator validates that
you control the domain(s) you are requesting a certificate for, obtains a certificate for the specified domain(s), and
places the certificate in the /etc/letsencrypt directory on your machine. The authenticator does not install the
certificate (it does not edit any of your server’s configuration files to serve the obtained certificate). If you specify
multiple domains to authenticate, they will all be listed in a single certificate. To obtain multiple separate certificates
you will need to run Certbot multiple times.
Installers are Plugins used with the install command to install a certificate. These plugins can modify your web-
server’s configuration to serve your website over HTTPS using certificates obtained by certbot.
Plugins that do both can be used with the certbot run command, which is the default when no command is
specified. The run subcommand can also be used to specify a combination of distinct authenticator and installer
plugins.
Under the hood, plugins use one of several ACME protocol challenges to prove you control a domain. The options are
http-01 (which uses port 80) and dns-01 (requiring configuration of a DNS server on port 53, though that’s often not
the same machine as your webserver). A few plugins support more than one challenge type, in which case you can
choose one with --preferred-challenges.
There are also many third-party-plugins available. Below we describe in more detail the circumstances in which each
plugin can be used, and how to use it.
4.2.1 Apache
The Apache plugin currently supports modern OSes based on Debian, Fedora, SUSE, Gentoo and Darwin. This
automates both obtaining and installing certificates on an Apache webserver. To specify this plugin on the command
line, simply include --apache.
4.2.2 Webroot
If you’re running a local webserver for which you have the ability to modify the content being served, and you’d
prefer not to stop the webserver during the certificate issuance process, you can use the webroot plugin to obtain
a certificate by including certonly and --webroot on the command line. In addition, you’ll need to specify
--webroot-path or -w with the top-level directory (“web root”) containing the files served by your webserver.
For example, --webroot-path /var/www/html or --webroot-path /usr/share/nginx/html are
two common webroot paths.
If you’re getting a certificate for many domains at once, the plugin needs to know where each domain’s files are served
from, which could potentially be a separate directory for each domain. When requesting a certificate for multiple
domains, each domain will use the most recently specified --webroot-path. So, for instance,
would obtain a single certificate for all of those names, using the /var/www/example webroot directory for the
first two, and /var/www/other for the second two.
The webroot plugin works by creating a temporary file for each of your requested domains in ${webroot-path}/
.well-known/acme-challenge. Then the Let’s Encrypt validation server makes HTTP requests to validate
that the DNS for each requested domain resolves to the server running certbot. An example request made to your web
server would look like:
Note that to use the webroot plugin, your server must be configured to serve files from hidden directories. If /.
well-known is treated specially by your webserver configuration, you might need to modify the configuration to
ensure that files inside /.well-known/acme-challenge are served by the webserver.
4.2.3 Nginx
The Nginx plugin should work for most configurations. We recommend backing up Nginx configurations before using
it (though you can also revert changes to configurations with certbot --nginx rollback). You can use it by
providing the --nginx flag on the commandline.
certbot --nginx
4.2.4 Standalone
Use standalone mode to obtain a certificate if you don’t want to use (or don’t currently have) existing server software.
The standalone plugin does not rely on any other server software running on the machine where you obtain the
certificate.
To obtain a certificate using a “standalone” webserver, you can use the standalone plugin by including certonly and
--standalone on the command line. This plugin needs to bind to port 80 in order to perform domain validation,
so you may need to stop your existing webserver.
It must still be possible for your machine to accept inbound connections from the Internet on the specified port using
each requested domain name.
By default, Certbot first attempts to bind to the port for all interfaces using IPv6 and then bind to that port using IPv4;
Certbot continues so long as at least one bind succeeds. On most Linux systems, IPv4 traffic will be routed to the
bound IPv6 port and the failure during the second bind is expected.
Use --<challenge-type>-address to explicitly tell Certbot which interface (and protocol) to bind.
If you’d like to obtain a wildcard certificate from Let’s Encrypt or run certbot on a machine other than your target
webserver, you can use one of Certbot’s DNS plugins.
These plugins are not included in a default Certbot installation and must be installed separately. While the DNS
plugins cannot currently be used with certbot-auto, they are available in many OS package managers and as
Docker images. Visit https://certbot.eff.org to learn the best way to use the DNS plugins on your system.
Once installed, you can find documentation on how to use each plugin at:
• certbot-dns-cloudflare
• certbot-dns-cloudxns
• certbot-dns-digitalocean
• certbot-dns-dnsimple
• certbot-dns-dnsmadeeasy
• certbot-dns-google
• certbot-dns-linode
• certbot-dns-luadns
• certbot-dns-nsone
• certbot-dns-ovh
• certbot-dns-rfc2136
• certbot-dns-route53
4.2.6 Manual
If you’d like to obtain a certificate running certbot on a machine other than your target webserver or perform the
steps for domain validation yourself, you can use the manual plugin. While hidden from the UI, you can use the plugin
to obtain a certificate by specifying certonly and --manual on the command line. This requires you to copy and
paste commands into another terminal session, which may be on a different computer.
The manual plugin can use either the http or the dns challenge. You can use the --preferred-challenges
option to choose the challenge of your preference.
The http challenge will ask you to place a file with a specific name and specific content in the /.well-known/
acme-challenge/ directory directly in the top-level directory (“web root”) containing the files served by your
webserver. In essence it’s the same as the webroot plugin, but not automated.
When using the dns challenge, certbot will ask you to place a TXT DNS record with specific contents under the
domain name consisting of the hostname for which you want a certificate issued, prepended by _acme-challenge.
For example, for the domain example.com, a zone file entry would look like:
Additionally you can specify scripts to prepare for validation and perform the authentication procedure and/or clean
up after it by using the --manual-auth-hook and --manual-cleanup-hook flags. This is described in more
depth in the hooks section.
Sometimes you may want to specify a combination of distinct authenticator and installer plugins. To do so, specify
the authenticator plugin with --authenticator or -a and the installer plugin with --installer or -i.
For instance, you could create a certificate using the webroot plugin for authentication and the apache plugin for
installation.
Or you could create a certificate using the manual plugin for authentication and the nginx plugin for installation. (Note
that this certificate cannot be renewed automatically.)
There are also a number of third-party plugins for the client, provided by other developers. Many are
beta/experimental, but some are already in widespread use:
To view a list of the certificates Certbot knows about, run the certificates subcommand:
certbot certificates
This returns information in the following format:
Certificate Name shows the name of the certificate. Pass this name using the --cert-name flag to specify a
particular certificate for the run, certonly, certificates, renew, and delete commands. Example:
You can use certonly or run subcommands to request the creation of a single new certificate even if you already
have an existing certificate with some of the same domain names.
If a certificate is requested with run or certonly specifying a certificate name that already exists, Certbot updates
the existing certificate. Otherwise a new certificate is created and assigned the specified name.
The --force-renewal, --duplicate, and --expand options control Certbot’s behavior when re-creating a
certificate with the same name as an existing certificate. If you don’t specify a requested behavior, Certbot may ask
you what you intended.
--force-renewal tells Certbot to request a new certificate with the same domains as an existing certificate. Each
domain must be explicitly specified via -d. If successful, this certificate is saved alongside the earlier one and symbolic
links (the “live” reference) will be updated to point to the new certificate. This is a valid method of renewing a
specific individual certificate.
--duplicate tells Certbot to create a separate, unrelated certificate with the same domains as an existing certificate.
This certificate is saved completely separately from the prior one. Most users will not need to issue this command in
normal circumstances.
--expand tells Certbot to update an existing certificate with a new certificate that contains all of the old domains and
one or more additional new domains. With the --expand option, use the -d option to specify all existing domains
and one or more new domains.
Example:
If you prefer, you can specify the domains individually like this:
Consider using --cert-name instead of --expand, as it gives more control over which certificate is modified and
it lets you remove domains as well as adding them.
--allow-subset-of-names tells Certbot to continue with certificate generation if only some of the specified
domain authorizations can be obtained. This may be useful if some domains specified in a certificate no longer point
at this system.
Whenever you obtain a new certificate in any of these ways, the new certificate exists alongside any previously obtained
certificates, whether or not the previous certificates have expired. The generation of a new certificate counts against
several rate limits that are intended to prevent abuse of the ACME protocol, as described here.
The --cert-name flag can also be used to modify the domains a certificate contains, by specifying new domains
using the -d or --domains flag. If certificate example.com previously contained example.com and www.
example.com, it can be modified to only contain example.com by specifying only example.com with the -d
or --domains flag. Example:
The same format can be used to expand the set of domains a certificate contains, or to replace that set entirely:
If your account key has been compromised or you otherwise need to revoke a certificate, use the revoke command
to do so. Note that the revoke command takes the certificate path (ending in cert.pem), not a certificate name or
domain. Example:
You can also specify the reason for revoking your certificate by using the reason flag. Reasons include
unspecified which is the default, as well as keycompromise, affiliationchanged, superseded, and
cessationofoperation:
Additionally, if a certificate is a test certificate obtained via the --staging or --test-cert flag, that flag must
be passed to the revoke subcommand. Once a certificate is revoked (or for other certificate management tasks), all
of a certificate’s relevant files can be removed from the system with the delete subcommand:
Note: If you don’t use delete to remove the certificate completely, it will be renewed automatically at the next
renewal event.
Note: Revoking a certificate will have no effect on the rate limit imposed by the Let’s Encrypt server.
Note: Let’s Encrypt CA issues short-lived certificates (90 days). Make sure you renew the certificates at least once in
3 months.
See also:
Many of the certbot clients obtained through a distribution come with automatic renewal out of the box, such as Debian
and Ubuntu versions installed through apt, CentOS/RHEL 7 through EPEL, etc. See Automated Renewals for more
details.
As of version 0.10.0, Certbot supports a renew action to check all installed certificates for impending expiry and
attempt to renew them. The simplest form is simply
certbot renew
This command attempts to renew any previously-obtained certificates that expire in less than 30 days. The same plugin
and options that were used at the time the certificate was originally issued will be used for the renewal attempt, unless
you specify other plugins or options. Unlike certonly, renew acts on multiple certificates and always takes into
account whether each one is near expiry. Because of this, renew is suitable (and designed) for automated use, to
allow your system to automatically renew each certificate when appropriate. Since renew only renews certificates
that are near expiry it can be run as frequently as you want - since it will usually take no action.
The renew command includes hooks for running commands or scripts before or after a certificate is renewed. For
example, if you have a single certificate obtained using the standalone plugin, you might need to stop the webserver
before renewing so standalone can bind to the necessary ports, and then restart it after the plugin is finished. Example:
certbot renew --pre-hook "service nginx stop" --post-hook "service nginx start"
If a hook exits with a non-zero exit code, the error will be printed to stderr but renewal will be attempted anyway. A
failing hook doesn’t directly cause Certbot to exit with a non-zero exit code, but since Certbot exits with a non-zero exit
code when renewals fail, a failed hook causing renewal failures will indirectly result in a non-zero exit code. Hooks
will only be run if a certificate is due for renewal, so you can run the above command frequently without unnecessarily
stopping your webserver.
When Certbot detects that a certificate is due for renewal, --pre-hook and --post-hook hooks run before and
after each attempt to renew it. If you want your hook to run only after a successful renewal, use --deploy-hook in
a command like this.
certbot renew --deploy-hook /path/to/deploy-hook-script
You can also specify hooks by placing files in subdirectories of Certbot’s configuration directory. Assuming
your configuration directory is /etc/letsencrypt, any executable files found in /etc/letsencrypt/
renewal-hooks/pre, /etc/letsencrypt/renewal-hooks/deploy, and /etc/letsencrypt/
renewal-hooks/post will be run as pre, deploy, and post hooks respectively when any certificate is renewed
with the renew subcommand. These hooks are run in alphabetical order and are not run for other subcommands.
(The order the hooks are run is determined by the byte value of the characters in their filenames and is not dependent
on your locale.)
Hooks specified in the command line, configuration file, or renewal configuration files are run as usual after running
all hooks in these directories. One minor exception to this is if a hook specified elsewhere is simply the path to
an executable file in the hook directory of the same type (e.g. your pre-hook is the path to an executable in /etc/
letsencrypt/renewal-hooks/pre), the file is not run a second time. You can stop Certbot from automatically
running executables found in these directories by including --no-directory-hooks on the command line.
More information about hooks can be found by running certbot --help renew.
If you’re sure that this command executes successfully without human intervention, you can add the command to
crontab (since certificates are only renewed when they’re determined to be near expiry, the command can run on a
regular basis, like every week or every day). In that case, you are likely to want to use the -q or --quiet quiet flag
to silence all output except errors.
If you are manually renewing all of your certificates, the --force-renewal flag may be helpful; it causes the
expiration time of the certificate(s) to be ignored when considering renewal, and attempts to renew each and every
installed certificate regardless of its age. (This form is not appropriate to run daily because each certificate will be
renewed every day, which will quickly run into the certificate authority rate limit.)
Note that options provided to certbot renew will apply to every certificate for which renewal is attempted; for
example, certbot renew --rsa-key-size 4096 would try to replace every near-expiry certificate with an
equivalent certificate using a 4096-bit RSA public key. If a certificate is successfully renewed using specified options,
those options will be saved and used for future renewals of that certificate.
An alternative form that provides for more fine-grained control over the renewal process (while renewing specified
certificates one at a time), is certbot certonly with the complete set of subject domains of a specific certificate
specified via -d flags. You may also want to include the -n or --noninteractive flag to prevent blocking on
user input (which is useful when running the command from cron).
certbot certonly -n -d example.com -d www.example.com
All of the domains covered by the certificate must be specified in this case in order to renew and replace the old
certificate rather than obtaining a new one; don’t forget any www. domains! Specifying a subset of the domains
creates a new, separate certificate containing only those domains, rather than replacing the original certificate. When
run with a set of domains corresponding to an existing certificate, the certonly command attempts to renew that
specific certificate.
Please note that the CA will send notification emails to the address you provide if you do not renew certificates that
are about to expire.
Certbot is working hard to improve the renewal process, and we apologize for any inconvenience you encounter in
integrating these commands into your individual environment.
Note: certbot renew exit status will only be 1 if a renewal attempt failed. This means certbot renew exit
status will be 0 if no certificate needs to be updated. If you write a custom script and expect to run a command only
after a certificate was actually renewed you will need to use the --deploy-hook since the exit status will be 0 both
on successful renewal and when renewal is not necessary.
When a certificate is issued, by default Certbot creates a renewal configuration file that tracks the options that were
selected when Certbot was run. This allows Certbot to use those same options again when it comes time for renewal.
These renewal configuration files are located at /etc/letsencrypt/renewal/CERTNAME.
For advanced certificate management tasks, it is possible to manually modify the certificate’s renewal configuration
file, but this is discouraged since it can easily break Certbot’s ability to renew your certificates. If you choose to modify
the renewal configuration file we advise you to test its validity with the certbot renew --dry-run command.
Warning: Modifying any files in /etc/letsencrypt can damage them so Certbot can no longer properly
manage its certificates, and we do not recommend doing so.
For most tasks, it is safest to limit yourself to pointing symlinks at the files there, or using --deploy-hook to copy
/ make new files based upon those files, if your operational situation requires it (for instance, combining certificates
and keys in different way, or having copies of things with different specific permissions that are demanded by other
programs).
If the contents of /etc/letsencrypt/archive/CERTNAME are moved to a new folder, first specify the new
folder’s name in the renewal configuration file, then run certbot update_symlinks to point the symlinks in
/etc/letsencrypt/live/CERTNAME to the new folder.
If you would like the live certificate files whose symlink location Certbot updates on each run to reside in a dif-
ferent location, first move them to that location, then specify the full path of each of the four files in the renewal
configuration file. Since the symlinks are relative links, you must follow this with an invocation of certbot
update_symlinks.
For example, say that a certificate’s renewal configuration file previously contained the following directives:
archive_dir = /etc/letsencrypt/archive/example.com
cert = /etc/letsencrypt/live/example.com/cert.pem
privkey = /etc/letsencrypt/live/example.com/privkey.pem
chain = /etc/letsencrypt/live/example.com/chain.pem
fullchain = /etc/letsencrypt/live/example.com/fullchain.pem
The following commands could be used to specify where these files are located:
mv /etc/letsencrypt/archive/example.com /home/user/me/certbot/example_archive
sed -i 's,/etc/letsencrypt/archive/example.com,/home/user/me/certbot/example_archive,
˓→' /etc/letsencrypt/renewal/example.com.conf
mv /etc/letsencrypt/live/example.com/*.pem /home/user/me/certbot/
sed -i 's,/etc/letsencrypt/live/example.com,/home/user/me/certbot,g' /etc/letsencrypt/
˓→renewal/example.com.conf
certbot update_symlinks
Many Linux distributions provide automated renewal when you use the packages installed through their system pack-
age manager. The following table is an incomplete list of distributions which do so, as well as their methods for doing
so.
If you are not sure whether or not your system has this already automated, refer to your distribution’s documenta-
tion, or check your system’s crontab (typically in /etc/crontab/ and /etc/cron.*/* and systemd timers
(systemctl list-timers).
All generated keys and issued certificates can be found in /etc/letsencrypt/live/$domain. In the case of
creating a SAN certificate with multiple alternative names, $domain is the first domain passed in via -d parameter.
Rather than copying, please point your (web) server configuration directly to those files (or create symlinks). During
the renewal, /etc/letsencrypt/live is updated with the latest necessary files.
For historical reasons, the containing directories are created with permissions of 0700 meaning that certificates are
accessible only to servers that run as the root user. If you will never downgrade to an older version of Certbot, then
you can safely fix this using chmod 0755 /etc/letsencrypt/{live,archive}.
For servers that drop root privileges before attempting to read the private key file, you will also need to use chgrp
and chmod 0640 to allow the server to read /etc/letsencrypt/live/$domain/privkey.pem.
Note: /etc/letsencrypt/archive and /etc/letsencrypt/keys contain all previous keys and certifi-
cates, while /etc/letsencrypt/live symlinks to the latest versions.
Warning: This must be kept secret at all times! Never share it with anyone, including Certbot developers.
You cannot put it into a safe, however - your server still needs to access this file in order for SSL/TLS to
work.
Note: As of Certbot version 0.29.0, private keys for new certificate default to 0600. Any changes to the group
mode or group owner (gid) of this file will be preserved on renewals.
This is what Apache needs for SSLCertificateKeyFile, and Nginx for ssl_certificate_key.
fullchain.pem All certificates, including server certificate (aka leaf certificate or end-entity certificate). The
server certificate is the first one in this file, followed by any intermediates.
This is what Apache >= 2.4.8 needs for SSLCertificateFile, and what Nginx needs for ssl_certificate.
cert.pem and chain.pem (less common) cert.pem contains the server certificate by itself, and chain.pem
contains the additional intermediate certificate or certificates that web browsers will need in order to validate the
server certificate. If you provide one of these files to your web server, you must provide both of them, or some
browsers will show “This Connection is Untrusted” errors for your site, some of the time.
Apache < 2.4.8 needs these for SSLCertificateFile. and SSLCertificateChainFile, respectively.
If you’re using OCSP stapling with Nginx >= 1.3.7, chain.pem should be provided as the
ssl_trusted_certificate to validate OCSP responses.
Note: All files are PEM-encoded. If you need other format, such as DER or PFX, then you could convert using
openssl. You can automate that with --deploy-hook if you’re using automatic renewal.
Certbot allows for the specification of pre and post validation hooks when run in manual mode. The flags to spec-
ify these scripts are --manual-auth-hook and --manual-cleanup-hook respectively and can be used as
follows:
certbot certonly --manual --manual-auth-hook /path/to/http/authenticator.sh --manual-
˓→cleanup-hook /path/to/http/cleanup.sh -d secure.example.com
This will run the authenticator.sh script, attempt the validation, and then run the cleanup.sh script. Addi-
tionally certbot will pass relevant environment variables to these scripts:
• CERTBOT_DOMAIN: The domain being authenticated
• CERTBOT_VALIDATION: The validation string (HTTP-01 and DNS-01 only)
• CERTBOT_TOKEN: Resource name part of the HTTP-01 challenge (HTTP-01 only)
Additionally for cleanup:
• CERTBOT_AUTH_OUTPUT: Whatever the auth script wrote to stdout
Example usage for HTTP-01:
certbot certonly --manual --preferred-challenges=http --manual-auth-hook /path/to/
˓→http/authenticator.sh --manual-cleanup-hook /path/to/http/cleanup.sh -d secure.
˓→example.com
/path/to/http/authenticator.sh
#!/bin/bash
echo $CERTBOT_VALIDATION > /var/www/htdocs/.well-known/acme-challenge/$CERTBOT_TOKEN
/path/to/http/cleanup.sh
#!/bin/bash
rm -f /var/www/htdocs/.well-known/acme-challenge/$CERTBOT_TOKEN
Example usage for DNS-01 (Cloudflare API v4) (for example purposes only, do not use as-is)
certbot certonly --manual --preferred-challenges=dns --manual-auth-hook /path/to/dns/
˓→authenticator.sh --manual-cleanup-hook /path/to/dns/cleanup.sh -d secure.example.com
/path/to/dns/authenticator.sh
#!/bin/bash
-H "X-Auth-Email: $EMAIL" \
-H "X-Auth-Key: $API_KEY" \
-H "Content-Type: application/json" \
--data '{"type":"TXT","name":"'"$CREATE_DOMAIN"'","content":"'"$CERTBOT_
˓→VALIDATION"'","ttl":120}' \
# Sleep to make sure the change has time to propagate over to DNS
sleep 25
/path/to/dns/cleanup.sh
#!/bin/bash
if [ -f /tmp/CERTBOT_$CERTBOT_DOMAIN/ZONE_ID ]; then
ZONE_ID=$(cat /tmp/CERTBOT_$CERTBOT_DOMAIN/ZONE_ID)
rm -f /tmp/CERTBOT_$CERTBOT_DOMAIN/ZONE_ID
fi
if [ -f /tmp/CERTBOT_$CERTBOT_DOMAIN/RECORD_ID ]; then
RECORD_ID=$(cat /tmp/CERTBOT_$CERTBOT_DOMAIN/RECORD_ID)
rm -f /tmp/CERTBOT_$CERTBOT_DOMAIN/RECORD_ID
fi
-H "X-Auth-Email: $EMAIL" \
-H "X-Auth-Key: $API_KEY" \
-H "Content-Type: application/json"
fi
fi
By default, Certbot uses Let’s Encrypt’s initial production server at https://acme-v01.api.letsencrypt.org/. You can tell
Certbot to use a different CA by providing --server on the command line or in a configuration file with the URL of
the server’s ACME directory. For example, if you would like to use Let’s Encrypt’s new ACMEv2 server, you would
add --server https://acme-v02.api.letsencrypt.org/directory to the command line. Certbot
will automatically select which version of the ACME protocol to use based on the contents served at the provided
URL.
If you use --server to specify an ACME CA that implements a newer version of the spec, you may be able to obtain
a certificate for a wildcard domain. Some CAs (such as Let’s Encrypt) require that domain validation for wildcard
domains must be done through modifications to DNS records which means that the dns-01 challenge type must be
used. To see a list of Certbot plugins that support this challenge type and how to use them, see plugins.
When processing a validation Certbot writes a number of lock files on your system to prevent multiple instances from
overwriting each other’s changes. This means that by default two instances of Certbot will not be able to run in parallel.
Since the directories used by Certbot are configurable, Certbot will write a lock file for all of the directories it uses.
This include Certbot’s --work-dir, --logs-dir, and --config-dir. By default these are /var/lib/
letsencrypt, /var/log/letsencrypt, and /etc/letsencrypt respectively. Additionally if you are
using Certbot with Apache or nginx it will lock the configuration folder for that program, which are typically also in
the /etc directory.
Note that these lock files will only prevent other instances of Certbot from using those directories, not other pro-
cesses. If you’d like to run multiple instances of Certbot simultaneously you should specify different directories as the
--work-dir, --logs-dir, and --config-dir for each instance of Certbot that you would like to run.
Certbot accepts a global configuration file that applies its options to all invocations of Certbot. Certificate specific
configuration choices should be set in the .conf files that can be found in /etc/letsencrypt/renewal.
By default no cli.ini file is created (though it may exist already if you installed Certbot via a package manager, for
instance). After creating one it is possible to specify the location of this configuration file with certbot --config
cli.ini (or shorter -c cli.ini). An example configuration file is shown below:
# This is an example of the kind of things you can do in a configuration file.
# All flags used by the client can be configured here. Run Certbot with
# "--help" to learn more about the available options.
#
# Note that these options apply automatically to all use of Certbot for
# obtaining or renewing certificates, so options specific to a single
# certificate on a system with several certificates should not be placed
# here.
By default certbot stores status logs in /var/log/letsencrypt. By default certbot will begin rotating logs once
there are 1000 logs in the log directory. Meaning that once 1000 files are in /var/log/letsencrypt Certbot
will delete the oldest one to make room for new logs. The number of subsequent logs can be changed by passing the
desired number to the command line flag --max-log-backups.
Note: Some distributions, including Debian and Ubuntu, disable certbot’s internal log rotation in favor of a more
traditional logrotate script. If you are using a distribution’s packages and want to alter the log rotation, check /etc/
logrotate.d/ for a certbot rotation script.
Certbot supports a lot of command line options. Here’s the full list, from certbot --help all:
usage:
certbot [SUBCOMMAND] [options] [-d DOMAIN] [-d DOMAIN] ...
-n Run non-interactively
--test-cert Obtain a test certificate from a staging server
--dry-run Test "renew" or "certonly" without saving any certificates to disk
manage certificates:
certificates Display information about certificates you have from Certbot
revoke Revoke a certificate (supply --cert-name or --cert-path)
delete Delete a certificate (supply --cert-name)
optional arguments:
-h, --help show this help message and exit
-c CONFIG_FILE, --config CONFIG_FILE
path to config file (default: /etc/letsencrypt/cli.ini
and ~/.config/letsencrypt/cli.ini)
-v, --verbose This flag can be used multiple times to incrementally
increase the verbosity of output, e.g. -vvv. (default:
-2)
--max-log-backups MAX_LOG_BACKUPS
Specifies the maximum number of backup logs that
should be kept by Certbot's built in log rotation.
Setting this flag to 0 disables log rotation entirely,
causing Certbot to always append to the same log file.
(default: 1000)
-n, --non-interactive, --noninteractive
Run without ever asking for user input. This may
require additional command line flags; the client will
try to explain which ones are required if it finds one
missing (default: False)
--force-interactive Force Certbot to be interactive even if it detects
it's not being run in a terminal. This flag cannot be
used with the renew subcommand. (default: False)
-d DOMAIN, --domains DOMAIN, --domain DOMAIN
Domain names to apply. For multiple domains you can
use multiple -d flags or enter a comma separated list
of domains as a parameter. The first domain provided
will be the subject CN of the certificate, and all
domains will be Subject Alternative Names on the
certificate. The first domain will also be used in
some software user interfaces and as the file paths
for the certificate and related material unless
otherwise specified or you already have a certificate
with the same name. In the case of a name collision it
will append a number like 0001 to the file path name.
(default: Ask)
--eab-kid EAB_KID Key Identifier for External Account Binding (default:
None)
(continues on next page)
automation:
Flags for automating execution & other tweaks
(continues on next page)
security:
Security parameters & server settings
testing:
The following flags are meant for testing and integration purposes only.
--test-cert, --staging
Use the staging server to obtain or revoke test
(invalid) certificates; equivalent to --server https
://acme-staging-v02.api.letsencrypt.org/directory
(default: False)
--debug Show tracebacks in case of errors, and allow certbot-
auto execution on experimental platforms (default:
False)
--no-verify-ssl Disable verification of the ACME server's certificate.
(default: False)
--http-01-port HTTP01_PORT
Port used in the http-01 challenge. This only affects
the port Certbot listens on. A conforming ACME server
will still attempt to connect on port 80. (default:
80)
--http-01-address HTTP01_ADDRESS
The address the server listens to during http-01
challenge. (default: )
--https-port HTTPS_PORT
Port used to serve HTTPS. This affects which port
Nginx will listen on after a LE certificate is
installed. (default: 443)
--break-my-certs Be willing to replace or renew valid certificates with
invalid (testing/staging) certificates (default:
False)
paths:
Flags for changing execution paths & servers
--cert-path CERT_PATH
Path to where certificate is saved (with auth --csr),
(continues on next page)
manage:
Various subcommands and flags are available for managing your
certificates:
run:
Options for obtaining & installing certificates
certonly:
Options for modifying how a certificate is obtained
renew:
The 'renew' subcommand will attempt to renew all certificates (or more
precisely, certificate lineages) you have previously obtained if they are
close to expiry, and print a summary of the results. By default, 'renew'
will reuse the options used to create obtain or most recently successfully
renew each certificate lineage. You can try it with `--dry-run` first. For
more fine-grained control, you can renew individual lineages with the
`certonly` subcommand. Hooks are available to run commands before and
after renewal; see https://certbot.eff.org/docs/using.html#renewal for
more information on these.
certificates:
List certificates managed by Certbot
delete:
Options for deleting a certificate
revoke:
Options for revocation of certificates
--reason {unspecified,keycompromise,affiliationchanged,superseded,
˓→ cessationofoperation}
Specify reason for revoking certificate. (default:
unspecified)
--delete-after-revoke
Delete certificates after revoking them, along with
all previous and later versions of those certificates.
(default: None)
--no-delete-after-revoke
(continues on next page)
register:
Options for account registration
--register-unsafely-without-email
Specifying this flag enables registering an account
with no email address. This is strongly discouraged,
because in the event of key loss or account compromise
you will irrevocably lose access to your account. You
will also be unable to receive notice about impending
expiration or revocation of your certificates. Updates
to the Subscriber Agreement will still affect you, and
will be effective 14 days after posting an update to
the web site. (default: False)
-m EMAIL, --email EMAIL
Email used for registration and recovery contact. Use
comma to register multiple emails, ex:
[email protected],[email protected]. (default: Ask).
--eff-email Share your e-mail address with EFF (default: None)
--no-eff-email Don't share your e-mail address with EFF (default:
None)
update_account:
Options for account modification
unregister:
Options for account deactivation.
install:
Options for modifying how a certificate is deployed
rollback:
Options for rolling back server configuration changes
plugins:
Options for the "plugins" subcommand
update_symlinks:
Recreates certificate and key symlinks in /etc/letsencrypt/live, if you
changed them by hand or edited a renewal configuration file
enhance:
Helps to harden the TLS configuration by adding security enhancements to
(continues on next page)
plugins:
Plugin Selection: Certbot client supports an extensible plugins
architecture. See 'certbot plugins' for a list of all installed plugins
and their names. You can force a particular plugin by setting options
provided below. Running --help <plugin_name> will list flags specific to
that plugin.
--configurator CONFIGURATOR
Name of the plugin that is both an authenticator and
an installer. Should not be used together with
--authenticator or --installer. (default: Ask)
-a AUTHENTICATOR, --authenticator AUTHENTICATOR
Authenticator plugin name. (default: None)
-i INSTALLER, --installer INSTALLER
Installer plugin name (also used to find domains).
(default: None)
--apache Obtain and install certificates using Apache (default:
False)
--nginx Obtain and install certificates using Nginx (default:
False)
--standalone Obtain certificates using a "standalone" webserver.
(default: False)
--manual Provide laborious manual instructions for obtaining a
certificate (default: False)
--webroot Obtain certificates by placing files in a webroot
directory. (default: False)
--dns-cloudflare Obtain certificates using a DNS TXT record (if you are
using Cloudflare for DNS). (default: False)
--dns-cloudxns Obtain certificates using a DNS TXT record (if you are
using CloudXNS for DNS). (default: False)
--dns-digitalocean Obtain certificates using a DNS TXT record (if you are
using DigitalOcean for DNS). (default: False)
--dns-dnsimple Obtain certificates using a DNS TXT record (if you are
using DNSimple for DNS). (default: False)
--dns-dnsmadeeasy Obtain certificates using a DNS TXT record (if you are
using DNS Made Easy for DNS). (default: False)
--dns-gehirn Obtain certificates using a DNS TXT record (if you are
using Gehirn Infrastructure Service for DNS).
(default: False)
--dns-google Obtain certificates using a DNS TXT record (if you are
using Google Cloud DNS). (default: False)
--dns-linode Obtain certificates using a DNS TXT record (if you are
using Linode for DNS). (default: False)
--dns-luadns Obtain certificates using a DNS TXT record (if you are
using LuaDNS for DNS). (default: False)
--dns-nsone Obtain certificates using a DNS TXT record (if you are
using NS1 for DNS). (default: False)
--dns-ovh Obtain certificates using a DNS TXT record (if you are
using OVH for DNS). (default: False)
--dns-rfc2136 Obtain certificates using a DNS TXT record (if you are
using BIND for DNS). (default: False)
--dns-route53 Obtain certificates using a DNS TXT record (if you are
using Route53 for DNS). (default: False)
--dns-sakuracloud Obtain certificates using a DNS TXT record (if you are
using Sakura Cloud for DNS). (default: False)
(continues on next page)
apache:
Apache Web Server plugin (Please note that the default values of the
Apache plugin options change depending on the operating system Certbot is
run on.)
--apache-enmod APACHE_ENMOD
Path to the Apache 'a2enmod' binary (default: None)
--apache-dismod APACHE_DISMOD
Path to the Apache 'a2dismod' binary (default: None)
--apache-le-vhost-ext APACHE_LE_VHOST_EXT
SSL vhost configuration extension (default: -le-
ssl.conf)
--apache-server-root APACHE_SERVER_ROOT
Apache server root directory (default: /etc/apache2)
--apache-vhost-root APACHE_VHOST_ROOT
Apache server VirtualHost configuration root (default:
None)
--apache-logs-root APACHE_LOGS_ROOT
Apache server logs directory (default:
/var/log/apache2)
--apache-challenge-location APACHE_CHALLENGE_LOCATION
Directory path for challenge configuration (default:
/etc/apache2)
--apache-handle-modules APACHE_HANDLE_MODULES
Let installer handle enabling required modules for you
(Only Ubuntu/Debian currently) (default: False)
--apache-handle-sites APACHE_HANDLE_SITES
Let installer handle enabling sites for you (Only
Ubuntu/Debian currently) (default: False)
--apache-ctl APACHE_CTL
Full path to Apache control script (default:
apache2ctl)
dns-cloudflare:
Obtain certificates using a DNS TXT record (if you are using Cloudflare
for DNS).
--dns-cloudflare-propagation-seconds DNS_CLOUDFLARE_PROPAGATION_SECONDS
The number of seconds to wait for DNS to propagate
before asking the ACME server to verify the DNS
record. (default: 10)
--dns-cloudflare-credentials DNS_CLOUDFLARE_CREDENTIALS
Cloudflare credentials INI file. (default: None)
dns-cloudxns:
Obtain certificates using a DNS TXT record (if you are using CloudXNS for
DNS).
--dns-cloudxns-propagation-seconds DNS_CLOUDXNS_PROPAGATION_SECONDS
The number of seconds to wait for DNS to propagate
before asking the ACME server to verify the DNS
record. (default: 30)
--dns-cloudxns-credentials DNS_CLOUDXNS_CREDENTIALS
CloudXNS credentials INI file. (default: None)
dns-digitalocean:
(continues on next page)
--dns-digitalocean-propagation-seconds DNS_DIGITALOCEAN_PROPAGATION_SECONDS
The number of seconds to wait for DNS to propagate
before asking the ACME server to verify the DNS
record. (default: 10)
--dns-digitalocean-credentials DNS_DIGITALOCEAN_CREDENTIALS
DigitalOcean credentials INI file. (default: None)
dns-dnsimple:
Obtain certificates using a DNS TXT record (if you are using DNSimple for
DNS).
--dns-dnsimple-propagation-seconds DNS_DNSIMPLE_PROPAGATION_SECONDS
The number of seconds to wait for DNS to propagate
before asking the ACME server to verify the DNS
record. (default: 30)
--dns-dnsimple-credentials DNS_DNSIMPLE_CREDENTIALS
DNSimple credentials INI file. (default: None)
dns-dnsmadeeasy:
Obtain certificates using a DNS TXT record (if you are using DNS Made Easy
for DNS).
--dns-dnsmadeeasy-propagation-seconds DNS_DNSMADEEASY_PROPAGATION_SECONDS
The number of seconds to wait for DNS to propagate
before asking the ACME server to verify the DNS
record. (default: 60)
--dns-dnsmadeeasy-credentials DNS_DNSMADEEASY_CREDENTIALS
DNS Made Easy credentials INI file. (default: None)
dns-gehirn:
Obtain certificates using a DNS TXT record (if you are using Gehirn
Infrastructure Service for DNS).
--dns-gehirn-propagation-seconds DNS_GEHIRN_PROPAGATION_SECONDS
The number of seconds to wait for DNS to propagate
before asking the ACME server to verify the DNS
record. (default: 30)
--dns-gehirn-credentials DNS_GEHIRN_CREDENTIALS
Gehirn Infrastructure Service credentials file.
(default: None)
dns-google:
Obtain certificates using a DNS TXT record (if you are using Google Cloud
DNS for DNS).
--dns-google-propagation-seconds DNS_GOOGLE_PROPAGATION_SECONDS
The number of seconds to wait for DNS to propagate
before asking the ACME server to verify the DNS
record. (default: 60)
--dns-google-credentials DNS_GOOGLE_CREDENTIALS
Path to Google Cloud DNS service account JSON file.
(See https://developers.google.com/identity/protocols/
OAuth2ServiceAccount#creatinganaccount forinformation
about creating a service account and
(continues on next page)
dns-linode:
Obtain certs using a DNS TXT record (if you are using Linode for DNS).
--dns-linode-propagation-seconds DNS_LINODE_PROPAGATION_SECONDS
The number of seconds to wait for DNS to propagate
before asking the ACME server to verify the DNS
record. (default: 1200)
--dns-linode-credentials DNS_LINODE_CREDENTIALS
Linode credentials INI file. (default: None)
dns-luadns:
Obtain certificates using a DNS TXT record (if you are using LuaDNS for
DNS).
--dns-luadns-propagation-seconds DNS_LUADNS_PROPAGATION_SECONDS
The number of seconds to wait for DNS to propagate
before asking the ACME server to verify the DNS
record. (default: 30)
--dns-luadns-credentials DNS_LUADNS_CREDENTIALS
LuaDNS credentials INI file. (default: None)
dns-nsone:
Obtain certificates using a DNS TXT record (if you are using NS1 for DNS).
--dns-nsone-propagation-seconds DNS_NSONE_PROPAGATION_SECONDS
The number of seconds to wait for DNS to propagate
before asking the ACME server to verify the DNS
record. (default: 30)
--dns-nsone-credentials DNS_NSONE_CREDENTIALS
NS1 credentials file. (default: None)
dns-ovh:
Obtain certificates using a DNS TXT record (if you are using OVH for DNS).
--dns-ovh-propagation-seconds DNS_OVH_PROPAGATION_SECONDS
The number of seconds to wait for DNS to propagate
before asking the ACME server to verify the DNS
record. (default: 30)
--dns-ovh-credentials DNS_OVH_CREDENTIALS
OVH credentials INI file. (default: None)
dns-rfc2136:
Obtain certificates using a DNS TXT record (if you are using BIND for
DNS).
--dns-rfc2136-propagation-seconds DNS_RFC2136_PROPAGATION_SECONDS
The number of seconds to wait for DNS to propagate
before asking the ACME server to verify the DNS
record. (default: 60)
--dns-rfc2136-credentials DNS_RFC2136_CREDENTIALS
RFC 2136 credentials INI file. (default: None)
dns-route53:
(continues on next page)
--dns-route53-propagation-seconds DNS_ROUTE53_PROPAGATION_SECONDS
The number of seconds to wait for DNS to propagate
before asking the ACME server to verify the DNS
record. (default: 10)
dns-sakuracloud:
Obtain certificates using a DNS TXT record (if you are using Sakura Cloud
for DNS).
--dns-sakuracloud-propagation-seconds DNS_SAKURACLOUD_PROPAGATION_SECONDS
The number of seconds to wait for DNS to propagate
before asking the ACME server to verify the DNS
record. (default: 90)
--dns-sakuracloud-credentials DNS_SAKURACLOUD_CREDENTIALS
Sakura Cloud credentials file. (default: None)
manual:
Authenticate through manual configuration or custom shell scripts. When
using shell scripts, an authenticator script must be provided. The
environment variables available to this script depend on the type of
challenge. $CERTBOT_DOMAIN will always contain the domain being
authenticated. For HTTP-01 and DNS-01, $CERTBOT_VALIDATION is the
validation string, and $CERTBOT_TOKEN is the filename of the resource
requested when performing an HTTP-01 challenge. An additional cleanup
script can also be provided and can use the additional variable
$CERTBOT_AUTH_OUTPUT which contains the stdout output from the auth
script.
--manual-auth-hook MANUAL_AUTH_HOOK
Path or command to execute for the authentication
script (default: None)
--manual-cleanup-hook MANUAL_CLEANUP_HOOK
Path or command to execute for the cleanup script
(default: None)
--manual-public-ip-logging-ok
Automatically allows public IP logging (default: Ask)
nginx:
Nginx Web Server plugin
--nginx-server-root NGINX_SERVER_ROOT
Nginx server root directory. (default: /etc/nginx or
/usr/local/etc/nginx)
--nginx-ctl NGINX_CTL
Path to the 'nginx' binary, used for 'configtest' and
retrieving nginx version number. (default: nginx)
null:
Null Installer
standalone:
Spin up a temporary webserver
webroot:
(continues on next page)
If you’re having problems, we recommend posting on the Let’s Encrypt Community Forum.
If you find a bug in the software, please do report it in our issue tracker. Remember to give us as much information as
possible:
• copy and paste exact command line used and the output (though mind that the latter might include some person-
ally identifiable information, including your email and domains)
• copy and paste logs from /var/log/letsencrypt (though mind they also might contain personally iden-
tifiable information)
• copy and paste certbot --version output
• your operating system, including specific version
• specify which installation method you’ve chosen
FIVE
DEVELOPER GUIDE
Table of Contents
• Getting Started
– Running a local copy of the client
– Find issues to work on
– Testing
41
Certbot Documentation, Release 1.4.0.dev0
• Notes on OS dependencies
– FreeBSD
Certbot has the same system requirements when set up for development. While the section below will help you install
Certbot and its dependencies, Certbot needs to be run on a UNIX-like OS so if you’re using Windows, you’ll need to
set up a (virtual) machine running an OS such as Linux and continue with these instructions on that UNIX-like OS.
Running the client in developer mode from your local tree is a little different than running Certbot as a user. To get set
up, clone our git repository by running:
If you’re on macOS, we recommend you skip the rest of this section and instead run Certbot in Docker. You can
find instructions for how to do this here. If you’re running on Linux, you can run the following commands to install
dependencies and set up a virtual environment where you can run Certbot.
Install the OS system dependencies required to run Certbot.
Set up the Python virtual environment that will host your Certbot local instance.
cd certbot
python tools/venv3.py
Note: You may need to repeat this when Certbot’s dependencies change or when a new plugin is introduced.
You can now run the copy of Certbot from git either by executing venv3/bin/certbot, or by activating the virtual
environment. You can do the latter by running:
source venv3/bin/activate
After running this command, certbot and development tools like ipdb, ipython, pytest, and tox are available
in the shell where you ran the command. These tools are installed in the virtual environment and are kept separate
from your global Python installation. This works by setting environment variables so the right executables are found
and Python can pull in the versions of various packages needed by Certbot. More information can be found in the
virtualenv docs.
You can find the open issues in the github issue tracker. Comparatively easy ones are marked good first issue. If you’re
starting work on something, post a comment to let others know and seek feedback on your plan where appropriate.
Once you’ve got a working branch, you can open a pull request. All changes in your pull request must have thorough
unit test coverage, pass our tests, and be compliant with the coding style.
5.1.3 Testing
When you are working in a file foo.py, there should also be a file foo_test.py either in the same directory as
foo.py or in the tests subdirectory (if there isn’t, make one). While you are working on your code and tests, run
python foo_test.py to run the relevant tests.
For debugging, we recommend putting import ipdb; ipdb.set_trace() statements inside the source code.
Once you are done with your code changes, and the tests in foo_test.py pass, run all of the unittests for Certbot
with tox -e py27 (this uses Python 2.7).
Once all the unittests pass, check for sufficient test coverage using tox -e py27-cover, and then check for code
style with tox -e lint (all files) or pylint --rcfile=.pylintrc path/to/file.py (single file at a
time).
Once all of the above is successful, you may run the full test suite using tox --skip-missing-interpreters.
We recommend running the commands above first, because running all tests like this is very slow, and the large amount
of output can make it hard to find specific failures when they happen.
Warning: The full test suite may attempt to modify your system’s Apache config if your user has sudo permis-
sions, so it should not be run on a production Apache server.
Generally it is sufficient to open a pull request and let Github and Travis run integration tests for you. However, you
may want to run them locally before submitting your pull request. You need Docker and docker-compose installed
and working.
The tox environment integration will setup Pebble, the Let’s Encrypt ACME CA server for integration testing,
then launch the Certbot integration tests.
With a user allowed to access your local Docker daemon, run:
tox -e integration
Tests will be run using pytest. A test report and a code coverage report will be displayed at the end of the integration
tests execution.
You can also manually execute Certbot against a local instance of the Pebble ACME server. This is useful to verify
that the modifications done to the code makes Certbot behave as expected.
To do so you need:
• Docker installed, and a user with access to the Docker client,
• an available local copy of Certbot.
The virtual environment set up with python tools/venv.py contains two commands that can be used once the
virtual environment is activated:
run_acme_server
• Starts a local instance of Pebble and runs in the foreground printing its logs.
• Press CTRL+C to stop this instance.
• This instance is configured to validate challenges against certbot executed locally.
certbot_test [ARGS...]
• Execute certbot with the provided arguments and other arguments useful for testing purposes, such as: verbose
output, full tracebacks in case Certbot crashes, etc.
• Execution is preconfigured to interact with the Pebble CA started with run_acme_server.
• Any arguments can be passed as they would be to Certbot (eg. certbot_test certonly -d test.
example.com).
Here is a typical workflow to verify that Certbot successfully issued a certificate using an HTTP-01 challenge on a
machine with Python 3:
python tools/venv3.py
source venv3/bin/activate
run_acme_server &
certbot_test certonly --standalone -d test.example.com
# To stop Pebble, launch `fg` to get back the background job, then press CTRL+C
Running tests in CI
Certbot uses both Azure Pipelines and Travis to run continuous integration tests. If you are using our Azure and Travis
setup, a branch whose name starts with test- will run all Azure and Travis tests on that branch. If the branch name
starts with azure-test-, it will run all of our Azure tests and none of our Travis tests. If the branch stats with
travis-test-, only our Travis tests will be run.
certbot-auto and letsencrypt-auto shell scripts to install Certbot and its dependencies on UNIX systems
windows installer Installs Certbot on Windows and is built using the files in windows-installer/
5.2.1 Plugin-architecture
Certbot has a plugin architecture to facilitate support for different webservers, other TLS servers, and operating sys-
tems. The interfaces available for plugins to implement are defined in interfaces.py and plugins/common.py.
The main two plugin interfaces are IAuthenticator, which implements various ways of proving domain control
to a certificate authority, and IInstaller, which configures a server to use a certificate once it is issued. Some
plugins, like the built-in Apache and Nginx plugins, implement both interfaces and perform both tasks. Others, like
the built-in Standalone authenticator, implement just one interface.
There are also IDisplay plugins, which can change how prompts are displayed to a user.
5.2.2 Authenticators
Authenticators are plugins that prove control of a domain name by solving a challenge provided by the ACME server.
ACME currently defines several types of challenges: HTTP, TLS-ALPN, and DNS, represented by classes in acme.
challenges. An authenticator plugin should implement support for at least one challenge type.
An Authenticator indicates which challenges it supports by implementing get_chall_pref(domain) to return
a sorted list of challenge types in preference order.
An Authenticator must also implement perform(achalls), which “performs” a list of challenges by, for instance,
provisioning a file on an HTTP server, or setting a TXT record in DNS. Once all challenges have succeeded or failed,
Certbot will call the plugin’s cleanup(achalls) method to remove any files or DNS records that were needed
only during authentication.
5.2.3 Installer
Installers plugins exist to actually setup the certificate in a server, possibly tweak the security configuration to make it
more correct and secure (Fix some mixed content problems, turn on HSTS, redirect to HTTPS, etc). Installer plugins
tell the main client about their abilities to do the latter via the supported_enhancements() call. We currently
have two Installers in the tree, the ApacheConfigurator. and the NginxConfigurator. External projects
have made some progress toward support for IIS, Icecast and Plesk.
Installers and Authenticators will oftentimes be the same class/object (because for instance both tasks can be performed
by a webserver like nginx) though this is not always the case (the standalone plugin is an authenticator that listens on
port 80, but it cannot install certs; a postfix plugin would be an installer but not an authenticator).
Installers and Authenticators are kept separate because it should be possible to use the
StandaloneAuthenticator (it sets up its own Python server to perform challenges) with a program that
cannot solve challenges itself (Such as MTA installers).
There are a few existing classes that may be beneficial while developing a new IInstaller. Installers aimed to
reconfigure UNIX servers may use Augeas for configuration parsing and can inherit from AugeasConfigurator
class to handle much of the interface. Installers that are unable to use Augeas may still find the Reverter class
helpful in handling configuration checkpoints and rollback.
Note: The Certbot team is not currently accepting any new DNS plugins because we want to rethink our approach to
the challenge and resolve some issues like #6464, #6503, and #6504 first.
In the meantime, you’re welcome to release it as a third-party plugin. See certbot-dns-ispconfig for one example of
that.
Certbot client supports dynamic discovery of plugins through the setuptools entry points using the certbot.
plugins group. This way you can, for example, create a custom implementation of IAuthenticator or
the IInstaller without having to merge it with the core upstream source code. An example is provided in
examples/plugins/ directory.
While developing, you can install your plugin into a Certbot development virtualenv like this:
. venv/bin/activate
pip install -e examples/plugins/
certbot_test plugins
Your plugin should show up in the output of the last command. If not, it was not installed properly.
Once you’ve finished your plugin and published it, you can have your users install it system-wide with pip
install. Note that this will only work for users who have Certbot installed from OS packages or via pip. Users who
run certbot-auto are currently unable to use third-party plugins. It’s technically possible to install third-party
plugins into the virtualenv used by certbot-auto, but they will be wiped away when certbot-auto upgrades.
Please:
1. Be consistent with the rest of the code.
2. Read PEP 8 - Style Guide for Python Code.
3. Follow the Google Python Style Guide, with the exception that we use Sphinx-style documentation:
def foo(arg):
"""Short description.
:returns: Argument
:rtype: int
"""
return arg
Python’s standard library os module lacks full support for several Windows security features about file permissions
(eg. DACLs). However several files handled by Certbot (eg. private keys) need strongly restricted access on both
Linux and Windows.
To help with this, the certbot.compat.os module wraps the standard os module, and forbids usage of methods
that lack support for these Windows security features.
As a developer, when working on Certbot or its plugins, you must use certbot.compat.os in every place you
would need os (eg. from certbot.compat import os instead of import os). Otherwise the tests will fail
when your PR is submitted.
Certbot uses the mypy static type checker. Python 3 natively supports official type annotations, which can then be
tested for consistency using mypy. Python 2 doesn’t, but type annotations can be added in comments. Mypy does
some type checks even without type annotations; we can find bugs in Certbot even without a fully annotated codebase.
Certbot supports both Python 2 and 3, so we’re using Python 2-style annotations.
Zulip wrote a great guide to using mypy. It’s useful, but you don’t have to read the whole thing to start contributing to
Certbot.
To run mypy on Certbot, use tox -e mypy on a machine that has Python 3 installed.
Note that instead of just importing typing, due to packaging issues, in Certbot we import from acme.
magic_typing and have to add some comments for pylint like this:
Also note that OpenSSL, which we rely on, has type definitions for crypto but not SSL. We use both. Those imports
should look like this:
Steps:
1. Write your code! When doing this, you should add mypy type annotations for any functions you add or modify.
You can check that you’ve done this correctly by running tox -e mypy on a machine that has Python 3
installed.
2. Make sure your environment is set up properly and that you’re in your virtualenv. You can do this by following
the instructions in the Getting Started section.
3. Run tox -e lint to check for pylint errors. Fix any errors.
4. Run tox --skip-missing-interpreters to run the entire test suite including coverage. The
--skip-missing-interpreters argument ignores missing versions of Python needed for running the
tests. Fix any errors.
5. Submit the PR. Once your PR is open, please do not force push to the branch containing your pull request to
squash or amend commits. We use squash merges on PRs and rewriting commits makes changes harder to track
between reviews.
6. Did your tests pass on Travis? If they didn’t, fix any errors.
If you have any questions while working on a Certbot issue, don’t hesitate to ask for help! You can do this in the
Certbot channel in EFF’s Mattermost instance for its open source projects as described below.
You can get involved with several of EFF’s software projects such as Certbot at the EFF Open Source Contributor
Chat Platform. By signing up for the EFF Open Source Contributor Chat Platform, you consent to share your personal
information with the Electronic Frontier Foundation, which is the operator and data controller for this platform. The
channels will be available both to EFF, and to other users of EFFOSCCP, who may use or disclose information in
these channels outside of EFFOSCCP. EFF will use your information, according to the Privacy Policy, to further the
mission of EFF, including hosting and moderating the discussions on this platform.
Use of EFFOSCCP is subject to the EFF Code of Conduct. When investigating an alleged Code of Conduct violation,
EFF may review discussion channels or direct messages.
Note: We are currently only accepting changes to certbot-auto that fix regressions on platforms where certbot-auto is
the recommended installation method at https://certbot.eff.org/instructions. If you are unsure if a change you want to
make qualifies, don’t hesitate to ask for help!
Developers should not modify the certbot-auto and letsencrypt-auto files in the root directory of the
repository. Rather, modify the letsencrypt-auto.template and associated platform-specific shell scripts
in the letsencrypt-auto-source and letsencrypt-auto-source/pieces/bootstrappers direc-
tory, respectively.
Once changes to any of the aforementioned files have been made, the letsencrypt-auto-source/
letsencrypt-auto script should be updated. In lieu of manually updating this script, run the build script, which
lives at letsencrypt-auto-source/build.py:
python letsencrypt-auto-source/build.py
Running build.py will update the letsencrypt-auto-source/letsencrypt-auto script. Note that the
certbot-auto and letsencrypt-auto scripts in the root directory of the repository will remain unchanged
after this script is run. Your changes will be propagated to these files during the next release of Certbot.
5.8.3 Opening a PR
When opening a PR, ensure that the following files are committed:
1. letsencrypt-auto-source/letsencrypt-auto.template and
letsencrypt-auto-source/pieces/bootstrappers/*
2. letsencrypt-auto-source/letsencrypt-auto (generated by build.py)
It might also be a good idea to double check that no changes were inadvertently made to the certbot-auto or
letsencrypt-auto scripts in the root of the repository. These scripts will be updated by the core developers
during the next release.
Many of the packages in the Certbot repository have documentation in a docs/ directory. This directory is located
under the top level directory for the package. For instance, Certbot’s documentation is under certbot/docs.
To build the documentation of a package, make sure you have followed the instructions to set up a local copy of
Certbot including activating the virtual environment. After that, cd to the docs directory you want to build and run the
command:
This would generate the HTML documentation in _build/html in your current docs/ directory.
You can use Docker Compose to quickly set up an environment for running and testing Certbot. To install Docker
Compose, follow the instructions at https://docs.docker.com/compose/install/.
Note: Linux users can simply run pip install docker-compose to get Docker Compose after installing
Docker Engine and activating your shell as described in the Getting Started section.
Now you can develop on your host machine, but run Certbot and test your changes in Docker. When using
docker-compose make sure you are inside your clone of the Certbot repository. As an example, you can run
the following command to check for linting errors:
You can also leave a terminal open running a shell in the Docker container and modify Certbot code in another window.
The Certbot repo on your host machine is mounted inside of the container so any changes you make immediately take
effect. To do this, run:
Now running the check for linting errors described above is as easy as:
tox -e lint
In general. . .
• sudo is required as a suggested way of running privileged process
5.11.1 FreeBSD
FreeBSD by default uses tcsh. In order to activate virtualenv (see above), you will need a compatible shell, e.g. pkg
install bash && bash.
SIX
PACKAGING GUIDE
6.1 Releases
We release packages and upload them to PyPI (wheels and source tarballs).
• https://pypi.python.org/pypi/acme
• https://pypi.python.org/pypi/certbot
• https://pypi.python.org/pypi/certbot-apache
• https://pypi.python.org/pypi/certbot-nginx
• https://pypi.python.org/pypi/certbot-dns-cloudflare
• https://pypi.python.org/pypi/certbot-dns-cloudxns
• https://pypi.python.org/pypi/certbot-dns-digitalocean
• https://pypi.python.org/pypi/certbot-dns-dnsimple
• https://pypi.python.org/pypi/certbot-dns-dnsmadeeasy
• https://pypi.python.org/pypi/certbot-dns-google
• https://pypi.python.org/pypi/certbot-dns-linode
• https://pypi.python.org/pypi/certbot-dns-luadns
• https://pypi.python.org/pypi/certbot-dns-nsone
• https://pypi.python.org/pypi/certbot-dns-ovh
• https://pypi.python.org/pypi/certbot-dns-rfc2136
• https://pypi.python.org/pypi/certbot-dns-route53
The following scripts are used in the process:
• https://github.com/certbot/certbot/blob/master/tools/release.sh
We use git tags to identify releases, using Semantic Versioning. For example: v0.11.1.
Our packages are cryptographically signed and their signature can be verified using the PGP key
A2CFB51FA275A7286234E7B24D17C995CD9775F2. This key can be found on major key servers and at
https://dl.eff.org/certbot.pub.
51
Certbot Documentation, Release 1.4.0.dev0
SEVEN
BACKWARDS COMPATIBILITY
All Certbot components including acme, Certbot, and non-third party plugins follow Semantic Versioning both for its
Python API and for the application itself. This means that we will not change behavior in a backwards incompatible
way except in a new major version of the project.
Note: None of this applies to the behavior of Certbot distribution mechanisms such as certbot-auto or OS packages
whose behavior may change at any time. Semantic versioning only applies to the common Certbot components that
are installed by various distribution methods.
For Certbot as an application, the command line interface and non-interactive behavior can be considered stable with
two exceptions. The first is that no aspects of Certbot’s console or log output should be considered stable and it may
change at any time. The second is that Certbot’s behavior should only be considered stable with certain files but not
all. Files with which users should expect Certbot to maintain its current behavior with are:
• /etc/letsencrypt/live/<domain>/{cert,chain,fullchain,privkey}.pem where
<domain> is the name given to --cert-name. If --cert-name is not set by the user, it is the first domain
given to --domains.
• CLI configuration files
• Hook directories in /etc/letsencrypt/renewal-hooks
Certbot’s behavior with other files may change at any point.
Another area where Certbot should not be considered stable is its behavior when not run in non-interactive mode which
also may change at any point.
In general, if we’re making a change that we expect will break some users, we will bump the major version and will
have warned about it in a prior release when possible. For our Python API, we will issue warnings using Python’s
warning module. For application level changes, we will print and log warning messages.
53
Certbot Documentation, Release 1.4.0.dev0
EIGHT
RESOURCES
Documentation: https://certbot.eff.org/docs
Software project: https://github.com/certbot/certbot
Notes for developers: https://certbot.eff.org/docs/contributing.html
Main Website: https://certbot.eff.org
Let’s Encrypt Website: https://letsencrypt.org
Community: https://community.letsencrypt.org
ACME spec: http://ietf-wg-acme.github.io/acme/
ACME working area in github: https://github.com/ietf-wg-acme/acme
55
Certbot Documentation, Release 1.4.0.dev0
56 Chapter 8. Resources
CHAPTER
NINE
API DOCUMENTATION
Certbot client.
9.1.1 Subpackages
certbot.compat package
Submodules
certbot.compat.filesystem module
57
Certbot Documentation, Release 1.4.0.dev0
destination file :param bool copy_user: Copy user if True :param bool copy_group: Copy group if True on
Linux (has no effect on Windows)
certbot.compat.filesystem.check_mode(file_path, mode)
Check if the given mode matches the permissions of the given file. On Linux, will make a direct comparison,
on Windows, mode will be compared against the security model. :param str file_path: Path of the file :param int
mode: POSIX mode to test :rtype: bool :return: True if the POSIX mode matches the file permissions
certbot.compat.filesystem.check_owner(file_path)
Check if given file is owned by current user. :param str file_path: File path to check :rtype: bool :return: True if
given file is owned by current user, False otherwise.
certbot.compat.filesystem.check_permissions(file_path, mode)
Check if given file has the given mode and is owned by current user. :param str file_path: File path to check
:param int mode: POSIX mode to check :rtype: bool :return: True if file has correct mode and owner, False
otherwise.
certbot.compat.filesystem.open(file_path, flags, mode=511)
Wrapper of original os.open function, that will ensure on Windows that given mode is correctly applied. :param
str file_path: The file path to open :param int flags: Flags to apply on file while opened :param int mode: POSIX
mode to apply on file when opened,
Python defaults will be applied if None
certbot.compat.filesystem.makedirs(file_path, mode=511)
Rewrite of original os.makedirs function, that will ensure on Windows that given mode is correctly applied.
:param str file_path: The file path to open :param int mode: POSIX mode to apply on leaf directory when
created, Python defaults
will be applied if None
certbot.compat.filesystem.mkdir(file_path, mode=511)
Rewrite of original os.mkdir function, that will ensure on Windows that given mode is correctly applied. :param
str file_path: The file path to open :param int mode: POSIX mode to apply on directory when created, Python
defaults
will be applied if None
certbot.compat.filesystem.replace(src, dst)
Rename a file to a destination path and handles situations where the destination exists. :param str src: The
current file path. :param str dst: The new file path.
certbot.compat.filesystem.realpath(file_path)
Find the real path for the given path. This method resolves symlinks, including recursive symlinks, and is
protected against symlinks that creates an infinite loop.
certbot.compat.filesystem.is_executable(path)
Is path an executable file? :param str path: path to test :return: True if path is an executable file :rtype: bool
certbot.compat.filesystem.has_world_permissions(path)
Check if everybody/world has any right (read/write/execute) on a file given its path :param str path: path to test
:return: True if everybody/world has any right to the file :rtype: bool
certbot.compat.filesystem.compute_private_key_mode(old_key, base_mode)
Calculate the POSIX mode to apply to a private key given the previous private key :param str old_key: path
to the previous private key :param int base_mode: the minimum modes to apply to a private key :return: the
POSIX mode to apply :rtype: int
certbot.compat.filesystem.has_same_ownership(path1, path2)
Return True if the ownership of two files given their respective path is the same. On Windows, ownership is
checked against owner only, since files do not have a group owner. :param str path1: path to the first file :param
str path2: path to the second file :return: True if both files have the same ownership, False otherwise :rtype: bool
certbot.compat.filesystem.has_min_permissions(path, min_mode)
Check if a file given its path has at least the permissions defined by the given minimal mode. On Windows, group
permissions are ignored since files do not have a group owner. :param str path: path to the file to check :param
int min_mode: the minimal permissions expected :return: True if the file matches the minimal permissions
expectations, False otherwise :rtype: bool
certbot.compat.misc module
This compat module handles various platform specific calls that do not fall into one particular category.
certbot.compat.misc.raise_for_non_administrative_windows_rights()
On Windows, raise if current shell does not have the administrative rights. Do nothing on Linux.
Raises errors.Error – If the current shell does not have administrative rights on Windows.
certbot.compat.misc.readline_with_timeout(timeout, prompt)
Read user input to return the first line entered, or raise after specified timeout.
Parameters
• timeout (float) – The timeout in seconds given to the user.
• prompt (str) – The prompt message to display to the user.
Returns The first line entered by the user.
Return type str
certbot.compat.misc.get_default_folder(folder_type)
Return the relevant default folder for the current OS
Parameters folder_type (str) – The type of folder to retrieve (config, work or logs)
Returns The relevant default folder.
Return type str
certbot.compat.misc.underscores_for_unsupported_characters_in_path(path)
Replace unsupported characters in path for current OS by underscores. :param str path: the path to normalize
:return: the normalized path :rtype: str
certbot.compat.os module
This compat modules is a wrapper of the core os module that forbids usage of specific operations (e.g. chown, chmod,
getuid) that would be harmful to the Windows file security model of Certbot. This module is intended to replace
standard os module throughout certbot projects (except acme).
isort:skip_file
certbot.compat.os.chmod(*unused_args, **unused_kwargs)
Method os.chmod() is forbidden
certbot.compat.os.chown(*unused_args, **unused_kwargs)
Method os.chown() is forbidden
certbot.compat.os.open(*unused_args, **unused_kwargs)
Method os.open() is forbidden
certbot.compat.os.mkdir(*unused_args, **unused_kwargs)
Method os.mkdir() is forbidden
certbot.compat.os.makedirs(*unused_args, **unused_kwargs)
Method os.makedirs() is forbidden
certbot.compat.os.rename(*unused_args, **unused_kwargs)
Method os.rename() is forbidden
certbot.compat.os.access(*unused_args, **unused_kwargs)
Method os.access() is forbidden
certbot.compat.os.stat(*unused_args, **unused_kwargs)
Method os.stat() is forbidden
certbot.compat.os.fstat(*unused_args, **unused_kwargs)
Method os.stat() is forbidden
certbot.compat.os.WCOREDUMP(status) → bool
Return True if the process returning ‘status’ was dumped to a core file.
certbot.compat.os.WEXITSTATUS(status) → integer
Return the process return code from ‘status’.
certbot.compat.os.WIFCONTINUED(status) → bool
Return True if the process returning ‘status’ was continued from a job control stop.
certbot.compat.os.WIFEXITED(status) → bool
Return true if the process returning ‘status’ exited using the exit() system call.
certbot.compat.os.WIFSIGNALED(status) → bool
Return True if the process returning ‘status’ was terminated by a signal.
certbot.compat.os.WIFSTOPPED(status) → bool
Return True if the process returning ‘status’ was stopped.
certbot.compat.os.WSTOPSIG(status) → integer
Return the signal that stopped the process that provided the ‘status’ value.
certbot.compat.os.WTERMSIG(status) → integer
Return the signal that terminated the process that provided the ‘status’ value.
certbot.compat.os.abort() → does not return!
Abort the interpreter immediately. This ‘dumps core’ or otherwise fails in the hardest way possible on the
hosting operating system.
certbot.compat.os.chdir(path)
Change the current working directory to the specified path.
certbot.compat.os.chroot(path)
Change root directory to path.
certbot.compat.os.close(fd)
Close a file descriptor (for low level IO).
certbot.compat.os.closerange(fd_low, fd_high)
Closes all file descriptors in [fd_low, fd_high), ignoring errors.
certbot.compat.os.confstr(name) → string
Return a string-valued system configuration variable.
certbot.compat.os.ctermid() → string
Return the name of the controlling terminal for this process.
certbot.compat.os.dup(fd) → fd2
Return a duplicate of a file descriptor.
certbot.compat.os.dup2(old_fd, new_fd)
Duplicate file descriptor.
certbot.compat.os.error
alias of exceptions.OSError
certbot.compat.os.execv(path, args)
Execute an executable path with arguments, replacing current process.
path: path of executable file args: tuple or list of strings
certbot.compat.os.execve(path, args, env)
Execute a path with arguments and environment, replacing current process.
path: path of executable file args: tuple or list of arguments env: dictionary of strings mapping to
strings
certbot.compat.os.fchdir(fildes)
Change to the directory of the given file descriptor. fildes must be opened on a directory, not a file.
certbot.compat.os.fchmod(fd, mode)
Change the access permissions of the file given by file descriptor fd.
certbot.compat.os.fchown(fd, uid, gid)
Change the owner and group id of the file given by file descriptor fd to the numeric uid and gid.
certbot.compat.os.fdatasync(fildes)
force write of file with filedescriptor to disk. does not force update of metadata.
certbot.compat.os.fdopen(fd[, mode=’r’[, bufsize ]]) → file_object
Return an open file object connected to a file descriptor.
certbot.compat.os.fork() → pid
Fork a child process. Return 0 to child process and PID of child to parent process.
certbot.compat.os.forkpty() -> (pid, master_fd)
Fork a new process with a new pseudo-terminal as controlling tty.
Like fork(), return 0 as pid to child process, and PID of child to parent. To both, return fd of newly opened
pseudo-terminal.
certbot.compat.os.fpathconf(fd, name) → integer
Return the configuration limit name for the file descriptor fd. If there is no limit, return -1.
certbot.compat.os.fstatvfs(fd) → statvfs result
Perform an fstatvfs system call on the given fd.
certbot.compat.os.fsync(fildes)
force write of file with filedescriptor to disk.
certbot.compat.os.ftruncate(fd, length)
Truncate a file to a specified length.
certbot.compat.os.getcwd() → path
Return a string representing the current working directory.
certbot.compat.os.getcwdu() → path
Return a unicode string representing the current working directory.
certbot.compat.os.getegid() → egid
Return the current process’s effective group id.
certbot.compat.os.geteuid() → euid
Return the current process’s effective user id.
certbot.compat.os.getgid() → gid
Return the current process’s group id.
certbot.compat.os.getgroups() → list of group IDs
Return list of supplemental group IDs for the process.
certbot.compat.os.getloadavg() -> (float, float, float)
Return the number of processes in the system run queue averaged over the last 1, 5, and 15 minutes or raises
OSError if the load average was unobtainable
certbot.compat.os.getlogin() → string
Return the actual login name.
certbot.compat.os.getpgid(pid) → pgid
Call the system call getpgid().
certbot.compat.os.getpgrp() → pgrp
Return the current process group id.
certbot.compat.os.getpid() → pid
Return the current process id
certbot.compat.os.getppid() → ppid
Return the parent’s process id.
certbot.compat.os.getresgid() -> (rgid, egid, sgid)
Get tuple of the current process’s real, effective, and saved group ids.
certbot.compat.os.getresuid() -> (ruid, euid, suid)
Get tuple of the current process’s real, effective, and saved user ids.
certbot.compat.os.getsid(pid) → sid
Call the system call getsid().
certbot.compat.os.getuid() → uid
Return the current process’s user id.
certbot.compat.os.initgroups(username, gid) → None
Call the system initgroups() to initialize the group access list with all of the groups of which the specified
username is a member, plus the specified group id.
certbot.compat.os.isatty(fd) → bool
Return True if the file descriptor ‘fd’ is an open file descriptor connected to the slave end of a terminal.
certbot.compat.os.kill(pid, sig)
Kill a process with a signal.
certbot.compat.os.killpg(pgid, sig)
Kill a process group with a signal.
certbot.compat.os.lchown(path, uid, gid)
Change the owner and group id of path to the numeric uid and gid. This function will not follow symbolic links.
certbot.compat.os.link(src, dst)
Create a hard link to a file.
certbot.compat.os.listdir(path) → list_of_strings
Return a list containing the names of the entries in the directory.
path: path of directory to list
The list is in arbitrary order. It does not include the special entries ‘.’ and ‘..’ even if they are present in the
directory.
certbot.compat.os.lseek(fd, pos, how) → newpos
Set the current position of a file descriptor. Return the new cursor position in bytes, starting from the beginning.
certbot.compat.os.lstat(path) → stat result
Like stat(path), but do not follow symbolic links.
certbot.compat.os.major(device) → major number
Extracts a device major number from a raw device number.
certbot.compat.os.makedev(major, minor) → device number
Composes a raw device number from the major and minor device numbers.
certbot.compat.os.minor(device) → minor number
Extracts a device minor number from a raw device number.
certbot.compat.os.mkfifo(filename[, mode=0666 ])
Create a FIFO (a POSIX named pipe).
certbot.compat.os.mknod(filename[, mode=0600, device ])
Create a filesystem node (file, device special file or named pipe) named filename. mode specifies both the
permissions to use and the type of node to be created, being combined (bitwise OR) with one of S_IFREG,
S_IFCHR, S_IFBLK, and S_IFIFO. For S_IFCHR and S_IFBLK, device defines the newly created device spe-
cial file (probably using os.makedev()), otherwise it is ignored.
certbot.compat.os.nice(inc) → new_priority
Decrease the priority of process by inc and return the new priority.
certbot.compat.os.openpty() -> (master_fd, slave_fd)
Open a pseudo-terminal, returning open fd’s for both master and slave end.
certbot.compat.os.pathconf(path, name) → integer
Return the configuration limit name for the file or directory path. If there is no limit, return -1.
certbot.compat.os.pipe() -> (read_end, write_end)
Create a pipe.
certbot.compat.os.popen(command[, mode=’r’[, bufsize ]]) → pipe
Open a pipe to/from a command returning a file object.
certbot.compat.os.putenv(key, value)
Change or add an environment variable.
certbot.compat.os.read(fd, buffersize) → string
Read a file descriptor.
certbot.compat.os.readlink(path) → path
Return a string representing the path to which the symbolic link points.
certbot.compat.os.remove(path)
Remove a file (same as unlink(path)).
certbot.compat.os.rmdir(path)
Remove a directory.
certbot.compat.os.setegid(gid)
Set the current process’s effective group id.
certbot.compat.os.seteuid(uid)
Set the current process’s effective user id.
certbot.compat.os.setgid(gid)
Set the current process’s group id.
certbot.compat.os.setgroups(list)
Set the groups of the current process to list.
certbot.compat.os.setpgid(pid, pgrp)
Call the system call setpgid().
certbot.compat.os.setpgrp()
Make this process the process group leader.
certbot.compat.os.setregid(rgid, egid)
Set the current process’s real and effective group ids.
certbot.compat.os.setresgid(rgid, egid, sgid)
Set the current process’s real, effective, and saved group ids.
certbot.compat.os.setresuid(ruid, euid, suid)
Set the current process’s real, effective, and saved user ids.
certbot.compat.os.setreuid(ruid, euid)
Set the current process’s real and effective user ids.
certbot.compat.os.setsid()
Call the system call setsid().
certbot.compat.os.setuid(uid)
Set the current process’s user id.
certbot.compat.os.stat_float_times([newval ]) → oldval
Determine whether os.[lf]stat represents time stamps as float objects. If newval is True, future calls to stat()
return floats, if it is False, future calls return ints. If newval is omitted, return the current setting.
class certbot.compat.os.stat_result
Bases: object
stat_result: Result from stat or lstat.
This object may be accessed either as a tuple of (mode, ino, dev, nlink, uid, gid, size, atime, mtime, ctime)
or via the attributes st_mode, st_ino, st_dev, st_nlink, st_uid, and so on.
Posix/windows: If your platform supports st_blksize, st_blocks, st_rdev, or st_flags, they are available as at-
tributes only.
See os.stat for more information.
n_fields = 16
n_sequence_fields = 10
n_unnamed_fields = 3
st_atime
time of last access
st_blksize
blocksize for filesystem I/O
st_blocks
number of blocks allocated
st_ctime
time of last change
st_dev
device
st_gid
group ID of owner
st_ino
inode
st_mode
protection bits
st_mtime
time of last modification
st_nlink
number of hard links
st_rdev
device type (if inode device)
st_size
total size, in bytes
st_uid
user ID of owner
certbot.compat.os.statvfs(path) → statvfs result
Perform a statvfs system call on the given path.
class certbot.compat.os.statvfs_result
Bases: object
statvfs_result: Result from statvfs or fstatvfs.
This object may be accessed either as a tuple of (bsize, frsize, blocks, bfree, bavail, files, ffree, favail, flag,
namemax),
or via the attributes f_bsize, f_frsize, f_blocks, f_bfree, and so on.
See os.statvfs for more information.
f_bavail
f_bfree
f_blocks
f_bsize
f_favail
f_ffree
f_files
f_flag
f_frsize
f_namemax
n_fields = 10
n_sequence_fields = 10
n_unnamed_fields = 0
certbot.compat.os.strerror(code) → string
Translate an error code to a message string.
certbot.compat.os.symlink(src, dst)
Create a symbolic link pointing to src named dst.
certbot.compat.os.sysconf(name) → integer
Return an integer-valued system configuration variable.
certbot.compat.os.system(command) → exit_status
Execute the command (a string) in a subshell.
certbot.compat.os.tcgetpgrp(fd) → pgid
Return the process group associated with the terminal given by a fd.
certbot.compat.os.tcsetpgrp(fd, pgid)
Set the process group associated with the terminal given by a fd.
certbot.compat.os.tempnam([dir[, prefix ]]) → string
Return a unique name for a temporary file. The directory and a prefix may be specified as strings; they may be
omitted or None if not needed.
certbot.compat.os.times() -> (utime, stime, cutime, cstime, elapsed_time)
Return a tuple of floating point numbers indicating process times.
certbot.compat.os.tmpfile() → file object
Create a temporary file with no directory entries.
certbot.compat.os.tmpnam() → string
Return a unique name for a temporary file.
certbot.compat.os.ttyname(fd) → string
Return the name of the terminal device connected to ‘fd’.
certbot.compat.os.umask(new_mask) → old_mask
Set the current numeric umask and return the previous umask.
certbot.compat.os.uname() -> (sysname, nodename, release, version, machine)
Return a tuple identifying the current operating system.
certbot.compat.os.unlink(path)
Remove a file (same as remove(path)).
certbot.compat.os.unsetenv(key)
Delete an environment variable.
certbot.compat.os.urandom(n) → str
Return n random bytes suitable for cryptographic use.
certbot.compat.os.utime(path, (atime, mtime))
utime(path, None)
Set the access and modified time of the file to the given values. If the second form is used, set the access and
modified times to the current time.
certbot.compat.os.wait() -> (pid, status)
Wait for completion of a child process.
Example:
import os from os.path import join, getsize for root, dirs, files in os.walk(‘python/Lib/email’):
print root, “consumes”, print sum([getsize(join(root, name)) for name in files]), print “bytes in”,
len(files), “non-directory files” if ‘CVS’ in dirs:
dirs.remove(‘CVS’) # don’t visit CVS directories
certbot.compat.os.execl(file, *args)
Execute the executable file with argument list args, replacing the current process.
certbot.compat.os.execle(file, *args, env)
Execute the executable file with argument list args and environment env, replacing the current process.
certbot.compat.os.execlp(file, *args)
Execute the executable file (which is searched for along $PATH) with argument list args, replacing the current
process.
certbot.compat.os.execlpe(file, *args, env)
Execute the executable file (which is searched for along $PATH) with argument list args and environment env,
replacing the current process.
certbot.compat.os.execvp(file, args)
Execute the executable file (which is searched for along $PATH) with argument list args, replacing the current
process. args may be a list or tuple of strings.
certbot.compat.os.execvpe(file, args, env)
Execute the executable file (which is searched for along $PATH) with argument list args and environment env ,
replacing the current process. args may be a list or tuple of strings.
certbot.compat.os.getenv(key, default=None)
Get an environment variable, return None if it doesn’t exist. The optional second argument can specify an
alternate default.
certbot.compat.os.spawnv(mode, file, args) → integer
Execute file with arguments from args in a subprocess. If mode == P_NOWAIT return the pid of the process.
If mode == P_WAIT return the process’s exit code if it exits normally; otherwise return -SIG, where SIG is the
signal that killed it.
certbot.compat.os.spawnve(mode, file, args, env) → integer
Execute file with arguments from args in a subprocess with the specified environment. If mode == P_NOWAIT
return the pid of the process. If mode == P_WAIT return the process’s exit code if it exits normally; otherwise
return -SIG, where SIG is the signal that killed it.
certbot.compat.os.spawnl(mode, file, *args) → integer
Execute file with arguments from args in a subprocess. If mode == P_NOWAIT return the pid of the process.
If mode == P_WAIT return the process’s exit code if it exits normally; otherwise return -SIG, where SIG is the
signal that killed it.
certbot.compat.os.spawnle(mode, file, *args, env) → integer
Execute file with arguments from args in a subprocess with the supplied environment. If mode == P_NOWAIT
return the pid of the process. If mode == P_WAIT return the process’s exit code if it exits normally; otherwise
return -SIG, where SIG is the signal that killed it.
certbot.compat.os.spawnvp(mode, file, args) → integer
Execute file (which is looked for along $PATH) with arguments from args in a subprocess. If mode ==
P_NOWAIT return the pid of the process. If mode == P_WAIT return the process’s exit code if it exits nor-
mally; otherwise return -SIG, where SIG is the signal that killed it.
certbot.compat.os.spawnvpe(mode, file, args, env) → integer
Execute file (which is looked for along $PATH) with arguments from args in a subprocess with the supplied
environment. If mode == P_NOWAIT return the pid of the process. If mode == P_WAIT return the process’s
exit code if it exits normally; otherwise return -SIG, where SIG is the signal that killed it.
certbot.compat.os.spawnlp(mode, file, *args) → integer
Execute file (which is looked for along $PATH) with arguments from args in a subprocess with the supplied
environment. If mode == P_NOWAIT return the pid of the process. If mode == P_WAIT return the process’s
exit code if it exits normally; otherwise return -SIG, where SIG is the signal that killed it.
certbot.compat.os.spawnlpe(mode, file, *args, env) → integer
Execute file (which is looked for along $PATH) with arguments from args in a subprocess with the supplied
environment. If mode == P_NOWAIT return the pid of the process. If mode == P_WAIT return the process’s
exit code if it exits normally; otherwise return -SIG, where SIG is the signal that killed it.
certbot.compat.os.popen2(cmd, mode=’t’, bufsize=-1)
Execute the shell command ‘cmd’ in a sub-process. On UNIX, ‘cmd’ may be a sequence, in which case ar-
guments will be passed directly to the program without shell intervention (as with os.spawnv()). If ‘cmd’ is a
string it will be passed to the shell (as with os.system()). If ‘bufsize’ is specified, it sets the buffer size for the
I/O pipes. The file objects (child_stdin, child_stdout) are returned.
certbot.compat.os.popen3(cmd, mode=’t’, bufsize=-1)
Execute the shell command ‘cmd’ in a sub-process. On UNIX, ‘cmd’ may be a sequence, in which case ar-
guments will be passed directly to the program without shell intervention (as with os.spawnv()). If ‘cmd’ is a
string it will be passed to the shell (as with os.system()). If ‘bufsize’ is specified, it sets the buffer size for the
I/O pipes. The file objects (child_stdin, child_stdout, child_stderr) are returned.
certbot.compat.os.popen4(cmd, mode=’t’, bufsize=-1)
Execute the shell command ‘cmd’ in a sub-process. On UNIX, ‘cmd’ may be a sequence, in which case ar-
guments will be passed directly to the program without shell intervention (as with os.spawnv()). If ‘cmd’ is a
string it will be passed to the shell (as with os.system()). If ‘bufsize’ is specified, it sets the buffer size for the
I/O pipes. The file objects (child_stdin, child_stdout_stderr) are returned.
certbot.display package
Submodules
certbot.display.ops module
certbot.display.ops.choose_account(accounts)
Choose an account.
Parameters accounts (list) – Containing at least one Account
certbot.display.ops.choose_values(values, question=None)
Display screen to let user pick one or multiple values from the provided list.
Parameters values (list) – Values to select from
Returns List of selected values
Return type list
certbot.display.ops.choose_names(installer, question=None)
Display screen to select domains to validate.
Parameters
• installer (certbot.interfaces.IInstaller) – An installer object
• question (str) – Overriding default question to ask the user if asked to choose from
domain names.
Returns List of selected names
Return type list of str
certbot.display.ops.get_valid_domains(domains)
Helper method for choose_names that implements basic checks on domain names
certbot.display.ops.success_installation(domains)
Display a box confirming the installation of HTTPS.
Parameters domains (list) – domain names which were enabled
certbot.display.ops.success_renewal(domains)
Display a box confirming the renewal of an existing certificate.
Parameters domains (list) – domain names which were renewed
certbot.display.ops.success_revocation(cert_path)
Display a box confirming a certificate has been revoked.
Parameters cert_path (list) – path to certificate which was revoked.
certbot.display.ops.validated_input(validator, *args, **kwargs)
Like input, but with validation.
Parameters
• validator (callable) – A method which will be called on the supplied input. If
the method raises an errors.Error, its text will be displayed and the user will be re-
prompted.
• *args (list) – Arguments to be passed to input.
• **kwargs (dict) – Arguments to be passed to input.
Returns as input
certbot.display.util module
Certbot display.
certbot.display.util.OK = 'ok'
Display exit code indicating user acceptance.
certbot.display.util.CANCEL = 'cancel'
Display exit code for a user canceling the display.
certbot.display.util.HELP = 'help'
Display exit code when for when the user requests more help. (UNUSED)
certbot.display.util.ESC = 'esc'
Display exit code when the user hits Escape (UNUSED)
certbot.display.util.SIDE_FRAME = '- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Display boundary (alternates spaces, so when copy-pasted, markdown doesn’t interpret it as a heading)
certbot.display.util.input_with_timeout(prompt=None, timeout=36000.0)
Get user input with a timeout.
Behaves the same as six.moves.input, however, an error is raised if a user doesn’t answer after timeout seconds.
The default timeout value was chosen to place it just under 12 hours for users following our advice and running
Certbot twice a day.
Parameters
• prompt (str) – prompt to provide for input
• timeout (float) – maximum number of seconds to wait for input
Returns user response
Return type str
:raises errors.Error if no answer is given before the timeout
class certbot.display.util.FileDisplay(outfile, force_interactive)
Bases: object
File-based display.
notification(message, pause=True, wrap=True, force_interactive=False)
Displays a notification and waits for user acceptance.
Parameters
• message (str) – Message to display
• pause (bool) – Whether or not the program should pause for the user’s confirmation
• wrap (bool) – Whether or not the application should wrap text
• force_interactive (bool) – True if it’s safe to prompt the user because it won’t
cause any workflow regressions
menu(message, choices, ok_label=None, cancel_label=None, help_label=None, default=None,
cli_flag=None, force_interactive=False, **unused_kwargs)
Display a menu.
Parameters
• message (str) – title of menu
• choices (list of tuples (tag, item) or list of descriptions
(tags will be enumerated)) – Menu lines, len must be > 0
• default – default value to return (if one exists)
• cli_flag (str) – option used to set this value with the CLI
• force_interactive (bool) – True if it’s safe to prompt the user because it won’t
cause any workflow regressions
Returns tuple of (code, index) where code - str display exit code index - int index of the
user’s selection
Return type tuple
input(message, default=None, cli_flag=None, force_interactive=False, **unused_kwargs)
Accept input from the user.
Parameters
• message (str) – message to display to the user
• default – default value to return (if one exists)
• cli_flag (str) – option used to set this value with the CLI
• force_interactive (bool) – True if it’s safe to prompt the user because it won’t
cause any workflow regressions
Returns tuple of (code, input) where code - str display exit code input - str of the user’s
input
Return type tuple
yesno(message, yes_label=’Yes’, no_label=’No’, default=None, cli_flag=None,
force_interactive=False, **unused_kwargs)
Query the user with a yes/no question.
Yes and No label must begin with different letters, and must contain at least one letter each.
Parameters
• message (str) – question for the user
• yes_label (str) – Label of the “Yes” parameter
• no_label (str) – Label of the “No” parameter
• default – default value to return (if one exists)
• cli_flag (str) – option used to set this value with the CLI
• force_interactive (bool) – True if it’s safe to prompt the user because it won’t
cause any workflow regressions
Returns True for “Yes”, False for “No”
Return type bool
checklist(message, tags, default=None, cli_flag=None, force_interactive=False, **unused_kwargs)
Display a checklist.
Parameters
• message (str) – Message to display to user
• tags (list) – str tags to select, len(tags) > 0
• default – default value to return (if one exists)
• cli_flag (str) – option used to set this value with the CLI
• force_interactive (bool) – True if it’s safe to prompt the user because it won’t
cause any workflow regressions
Returns tuple of (code, tags) where code - str display exit code tags - list of selected tags
Return type tuple
directory_select(message, default=None, cli_flag=None, force_interactive=False, **un-
used_kwargs)
Display a directory selection screen.
Parameters
• message (str) – prompt to give the user
• default – default value to return (if one exists)
• cli_flag (str) – option used to set this value with the CLI
• force_interactive (bool) – True if it’s safe to prompt the user because it won’t
cause any workflow regressions
Returns tuple of the form (code, string) where code - display exit code string - input
entered by the user
certbot.display.util.assert_valid_call(prompt, default, cli_flag, force_interactive)
Verify that provided arguments is a valid IDisplay call.
Parameters
• prompt (str) – prompt for the user
• default – default answer to prompt
• cli_flag (str) – command line option for setting an answer to this question
• force_interactive (bool) – if interactivity is forced by the IDisplay call
class certbot.display.util.NoninteractiveDisplay(outfile, *unused_args, **un-
used_kwargs)
Bases: object
An iDisplay implementation that never asks for interactive user input
notification(message, pause=False, wrap=True, **unused_kwargs)
Displays a notification without waiting for user acceptance.
Parameters
• message (str) – Message to display to stdout
• pause (bool) – The NoninteractiveDisplay waits for no keyboard
• wrap (bool) – Whether or not the application should wrap text
menu(message, choices, ok_label=None, cancel_label=None, help_label=None, default=None,
cli_flag=None, **unused_kwargs)
Avoid displaying a menu.
Parameters
• message (str) – title of menu
• choices (list of tuples (tag, item) or list of descriptions
(tags will be enumerated)) – Menu lines, len must be > 0
• default (int) – the default choice
• kwargs (dict) – absorbs various irrelevant labelling arguments
Returns tuple of (code, index) where code - str display exit code index - int index of the
user’s selection
Return type tuple
Raises errors.MissingCommandlineFlag – if there was no default
input(message, default=None, cli_flag=None, **unused_kwargs)
Accept input from the user.
Parameters message (str) – message to display to the user
Returns tuple of (code, input) where code - str display exit code input - str of the user’s
input
Return type tuple
Raises errors.MissingCommandlineFlag – if there was no default
yesno(message, yes_label=None, no_label=None, default=None, cli_flag=None, **unused_kwargs)
Decide Yes or No, without asking anybody
Parameters
• message (str) – question for the user
• kwargs (dict) – absorbs yes_label, no_label
Raises errors.MissingCommandlineFlag – if there was no default
Returns True for “Yes”, False for “No”
Return type bool
checklist(message, tags, default=None, cli_flag=None, **unused_kwargs)
Display a checklist.
Parameters
• message (str) – Message to display to user
• tags (list) – str tags to select, len(tags) > 0
• kwargs (dict) – absorbs default_status arg
Returns tuple of (code, tags) where code - str display exit code tags - list of selected tags
certbot.plugins package
Certbot plugins.
Submodules
certbot.plugins.common module
Internal class delegating to a module, and displaying warnings when attributes related to TLS-SNI-01 are accessed.
certbot.plugins.common.option_namespace(name)
ArgumentParser options namespace (prefix of all options).
certbot.plugins.common.dest_namespace(name)
ArgumentParser dest namespace (prefix of all destinations).
class certbot.plugins.common.Plugin(config, name)
Bases: object
Generic plugin.
classmethod add_parser_arguments(add)
Add plugin arguments to the CLI argument parser.
NOTE: If some of your flags interact with others, you can use cli.report_config_interaction to register this
to ensure values are correctly saved/overridable during renewal.
Parameters add (callable) – Function that proxies calls to argparse.
ArgumentParser.add_argument prepending options with unique plugin name
prefix.
ssl_dhparams
Full absolute path to ssl_dhparams file.
updated_ssl_dhparams_digest
Full absolute path to digest of updated ssl_dhparams file.
install_ssl_dhparams()
Copy Certbot’s ssl_dhparams file into the system’s config dir if required.
class certbot.plugins.common.Addr(tup, ipv6=False)
Bases: object
Represents an virtual host address.
Parameters
• addr (str) – addr part of vhost address
• port (str) – port number or *, or “”
classmethod fromstring(str_addr)
Initialize Addr from string.
normalized_tuple()
Normalized representation of addr/port tuple
get_addr()
Return addr part of Addr object.
get_port()
Return port.
get_addr_obj(port)
Return new address object with same addr and new port.
get_ipv6_exploded()
Return IPv6 in normalized form
class certbot.plugins.common.ChallengePerformer(configurator)
Bases: object
Abstract base for challenge performers.
Variables
• configurator – Authenticator and installer plugin
• achalls (list of KeyAuthorizationAnnotatedChallenge) – Annotated chal-
lenges
• indices (list of int) – Holds the indices of challenges from a larger array so the user
of the class doesn’t have to.
add_chall(achall, idx=None)
Store challenge to be performed when perform() is called.
Parameters
• achall (KeyAuthorizationAnnotatedChallenge) – Annotated challenge.
• idx (int) – index to challenge in a larger array
perform()
Perform all added challenges.
Returns challenge responses
certbot.plugins.dns_common module
>>> base_domain_name_guesses('foo.bar.baz.example.com')
['foo.bar.baz.example.com', 'bar.baz.example.com', 'baz.example.com', 'example.com
˓→', 'com']
certbot.plugins.dns_common_lexicon module
certbot.plugins.dns_common_lexicon.build_lexicon_config(lexicon_provider_name,
lexicon_options,
provider_options)
Convenient function to build a Lexicon 2.x/3.x config object. :param str lexicon_provider_name: the name of the
lexicon provider to use :param dict lexicon_options: options specific to lexicon :param dict provider_options:
options specific to provider :return: configuration to apply to the provider :rtype: ConfigurationResolver or dict
certbot.plugins.dns_test_common module
certbot.plugins.dns_test_common_lexicon module
record_name = '_acme-challenge.example.com'
record_content = 'bar'
test_add_txt_record()
test_add_txt_record_try_twice_to_find_domain()
test_add_txt_record_fail_to_find_domain()
test_add_txt_record_fail_to_authenticate()
test_add_txt_record_fail_to_authenticate_with_unknown_error()
test_add_txt_record_error_finding_domain()
test_add_txt_record_error_adding_record()
test_del_txt_record()
test_del_txt_record_fail_to_find_domain()
test_del_txt_record_fail_to_authenticate()
test_del_txt_record_fail_to_authenticate_with_unknown_error()
test_del_txt_record_error_finding_domain()
test_del_txt_record_error_deleting_record()
certbot.plugins.enhancements module
Note: prepare() method inherited from interfaces.IPlugin might need to be called manually
within implementation of this interface method to finalize the plugin initialization.
certbot.plugins.storage module
certbot.plugins.util module
Plugin utilities.
certbot.plugins.util.get_prefixes(path)
Retrieves all possible path prefixes of a path, in descending order of length. For instance,
(linux) /a/b/c returns [‘/a/b/c’, ‘/a/b’, ‘/a’, ‘/’] (windows) C:abc returns [‘C:abc’, ‘C:ab’, ‘C:a’, ‘C:’]
certbot.plugins.util.path_surgery(cmd)
Attempt to perform PATH surgery to find cmd
Mitigates https://github.com/certbot/certbot/issues/1833
Parameters cmd (str) – the command that is being searched for in the PATH
Returns True if the operation succeeded, False otherwise
certbot.tests package
Submodules
certbot.tests.acme_util module
certbot.tests.util module
Test utilities.
certbot.tests.util.vector_path(*names)
Path to a test vector.
certbot.tests.util.load_vector(*names)
Load contents of a test vector.
certbot.tests.util.load_cert(*names)
Load certificate.
certbot.tests.util.load_csr(*names)
Load certificate request.
certbot.tests.util.load_comparable_csr(*names)
Load ComparableX509 certificate request.
certbot.tests.util.load_rsa_private_key(*names)
Load RSA private key.
certbot.tests.util.load_pyopenssl_private_key(*names)
Load pyOpenSSL private key.
certbot.tests.util.make_lineage(config_dir, testfile)
Creates a lineage defined by testfile.
This creates the archive, live, and renewal directories if necessary and creates a simple lineage.
Parameters
• config_dir (str) – path to the configuration directory
• testfile (str) – configuration file to base the lineage on
Returns path to the renewal conf file for the created lineage
certbot.tests.util.lock_and_call(callback, path_to_lock)
Grab a lock on path_to_lock from a foreign process then execute the callback. :param callable callback: object
to call after acquiring the lock :param str path_to_lock: path to file or directory to lock
certbot.tests.util.skip_on_windows(reason)
Decorator to skip permanently a test on Windows. A reason is required.
certbot.tests.util.temp_join(path)
Return the given path joined to the tempdir path for the current platform Eg.: ‘cert’ => /tmp/cert (Linux) or
‘C:UserscurrentuserAppDataTempcert’ (Windows)
9.1.2 Submodules
certbot.achallenges module
chall = challenges.DNS(token='foo')
challb = messages.ChallengeBody(chall=chall)
achall = achallenges.DNS(chall=challb, domain='example.com')
achall.token == challb.token
class certbot.achallenges.AnnotatedChallenge(**kwargs)
Bases: josepy.util.ImmutableMap
Client annotated challenge.
Wraps around server provided challenge and annotates with data useful for the client.
Variables challb – Wrapped ChallengeBody.
acme_type = NotImplemented
challb
class certbot.achallenges.KeyAuthorizationAnnotatedChallenge(**kwargs)
Bases: certbot.achallenges.AnnotatedChallenge
Client annotated KeyAuthorizationChallenge challenge.
response_and_validation(*args, **kwargs)
Generate response and validation.
account_key
challb
domain
class certbot.achallenges.DNS(**kwargs)
Bases: certbot.achallenges.AnnotatedChallenge
certbot.crypto_util module
Note: keyname is the attempted filename, it may be different if a file already exists at the path.
Parameters
• key_size (int) – RSA key size in bits
• key_dir (str) – Key save directory.
• keyname (str) – Filename of key
Returns Key
Return type certbot.util.Key
Raises ValueError – If unable to generate the key given key_size.
certbot.crypto_util.verify_renewable_cert_sig(renewable_cert)
Verifies the signature of a RenewableCert object.
Parameters renewable_cert (certbot.interfaces.RenewableCert) – cert to verify
Raises errors.Error – If signature verification fails.
certbot.crypto_util.verify_signed_payload(public_key, signature, payload, signa-
ture_hash_algorithm)
Check the signature of a payload.
Parameters
Raises
• InvalidSignature – If signature verification fails.
• errors.Error – If public key type is not supported
certbot.crypto_util.verify_cert_matches_priv_key(cert_path, key_path)
Verifies that the private key and cert match.
Parameters
• cert_path (str) – path to a cert in PEM format
• key_path (str) – path to a private key file
Raises errors.Error – If they don’t match.
certbot.crypto_util.verify_fullchain(renewable_cert)
Verifies that fullchain is indeed cert concatenated with chain.
Parameters renewable_cert (certbot.interfaces.RenewableCert) – cert to verify
Raises errors.Error – If cert and chain do not combine to fullchain.
certbot.crypto_util.pyopenssl_load_certificate(data)
Load PEM/DER certificate.
Raises errors.Error –
certbot.crypto_util.get_sans_from_cert(cert, typ=1)
Get a list of Subject Alternative Names from a certificate.
Parameters
• cert (str) – Certificate (encoded).
• typ – crypto.FILETYPE_PEM or crypto.FILETYPE_ASN1
Returns A list of Subject Alternative Names.
Return type list
certbot.crypto_util.get_names_from_cert(csr, typ=1)
Get a list of domains from a cert, including the CN if it is set.
Parameters
• cert (str) – Certificate (encoded).
• typ – crypto.FILETYPE_PEM or crypto.FILETYPE_ASN1
Returns A list of domain names.
Return type list
certbot.crypto_util.dump_pyopenssl_chain(chain, filetype=1)
Dump certificate chain into a bundle.
certbot.errors module
exception certbot.errors.SubprocessError
Bases: certbot.errors.Error
Subprocess handling error.
exception certbot.errors.CertStorageError
Bases: certbot.errors.Error
Generic CertStorage error.
exception certbot.errors.HookCommandNotFound
Bases: certbot.errors.Error
Failed to find a hook command in the PATH.
exception certbot.errors.SignalExit
Bases: certbot.errors.Error
A Unix signal was received while in the ErrorHandler context manager.
exception certbot.errors.OverlappingMatchFound
Bases: certbot.errors.Error
Multiple lineages matched what should have been a unique result.
exception certbot.errors.LockError
Bases: certbot.errors.Error
File locking error.
exception certbot.errors.AuthorizationError
Bases: certbot.errors.Error
Authorization error.
exception certbot.errors.FailedChallenges(failed_achalls)
Bases: certbot.errors.AuthorizationError
Failed challenges error.
Variables failed_achalls (set) – Failed AnnotatedChallenge instances.
exception certbot.errors.PluginError
Bases: certbot.errors.Error
Certbot Plugin error.
exception certbot.errors.PluginEnhancementAlreadyPresent
Bases: certbot.errors.Error
Enhancement was already set
exception certbot.errors.PluginSelectionError
Bases: certbot.errors.Error
A problem with plugin/configurator selection or setup
exception certbot.errors.NoInstallationError
Bases: certbot.errors.PluginError
Certbot No Installation error.
exception certbot.errors.MisconfigurationError
Bases: certbot.errors.PluginError
Certbot Misconfiguration error.
exception certbot.errors.NotSupportedError
Bases: certbot.errors.PluginError
Certbot Plugin function not supported error.
exception certbot.errors.PluginStorageError
Bases: certbot.errors.PluginError
Certbot Plugin Storage error.
exception certbot.errors.StandaloneBindError(socket_error, port)
Bases: certbot.errors.Error
Standalone plugin bind error.
exception certbot.errors.ConfigurationError
Bases: certbot.errors.Error
Configuration sanity error.
exception certbot.errors.MissingCommandlineFlag
Bases: certbot.errors.Error
A command line argument was missing in noninteractive usage
certbot.interfaces module
setup(
...
entry_points={
'certbot.plugins': [
'name=example_project.plugin[plugin_deps]',
],
},
extras_require={
'plugin_deps': ['dep1', 'dep2'],
}
)
Therefore, make sure such objects are importable and usable without extras. This is necessary, because CLI
does the following operations (in order):
• loads an entry point,
• calls inject_parser_options,
• requires an entry point,
• creates plugin instance (__call__).
description
Short plugin description
__call__(config, name)
Create new IPlugin.
Parameters
• config (IConfig) – Configuration.
• name (str) – Unique plugin name.
inject_parser_options(parser, name)
Inject argument parser options (flags).
1. Be nice and prepend all options and destinations with option_namespace and dest_namespace.
2. Inject options (flags) only. Positional arguments are not allowed, as this would break the CLI.
Parameters
• parser (ArgumentParser) – (Almost) top-level CLI parser.
• name (str) – Unique plugin name.
interface certbot.interfaces.IPlugin
Certbot plugin.
prepare()
Prepare the plugin.
Finish up any additional initialization.
Raises
• PluginError – when full initialization cannot be completed.
• MisconfigurationError – when full initialization cannot be completed. Plugin will
be displayed on a list of available plugins.
• NoInstallationError – when the necessary programs/files cannot be located. Plu-
gin will NOT be displayed on a list of available plugins.
• NotSupportedError – when the installation is recognized, but the version is not cur-
rently supported.
more_info()
Human-readable string to help the user.
Should describe the steps taken and any relevant info to help the user decide which plugin to use.
Rtype str
interface certbot.interfaces.IAuthenticator
Extends: certbot.interfaces.IPlugin
Generic Certbot Authenticator.
Class represents all possible tools processes that have the ability to perform challenges and attain a certificate.
get_chall_pref(domain)
Return collections.Iterable of challenge preferences.
Parameters domain (str) – Domain for which challenge preferences are sought.
Returns collections.Iterable of challenge types (subclasses of acme.
challenges.Challenge) with the most preferred challenges first. If a type is
not specified, it means the Authenticator cannot perform the challenge.
Return type collections.Iterable
perform(achalls)
Perform the given challenge.
Parameters achalls (list) – Non-empty (guaranteed) list of AnnotatedChallenge in-
stances, such that it contains types found within get_chall_pref() only.
Returns collections.Iterable of ACME ChallengeResponse instances corre-
sponding to each provided Challenge.
Return type collections.Iterable of acme.challenges.
ChallengeResponse, where responses are required to be returned in the same
order as corresponding input challenges
Raises PluginError – If some or all challenges cannot be performed
cleanup(achalls)
Revert changes and shutdown after challenges complete.
This method should be able to revert all changes made by perform, even if perform exited abnormally.
Parameters achalls (list) – Non-empty (guaranteed) list of AnnotatedChallenge in-
stances, a subset of those previously passed to perform().
Raises PluginError – if original configuration cannot be restored
interface certbot.interfaces.IConfig
Certbot user-supplied configuration.
Warning: The values stored in the configuration have not been filtered, stripped or sanitized.
server
ACME Directory Resource URI.
email
Email used for registration and recovery contact. Use comma to register multiple emails, ex:
[email protected],[email protected]. (default: Ask).
rsa_key_size
Size of the RSA key.
must_staple
Adds the OCSP Must Staple extension to the certificate. Autoconfigures OCSP Stapling for supported
setups (Apache version >= 2.3.3 ).
config_dir
Configuration directory.
work_dir
Working directory.
accounts_dir
Directory where all account information is stored.
backup_dir
Configuration backups directory.
csr_dir
Directory where newly generated Certificate Signing Requests (CSRs) are saved.
in_progress_dir
Directory used before a permanent checkpoint is finalized.
key_dir
Keys storage.
temp_checkpoint_dir
Temporary checkpoint directory.
no_verify_ssl
Disable verification of the ACME server’s certificate.
http01_port
Port used in the http-01 challenge. This only affects the port Certbot listens on. A conforming ACME
server will still attempt to connect on port 80.
http01_address
The address the server listens to during http-01 challenge.
https_port
Port used to serve HTTPS. This affects which port Nginx will listen on after a LE certificate is installed.
pref_challs
Sorted user specified preferred challengestype strings with the most preferred challenge listed first
allow_subset_of_names
When performing domain validation, do not consider it a failure if authorizations can not be obtained for
a strict subset of the requested domains. This may be useful for allowing renewals for multiple domains to
succeed even if some domains no longer point at this system. This is a boolean
strict_permissions
Require that all configuration files are owned by the current user; only needed if your config is somewhere
unsafe like /tmp/.This is a boolean
disable_renew_updates
If updates provided by installer enhancements when Certbot is being run with “renew” verb should be
disabled.
interface certbot.interfaces.IInstaller
Extends: certbot.interfaces.IPlugin
Generic Certbot Installer Interface.
Represents any server that an X509 certificate can be placed.
It is assumed that save() is the only method that finalizes a checkpoint. This is important to ensure that
checkpoints are restored in a consistent manner if requested by the user or in case of an error.
Using certbot.reverter.Reverter to implement checkpoints, rollback, and recovery can dramatically
simplify plugin development.
get_all_names()
Returns all names that may be authenticated.
Return type collections.Iterable of str
deploy_cert(domain, cert_path, key_path, chain_path, fullchain_path)
Deploy certificate.
Parameters
• domain (str) – domain to deploy certificate file
• cert_path (str) – absolute path to the certificate file
• key_path (str) – absolute path to the private key file
• chain_path (str) – absolute path to the certificate chain file
• fullchain_path (str) – absolute path to the certificate fullchain file (cert plus chain)
Raises PluginError – when cert cannot be deployed
enhance(domain, enhancement, options=None)
Perform a configuration enhancement.
Parameters
• domain (str) – domain for which to provide enhancement
• enhancement (str) – An enhancement as defined in ENHANCEMENTS
• options – Flexible options parameter for enhancement. Check documentation of
ENHANCEMENTS for expected options for each enhancement.
Raises PluginError – If Enhancement is not supported, or if an error occurs during the
enhancement.
supported_enhancements()
Returns a collections.Iterable of supported enhancements.
Returns supported enhancements which should be a subset of ENHANCEMENTS
Return type collections.Iterable of str
save(title=None, temporary=False)
Saves all changes to the configuration files.
Both title and temporary are needed because a save may be intended to be permanent, but the save is not
ready to be a full checkpoint.
It is assumed that at most one checkpoint is finalized by this method. Additionally, if an exception is
raised, it is assumed a new checkpoint was not finalized.
Parameters
• title (str) – The title of the save. If a title is given, the configuration will be saved as
a new checkpoint and put in a timestamped directory. title has no effect if temporary
is true.
• temporary (bool) – Indicates whether the changes made will be quickly reversed in
the future (challenges)
Raises PluginError – when save is unsuccessful
rollback_checkpoints(rollback=1)
Revert rollback number of configuration checkpoints.
Raises PluginError – when configuration cannot be fully reverted
recovery_routine()
Revert configuration to most recent finalized checkpoint.
Remove all changes (temporary and permanent) that have not been finalized. This is useful to protect
against crashes and other execution interruptions.
Raises errors.PluginError – If unable to recover the configuration
config_test()
Make sure the configuration is valid.
Raises MisconfigurationError – when the config is not in a usable state
restart()
Restart or refresh the server content.
Raises PluginError – when server cannot be restarted
interface certbot.interfaces.IDisplay
Generic display.
notification(message, pause, wrap=True, force_interactive=False)
Displays a string message
Parameters
• message (str) – Message to display
• pause (bool) – Whether or not the application should pause for confirmation (if avail-
able)
• wrap (bool) – Whether or not the application should wrap text
• force_interactive (bool) – True if it’s safe to prompt the user because it won’t
cause any workflow regressions
menu(message, choices, ok_label=None, cancel_label=None, help_label=None, default=None,
cli_flag=None, force_interactive=False)
Displays a generic menu.
When not setting force_interactive=True, you must provide a default value.
Parameters
• message (str) – message to display
• choices (list of tuple() or str) – choices
• ok_label (str) – label for OK button (UNUSED)
• cancel_label (str) – label for Cancel button (UNUSED)
• help_label (str) – label for Help button (UNUSED)
print_messages(self )
Prints messages to the user and clears the message queue.
class certbot.interfaces.RenewableCert
Bases: object
Interface to a certificate lineage.
cert_path
Path to the certificate file.
Return type str
key_path
Path to the private key file.
Return type str
chain_path
Path to the certificate chain file.
Return type str
fullchain_path
Path to the full chain file.
The full chain is the certificate file plus the chain file.
Return type str
lineagename
Name given to the certificate lineage.
Return type str
names()
What are the subject names of this certificate?
Returns the subject names
Return type list of str
Raises CertStorageError – if could not find cert file.
class certbot.interfaces.GenericUpdater
Bases: object
Interface for update types not currently specified by Certbot.
This class allows plugins to perform types of updates that Certbot hasn’t defined (yet).
To make use of this interface, the installer should implement the interface methods, and inter-
faces.GenericUpdater.register(InstallerClass) should be called from the installer code.
The plugins implementing this enhancement are responsible of handling the saving of configuration checkpoints
as well as other calls to interface methods of interfaces.IInstaller such as prepare() and restart()
generic_updates(lineage, *args, **kwargs)
Perform any update types defined by the installer.
If an installer is a subclass of the class containing this method, this function will always be called when
“certbot renew” is run. If the update defined by the installer should be run conditionally, the installer needs
to handle checking the conditions itself.
This method is called once for each lineage.
Parameters lineage (RenewableCert) – Certificate lineage object
class certbot.interfaces.RenewDeployer
Bases: object
Interface for update types run when a lineage is renewed
This class allows plugins to perform types of updates that need to run at lineage renewal that Certbot hasn’t
defined (yet).
To make use of this interface, the installer should implement the interface methods, and inter-
faces.RenewDeployer.register(InstallerClass) should be called from the installer code.
renew_deploy(lineage, *args, **kwargs)
Perform updates defined by installer when a certificate has been renewed
If an installer is a subclass of the class containing this method, this function will always be called when a
certficate has been renewed by running “certbot renew”. For example if a plugin needs to copy a certificate
over, or change configuration based on the new certificate.
This method is called once for each lineage renewed
Parameters lineage (RenewableCert) – Certificate lineage object
certbot.main module
certbot.ocsp package
certbot.reverter module
revert_temporary_config()
Reload users original configuration files after a temporary save.
This function should reinstall the users original configuration files for all saves with temporary=True
Raises ReverterError – when unable to revert config
rollback_checkpoints(rollback=1)
Revert ‘rollback’ number of configuration checkpoints.
Parameters rollback (int) – Number of checkpoints to reverse. A str num will be cast to
an integer. So “2” is also acceptable.
Raises ReverterError – if there is a problem with the input or if the function is unable to
correctly revert the configuration checkpoints
add_to_temp_checkpoint(save_files, save_notes)
Add files to temporary checkpoint.
Parameters
Warning: This function does not enforce order of operations in terms of file modification vs. com-
mand registration. All undo commands are run first before all normal files are reverted to their previous
state. If you need to maintain strict order, you may create checkpoints before and after the the command
registration. This function may be improved in the future based on demand.
Parameters
• temporary (bool) – Whether the command should be saved in the IN_PROGRESS or
TEMPORARY checkpoints.
• command (list of str) – Command to be run.
recovery_routine()
Revert configuration to most recent finalized checkpoint.
Remove all changes (temporary and permanent) that have not been finalized. This is useful to protect
against crashes and other execution interruptions.
Raises errors.ReverterError – If unable to recover the configuration
finalize_checkpoint(title)
Finalize the checkpoint.
Timestamps and permanently saves all changes made through the use of add_to_checkpoint() and
register_file_creation()
Parameters title (str) – Title describing checkpoint
Raises certbot.errors.ReverterError – when the checkpoint is not able to be final-
ized.
certbot.util module
TEN
• genindex
• modindex
• search
109
Certbot Documentation, Release 1.4.0.dev0
c
certbot, 57
certbot.achallenges, 86
certbot.compat, 57
certbot.compat.filesystem, 57
certbot.compat.misc, 59
certbot.compat.os, 59
certbot.crypto_util, 87
certbot.display, 69
certbot.display.ops, 69
certbot.display.util, 71
certbot.errors, 90
certbot.interfaces, 92
certbot.main, 101
certbot.ocsp, 101
certbot.plugins, 75
certbot.plugins.common, 75
certbot.plugins.dns_common, 78
certbot.plugins.dns_common_lexicon, 79
certbot.plugins.dns_test_common, 80
certbot.plugins.dns_test_common_lexicon,
80
certbot.plugins.enhancements, 81
certbot.plugins.storage, 83
certbot.plugins.util, 83
certbot.reverter, 102
certbot.tests, 83
certbot.tests.acme_util, 84
certbot.tests.util, 84
certbot.util, 104
111
Certbot Documentation, Release 1.4.0.dev0
113
Certbot Documentation, Release 1.4.0.dev0
114 Index
Certbot Documentation, Release 1.4.0.dev0
Index 115
Certbot Documentation, Release 1.4.0.dev0
116 Index
Certbot Documentation, Release 1.4.0.dev0
MisconfigurationError, 91 P
MissingCommandlineFlag, 92 patch_get_utility() (in module certbot.tests.util), 85
mkdir() (in module certbot.compat.filesystem), 58 patch_get_utility_with_stdout() (in module cert-
mkdir() (in module certbot.compat.os), 60 bot.tests.util), 85
mkfifo() (in module certbot.compat.os), 63 path_surgery() (in module certbot.plugins.util), 83
mknod() (in module certbot.compat.os), 63 pathconf() (in module certbot.compat.os), 63
more_info() (certbot.interfaces.IPlugin method), 94 pem (certbot.util.Key attribute), 104
must_staple (certbot.interfaces.IConfig attribute), 95 perform() (certbot.interfaces.IAuthenticator method), 94
perform() (certbot.plugins.common.ChallengePerformer
N method), 77
n_fields (certbot.compat.os.stat_result attribute), 64 perform() (certbot.plugins.dns_common.DNSAuthenticator
n_fields (certbot.compat.os.statvfs_result attribute), 65 method), 78
n_sequence_fields (certbot.compat.os.stat_result at- pipe() (in module certbot.compat.os), 63
tribute), 64 Plugin (class in certbot.plugins.common), 75
n_sequence_fields (certbot.compat.os.statvfs_result at- PluginEnhancementAlreadyPresent, 91
tribute), 66 PluginError, 91
n_unnamed_fields (certbot.compat.os.stat_result at- PluginSelectionError, 91
tribute), 64 PluginStorage (class in certbot.plugins.storage), 83
n_unnamed_fields (certbot.compat.os.statvfs_result at- PluginStorageError, 92
tribute), 66 popen() (in module certbot.compat.os), 63
names() (certbot.interfaces.RenewableCert method), 100 popen2() (in module certbot.compat.os), 69
nice() (in module certbot.compat.os), 63 popen3() (in module certbot.compat.os), 69
no_verify_ssl (certbot.interfaces.IConfig attribute), 95 popen4() (in module certbot.compat.os), 69
NoInstallationError, 91 populate_cli() (in module certbot.plugins.enhancements),
NoninteractiveDisplay (class in certbot.display.util), 73 82
normalized_tuple() (certbot.plugins.common.Addr pref_challs (certbot.interfaces.IConfig attribute), 95
method), 77 prepare() (certbot.interfaces.IPlugin method), 93
notAfter() (in module certbot.crypto_util), 90 prepare() (certbot.plugins.dns_common.DNSAuthenticator
notBefore() (in module certbot.crypto_util), 90 method), 78
notification() (certbot.display.util.FileDisplay method), print_messages() (certbot.interfaces.IReporter method),
71 99
notification() (certbot.display.util.NoninteractiveDisplay put() (certbot.plugins.storage.PluginStorage method), 83
method), 73 putenv() (in module certbot.compat.os), 63
notification() (certbot.interfaces.IDisplay method), 97 pyopenssl_load_certificate() (in module cert-
NotSupportedError, 91 bot.crypto_util), 89
O R
ocsp_revoked() (certbot.ocsp.RevocationChecker raise_for_non_administrative_windows_rights() (in mod-
method), 101 ule certbot.compat.misc), 59
ocsp_revoked_by_paths() (cert- read() (in module certbot.compat.os), 63
bot.ocsp.RevocationChecker method), 101 readline_with_timeout() (in module cert-
OK (in module certbot.display.util), 71 bot.compat.misc), 59
open() (in module certbot.compat.filesystem), 58 readlink() (in module certbot.compat.os), 63
open() (in module certbot.compat.os), 60 realpath() (in module certbot.compat.filesystem), 58
openpty() (in module certbot.compat.os), 63 record_content (certbot.plugins.dns_test_common_lexicon.BaseLexiconClie
option_name() (certbot.plugins.common.Plugin method), attribute), 81
76 record_name (certbot.plugins.dns_test_common_lexicon.BaseLexiconClien
option_namespace (certbot.plugins.common.Plugin at- attribute), 80
tribute), 76 record_prefix (certbot.plugins.dns_test_common_lexicon.BaseLexiconClien
option_namespace() (in module cert- attribute), 80
bot.plugins.common), 75 recovery_routine() (certbot.interfaces.IInstaller method),
OverlappingMatchFound, 91 97
recovery_routine() (certbot.plugins.common.Installer
method), 76
Index 117
Certbot Documentation, Release 1.4.0.dev0
118 Index
Certbot Documentation, Release 1.4.0.dev0
T test_more_info() (certbot.plugins.dns_test_common.BaseAuthenticatorTest
tcgetpgrp() (in module certbot.compat.os), 66 method), 80
tcsetpgrp() (in module certbot.compat.os), 66 test_parser_arguments() (cert-
tearDown() (certbot.tests.util.TempDirTestCase method), bot.plugins.dns_test_common.BaseAuthenticatorTest
85 method), 80
temp_checkpoint_dir (certbot.interfaces.IConfig at- test_perform() (certbot.plugins.dns_test_common_lexicon.BaseLexiconAuth
tribute), 95 method), 80
temp_join() (in module certbot.tests.util), 86 times() (in module certbot.compat.os), 66
TempDirTestCase (class in certbot.tests.util), 85 tmpfile() (in module certbot.compat.os), 66
tempnam() (in module certbot.compat.os), 66 tmpnam() (in module certbot.compat.os), 66
test_add_txt_record() (cert- ttyname() (in module certbot.compat.os), 66
bot.plugins.dns_test_common_lexicon.BaseLexiconClientTest
method), 81 U
test_add_txt_record_error_adding_record() (cert- umask() (in module certbot.compat.os), 66
uname() (in module certbot.compat.os), 66
bot.plugins.dns_test_common_lexicon.BaseLexiconClientTest
method), 81 underscores_for_unsupported_characters_in_path() (in
test_add_txt_record_error_finding_domain() (cert- module certbot.compat.misc), 59
bot.plugins.dns_test_common_lexicon.BaseLexiconClientTest (in module certbot.util), 105
unique_file()
method), 81 unique_lineage_name() (in module certbot.util), 105
test_add_txt_record_fail_to_authenticate() (cert- UNKNOWN_LOGIN_ERROR (cert-
bot.plugins.dns_test_common_lexicon.BaseLexiconClientTest bot.plugins.dns_test_common_lexicon.BaseLexiconClientTest
method), 81 attribute), 80
unlink()
test_add_txt_record_fail_to_authenticate_with_unknown_error() (in module certbot.compat.os), 66
unsetenv() (in
(certbot.plugins.dns_test_common_lexicon.BaseLexiconClientTest module certbot.compat.os), 66
method), 81 update_autohsts() (cert-
test_add_txt_record_fail_to_find_domain() (cert- bot.plugins.enhancements.AutoHSTSEnhancement
bot.plugins.dns_test_common_lexicon.BaseLexiconClientTest method), 82
method), 81 updated_ssl_dhparams_digest (cert-
test_add_txt_record_try_twice_to_find_domain() (cert- bot.plugins.common.Installer attribute),
bot.plugins.dns_test_common_lexicon.BaseLexiconClientTest 77
method), 81 urandom() (in module certbot.compat.os), 66
utime() (in module certbot.compat.os), 66
test_cleanup() (certbot.plugins.dns_test_common_lexicon.BaseLexiconAuthenticatorTest
method), 80
test_del_txt_record() (cert- V
bot.plugins.dns_test_common_lexicon.BaseLexiconClientTest
valid_csr() (in module certbot.crypto_util), 87
method), 81 valid_privkey() (in module certbot.crypto_util), 88
test_del_txt_record_error_deleting_record() (cert- validate_file() (in module certbot.plugins.dns_common),
bot.plugins.dns_test_common_lexicon.BaseLexiconClientTest 79
method), 81 validate_file_permissions() (in module cert-
test_del_txt_record_error_finding_domain() (cert- bot.plugins.dns_common), 79
bot.plugins.dns_test_common_lexicon.BaseLexiconClientTest
validated_directory() (in module certbot.display.ops), 71
method), 81 validated_input() (in module certbot.display.ops), 70
test_del_txt_record_fail_to_authenticate() (cert- vector_path() (in module certbot.tests.util), 84
bot.plugins.dns_test_common_lexicon.BaseLexiconClientTest
verify_cert_matches_priv_key() (in module cert-
method), 81 bot.crypto_util), 89
test_del_txt_record_fail_to_authenticate_with_unknown_error()
verify_fullchain() (in module certbot.crypto_util), 89
(certbot.plugins.dns_test_common_lexicon.BaseLexiconClientTest
verify_renewable_cert() (in module certbot.crypto_util),
method), 81 88
test_del_txt_record_fail_to_find_domain() (cert- verify_renewable_cert_sig() (in module cert-
bot.plugins.dns_test_common_lexicon.BaseLexiconClientTest bot.crypto_util), 88
method), 81 verify_signed_payload() (in module certbot.crypto_util),
test_get_chall_pref() (cert- 88
bot.plugins.dns_test_common.BaseAuthenticatorTest
method), 80
Index 119
Certbot Documentation, Release 1.4.0.dev0
W
wait() (in module certbot.compat.os), 66
wait3() (in module certbot.compat.os), 66
wait4() (in module certbot.compat.os), 67
waitpid() (in module certbot.compat.os), 67
walk() (in module certbot.compat.os), 67
WCOREDUMP() (in module certbot.compat.os), 60
WEXITSTATUS() (in module certbot.compat.os), 60
WIFCONTINUED() (in module certbot.compat.os), 60
WIFEXITED() (in module certbot.compat.os), 60
WIFSIGNALED() (in module certbot.compat.os), 60
WIFSTOPPED() (in module certbot.compat.os), 60
work_dir (certbot.interfaces.IConfig attribute), 95
write() (in module certbot.compat.os), 67
write() (in module certbot.plugins.dns_test_common), 80
WSTOPSIG() (in module certbot.compat.os), 60
WTERMSIG() (in module certbot.compat.os), 60
Y
yesno() (certbot.display.util.FileDisplay method), 72
yesno() (certbot.display.util.NoninteractiveDisplay
method), 74
yesno() (certbot.interfaces.IDisplay method), 98
120 Index