Skip to content

Latest commit

 

History

History
673 lines (505 loc) · 28.3 KB

using.rst

File metadata and controls

673 lines (505 loc) · 28.3 KB

User Guide

The Let's Encrypt Client presently only runs on Unix-ish OSes that include Python 2.6 or 2.7; Python 3.x support will hopefully be added in the future. The client requires root access in order to write to /etc/letsencrypt, /var/log/letsencrypt, /var/lib/letsencrypt; to bind to ports 80 and 443 (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 OS with augeas version 1.0; currently it supports modern OSes based on Debian, Fedora, SUSE, Gentoo and Darwin.

The Certbot client uses a number of different "commands" (also referred to, equivalently, as "subcommands") to request specific actions such as obtaining, renewing, or revoking certificates. Some of the most important and most commonly-used commands will be discussed throughout this document; an exhaustive list also appears near the end of the document. ======= 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 provided 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.

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.

If you are offline or your operating system doesn't provide a package, you can use an alternate method fo install certbot.

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:

user@webserver:~$ wget https://dl.eff.org/certbot-auto
user@webserver:~$ chmod a+x ./certbot-auto
user@webserver:~$ ./certbot-auto --help

Hint

The certbot-auto download is protected by HTTPS, which is pretty good, but if you'd like to double check the integrity of the certbot-auto script, you can use these steps for verification before running it:

user@server:~$ wget -N https://dl.eff.org/certbot-auto.asc
user@server:~$ gpg2 --recv-key A2CFB51FA275A7286234E7B24D17C995CD9775F2
user@server:~$ gpg2 --trusted-key 4D17C995CD9775F2 --verify certbot-auto.asc certbot-auto

The certbot-auto command updates to the latest client release automatically. Since certbot-auto is a wrapper to certbot, it accepts exactly the same command line flags and arguments. For more information, see Certbot command-line options.

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 :ref:`where-certs` 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 cert for resolves to, install Docker, then issue the following command:

sudo docker run -it --rm -p 443:443 -p 80:80 --name certbot \
            -v "/etc/letsencrypt:/etc/letsencrypt" \
            -v "/var/lib/letsencrypt:/var/lib/letsencrypt" \
            quay.io/letsencrypt/letsencrypt:latest certonly

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.

For more information about the layout of the /etc/letsencrypt directory, see :ref:`where-certs`.

FreeBSD

  • Port: cd /usr/ports/security/py-certbot && make install clean
  • Package: pkg install py27-certbot

OpenBSD

  • Port: cd /usr/ports/security/letsencrypt/client && make install clean
  • Package: pkg_add letsencrypt

Arch Linux

sudo pacman -S certbot

Debian

If you run Debian Stretch or Debian Sid, you can install certbot packages.

sudo apt-get update
sudo apt-get install certbot python-certbot-apache

If you don't want to use the Apache plugin, you can omit the python-certbot-apache package.

Packages exist for Debian Jessie via backports. First you'll have to follow the instructions at http://backports.debian.org/Instructions/ to enable the Jessie backports repo, if you have not already done so. Then run:

sudo apt-get install letsencrypt python-letsencrypt-apache -t jessie-backports

Fedora

sudo dnf install letsencrypt

Gentoo

The official Certbot client is available in Gentoo Portage. If you want to use the Apache plugin, it has to be installed separately:

emerge -av app-crypt/letsencrypt
emerge -av app-crypt/letsencrypt-apache

Currently, only the Apache plugin is included in Portage. However, if you Warning! You can use Layman to add the mrueg overlay which does include a package for the Certbot Nginx plugin, however, this plugin is known to be buggy and should only be used with caution after creating a backup up your Nginx configuration. We strongly recommend you use the app-crypt/letsencrypt package instead until the Nginx plugin is ready.

emerge -av app-portage/layman
layman -S
layman -a mrueg
emerge -av app-crypt/letsencrypt-nginx

When using the Apache plugin, you will run into a "cannot find a cert or key directive" 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.

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 :doc:`packaging`.

Installation from source is only supported for developers and the whole process is described in the :doc:`contributing`.

Warning

Please do not use python setup.py install or python pip install .. Please do not attempt the installation commands as superuser/root and/or without virtual environment, e.g. sudo python 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!

The Certbot client supports a number of different "plugins" that can be used to obtain and/or install certificates.

Plugins that can obtain a cert are called "authenticators" and can be used with the "certonly" command. This will carry out the steps needed to validate that you control the domain(s) you are requesting a cert for, obtain a cert for the specified domain(s), and place it in the /etc/letsencrypt directory on your machine - without editing 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 seperate certificates you will need to run Certbot multiple times.

Plugins that can install a cert are called "installers" and can be used with the "install" command. These plugins can modify your webserver'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.

Plugin Auth Inst Notes
apache Y Y Automates obtaining and installing a cert with Apache 2.4 on Debian-based distributions with libaugeas0 1.0+.
webroot Y N Obtains a cert by writing to the webroot directory of an already running webserver.
standalone Y N Uses a "standalone" webserver to obtain a cert. Requires port 80 or 443 to be available. This is useful on systems with no webserver, or when direct integration with the local webserver is not supported or not desired.
manual Y N Helps you obtain a cert by giving you instructions to perform domain validation yourself.
nginx Y Y Very experimental and not included in certbot-auto.

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.

The Apache plugin currently requires OS with augeas version 1.0; currently it supports modern OSes based on Debian, Fedora, SUSE, Gentoo and Darwin. This automates both obtaining and installing certs on an Apache webserver. To specify this plugin on the command line, simply include --apache.

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 cert 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,

certbot certonly --webroot -w /var/www/example/ -d www.example.com -d example.com -w /var/www/other -d other.example.net -d another.other.example.net

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:

66.133.109.36 - - [05/Jan/2016:20:11:24 -0500] "GET /.well-known/acme-challenge/HGr8U1IeTW4kY_Z6UIyaakzOkyQgPr_7ArlLgtZE8SX HTTP/1.1" 200 87 "-" "Mozilla/5.0 (compatible; Let's Encrypt validation server; +https://www.letsencrypt.org)"

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.

To obtain a cert 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 or 443 in order to perform domain validation, so you may need to stop your existing webserver. To control which port the plugin uses, include one of the options shown below on the command line.

  • --standalone-supported-challenges http-01 to use port 80
  • --standalone-supported-challenges tls-sni-01 to use port 443

The standalone plugin does not rely on any other server software running on the machine where you obtain the certificate. It must still be possible for that machine to accept inbound connections from the Internet on the specified port using each requested domain name.

If you'd like to obtain a cert 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 cert 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.

In the future, if you're running Nginx you will hopefully be able to use this plugin to automatically obtain and install your certificate. The Nginx plugin is still experimental, however, and is not installed with certbot-auto. If installed, you can select this plugin on the command line by including --nginx.

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:

Plugin Auth Inst Notes
plesk Y Y Integration with the Plesk web hosting tool
haproxy Y Y Integration with the HAProxy load balancer
s3front Y Y Integration with Amazon CloudFront distribution of S3 buckets
gandi Y Y Integration with Gandi's hosting products and API
varnish Y N Obtain certs via a Varnish server
external Y N A plugin for convenient scripting (See also ticket 2782)
icecast N Y Deploy certs to Icecast 2 streaming media servers
pritunl N Y Install certs in pritunl distributed OpenVPN servers
proxmox N Y Install certs in Proxmox Virtualization servers
postfix N Y STARTTLS Everywhere is becoming a Certbot Postfix/Exim plugin

If you're interested, you can also :ref:`write your own plugin <dev-plugin>`.

Running Certbot with the certonly or run commands always requests the creation of a single new certificate, even if you already have an existing certificate with some of the same domain names. The --force-renewal, --duplicate, and --expand options control Certbot's behavior in this case. 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 and every domain must be explicitly specified via -d.) If successful, this certificate will be 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 explicitly requesting the renewal of a specific individual certificate.

--duplicate tells Certbot to create a separate, unrelated certificate with the same domains as an existing certificate. This certificate will be saved completely separately from the prior one. Most users probably do not want this behavior.

--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.

--allow-subset-of-names tells Certbot to continue with cert generation if only some of the specified domain authorazations 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.

Certbot also provides a renew command. This command examines all existing certificates to determine whether or not each is near expiry. For any existing certificate that is near expiry, certbot renew will attempt to obtain a new certificate for the same domains. 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 will only renew certificates that are near expiry it can be run as frequently as you want - since it will usually take no action.

Typically, certbot renew runs a reduced risk of rate-limit problems because it renews certificates only when necessary, and because some of the Let's Encrypt CA's rate limit policies treat the issuance of a new certificate under these circumstances more generously. More details about the use of certbot renew are provided below.

Note

Let's Encrypt CA issues short-lived certificates (90 days). Make sure you renew the certificates at least once in 3 months.

The certbot client now 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 will attempt 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.

You can also specify hooks to be run before or after a certificate is renewed. For example, if you have only a single cert and you obtained it using the standalone plugin, it will be used by default when renewing. In that case you may want to use a command like this to renew your certificate.

certbot renew --pre-hook "service nginx stop" --post-hook "service nginx start"

This will stop Nginx so standalone can bind to the necessary ports and then restart Nginx after the plugin is finished. The hooks will only be run if a certificate is due for renewal, so you can run this command frequently without unnecessarily stopping your webserver. More information about renewal 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 one individual 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 on improving the renewal process, and we apologize for any inconveniences you encounter in integrating these commands into your individual environment.

Certbot supports a lot of command line options. Here's the full list, from certbot --help all:

.. literalinclude:: cli-help.txt

All generated keys and issued certificates can be found in /etc/letsencrypt/live/$domain. 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.

Note

/etc/letsencrypt/archive and /etc/letsencrypt/keys contain all previous keys and certificates, while /etc/letsencrypt/live symlinks to the latest versions.

The following files are available:

privkey.pem

Private key for the certificate.

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.

This is what Apache needs for SSLCertificateKeyFile, and nginx for ssl_certificate_key.

cert.pem

Server certificate only.

This is what Apache < 2.4.8 needs for SSLCertificateFile.

chain.pem

All certificates that need to be served by the browser excluding server certificate, i.e. root and intermediate certificates only.

This is what Apache < 2.4.8 needs for SSLCertificateChainFile, and what nginx >= 1.3.7 needs for ssl_trusted_certificate.

fullchain.pem

All certificates, including server certificate. This is concatenation of cert.pem and chain.pem.

This is what Apache >= 2.4.8 needs for SSLCertificateFile, and what nginx needs for ssl_certificate.

For both chain files, all certificates are ordered from root (primary certificate) towards leaf.

Please note, that you must use either chain.pem or fullchain.pem. In case of webservers, using only cert.pem, will cause nasty errors served through the browsers!

Note

All files are PEM-encoded (as the filename suffix suggests). If you need other format, such as DER or PFX, then you could convert using openssl. You can automate that with --renew-hook if you're using automatic renewal.

It is possible to specify configuration file with certbot-auto --config cli.ini (or shorter -c cli.ini). An example configuration file is shown below:

By default, the following locations are searched:

  • /etc/letsencrypt/cli.ini
  • $XDG_CONFIG_HOME/letsencrypt/cli.ini (or ~/.config/letsencrypt/cli.ini if $XDG_CONFIG_HOME is not set).

If you're having problems you can chat with us on IRC (#certbot @ OFTC) or at IRC (#letsencrypt @ freenode) or get support on the Let's Encrypt forums.

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 personally identifiable information, including your email and domains)
  • copy and paste logs from /var/log/letsencrypt (though mind they also might contain personally identifiable information)
  • copy and paste certbot --version output
  • your operating system, including specific version
  • specify which installation method you've chosen