An ACME-based certificate authority, written in Go.
Go to file
Aaron Gable 9ac85891bb
lint: check that cert doesn't have extra +1s (#5677)
Add a new lint, which applies to all certs, not just one kind of
root/intermediate/subscriber cert, which checks that the validity
period is a round number of minutes; i.e. that it doesn't have an
extra second of validity, like 90d+1s.

In general, if all certs are issued with validities much less than
the limits imposed by root program requirements, being off by one
second one way or another shouldn't matter much. But since it is
easy to mistakenly configure a cert to have notBefore and notAfter
timestamps with the exact same second value, this lint will force
people configuring profiles to think critically about their cert
lifetimes.

Fixes #5669
2021-09-30 11:00:56 -07:00
.github/workflows Add maintainer, ldflags, and vendor to goreleaser (#5657) 2021-09-21 13:33:54 -06:00
akamai Unify protobuf generation (#5458) 2021-06-07 08:49:15 -07:00
bdns BDNS: Ensure DNS server addresses are dialable (#5520) 2021-07-20 10:11:11 -07:00
ca Compute OCSP validity interval correctly (#5680) 2021-09-30 11:00:24 -07:00
canceled tidy: typo fixes flagged by codespell (#4634) 2020-01-07 14:01:26 -05:00
cmd Remove sa-wrappers.go (#5663) 2021-09-27 13:25:41 -07:00
core Remove sa-wrappers.go (#5663) 2021-09-27 13:25:41 -07:00
csr Introduce new core.AcmeChallenge type (#5012) 2020-08-11 15:02:16 -07:00
ctpolicy publisher: remove storeSCT from proto #5380 2021-04-02 15:31:24 -07:00
data Fixes Mandrill UNSUB merge tag (#2524) 2017-01-25 10:53:17 -08:00
db Add new SA.NewOrderAndAuthzs gRPC method (#5602) 2021-09-03 13:48:04 -07:00
docs Update divergences for mandatory POST-as-GET (#5564) 2021-08-04 17:16:09 -07:00
errors Remove nearly-unused WrongAuthorizationState error (#5176) 2020-11-12 15:38:16 -08:00
features Add new SA.NewOrderAndAuthzs gRPC method (#5602) 2021-09-03 13:48:04 -07:00
goodkey Remove sa-wrappers.go (#5663) 2021-09-27 13:25:41 -07:00
grpc Remove sa-wrappers.go (#5663) 2021-09-27 13:25:41 -07:00
iana Require email domains end in a IANA suffix (#4037) 2019-01-28 17:05:58 -08:00
identifier core: split identifier types into separate package. (#4225) 2019-05-23 13:24:41 -07:00
issuance Update TODOs for Issue #5152 (#5591) 2021-08-19 14:31:09 -07:00
linter lint: check that cert doesn't have extra +1s (#5677) 2021-09-30 11:00:56 -07:00
log Add waiting mock log writer (#5359) 2021-04-01 10:53:21 -07:00
mail mail: Fix data race in unit tests (#5491) 2021-06-17 10:43:02 -07:00
metrics Switch away from old style statsd metrics wrappers (#4606) 2019-12-18 11:08:25 -05:00
mocks Remove sa-wrappers.go (#5663) 2021-09-27 13:25:41 -07:00
nonce Unify protobuf generation (#5458) 2021-06-07 08:49:15 -07:00
observer Make boulder-observer HTTP User-Agent configurable (#5484) 2021-06-14 11:08:18 -06:00
ocsp Honeycomb integration proof-of-concept (#5408) 2021-05-24 16:13:08 -07:00
pkcs11helpers Check for CKA_LABEL in NewSigner. (#5067) 2020-08-31 18:17:35 -07:00
policy Use error wrapping for berrors and tests (#5169) 2020-11-06 13:17:11 -08:00
policyasn1 ca: implement our own certificate issuance lib (#5007) 2020-08-17 15:53:28 -07:00
probs GRPC: Log user-initiated cancellations as HTTP 408 (#5546) 2021-07-30 16:10:16 -07:00
publisher Unify protobuf generation (#5458) 2021-06-07 08:49:15 -07:00
ra Remove sa-wrappers.go (#5663) 2021-09-27 13:25:41 -07:00
ratelimit GRPC: Unwrap SA Count methods (#5616) 2021-08-30 15:54:42 -07:00
reloader Spelling (#2500) 2017-01-16 10:44:52 -05:00
revocation Handful of revocation pkg cleanups (#4801) 2020-04-30 17:29:42 -07:00
sa Remove sa-wrappers.go (#5663) 2021-09-27 13:25:41 -07:00
test Sync RA feature flags (#5678) 2021-09-30 11:00:41 -07:00
va BDNS: Ensure DNS server addresses are dialable (#5520) 2021-07-20 10:11:11 -07:00
vendor Upgrade dependency weppos/publicsuffix-go (#5660) 2021-09-17 14:22:03 -06:00
web Honeycomb integration proof-of-concept (#5408) 2021-05-24 16:13:08 -07:00
wfe Remove sa-wrappers.go (#5663) 2021-09-27 13:25:41 -07:00
wfe2 Remove sa-wrappers.go (#5663) 2021-09-27 13:25:41 -07:00
x509crl cmd/ceremony: add CRL generation (#4892) 2020-07-07 14:17:41 -07:00
.codespell.ignore.txt CI: Add codespell to detect common typos. (#4637) 2020-01-07 17:09:51 -08:00
.dockerignore Roll forward "Run Travis tests in Docker (#1830)" (#1838) 2016-05-24 15:11:22 -07:00
.gitignore Add PKCS#11 certificate generation tool (#3729) 2018-06-12 12:13:09 -07:00
.golangci.yml Anchor all referenced loop variables (#4991) 2020-07-29 12:57:30 -07:00
.goreleaser.yml Add maintainer, ldflags, and vendor to goreleaser (#5657) 2021-09-21 13:33:54 -06:00
CODEOWNERS Update CODEOWNERS (#3446) 2018-02-14 16:22:13 -05:00
CODE_OF_CONDUCT.md Format top-level markdown docs (#4890) 2020-06-23 10:55:26 -07:00
CONTRIBUTING.md Remove Travis-CI (#5356) 2021-03-19 17:49:05 -07:00
LICENSE.txt Remove all stray copyright headers and appends the initial line to LICENSE.txt (#1853) 2016-05-31 12:32:04 -07:00
Makefile Package ct-test-srv into .deb (#5465) 2021-06-08 13:49:03 -07:00
README.md Avoid insecure HTTP link to gRPC in favor of HTTPS (#5579) 2021-08-13 13:59:44 -07:00
docker-compose.next.yml Cleanup docker-compose configuration (#5335) 2021-03-11 17:33:13 -08:00
docker-compose.yml Remove go 1.16.6 from testing (#5636) 2021-09-07 15:34:54 -06:00
go.mod Upgrade dependency weppos/publicsuffix-go (#5660) 2021-09-17 14:22:03 -06:00
go.sum Upgrade dependency weppos/publicsuffix-go (#5660) 2021-09-17 14:22:03 -06:00
start.py Remove the last mention of RabbitMQ (in start.py) (#5189) 2020-12-01 17:50:10 -08:00
test.sh Add deb target to the Makefile (#5375) 2021-04-02 13:13:27 -07:00

README.md

Boulder - An ACME CA

Build Status

This is an implementation of an ACME-based CA. The ACME protocol allows the CA to automatically verify that an applicant for a certificate actually controls an identifier, and allows domain holders to issue and revoke certificates for their domains. Boulder is the software that runs Let's Encrypt.

Contents

Overview

Boulder is divided into the following main components:

  1. Web Front Ends (one per API version)
  2. Registration Authority
  3. Validation Authority
  4. Certificate Authority
  5. Storage Authority
  6. Publisher
  7. OCSP Updater
  8. OCSP Responder

This component model lets us separate the function of the CA by security context. The Web Front End, Validation Authority, OCSP Responder and Publisher need access to the Internet, which puts them at greater risk of compromise. The Registration Authority can live without Internet connectivity, but still needs to talk to the Web Front End and Validation Authority. The Certificate Authority need only receive instructions from the Registration Authority. All components talk to the SA for storage, so most lines indicating SA RPCs are not shown here.

                             +--------- OCSP Updater
                             |               |
                             v               |
                            CA -> Publisher  |
                             ^               |
                             |               v
       Subscriber -> WFE --> RA --> SA --> MariaDB
                             |               ^
Subscriber server <- VA <----+               |
                                             |
          Browser ------------------>  OCSP Responder

Internally, the logic of the system is based around five types of objects: accounts, authorizations, challenges, orders (for ACME v2) and certificates, mapping directly to the resources of the same name in ACME.

We run two Web Front Ends, one for each ACME API version. Only the front end components differentiate between API version. Requests from ACME clients result in new objects and changes to objects. The Storage Authority maintains persistent copies of the current set of objects.

Objects are also passed from one component to another on change events. For example, when a client provides a successful response to a validation challenge, it results in a change to the corresponding validation object. The Validation Authority forwards the new validation object to the Storage Authority for storage, and to the Registration Authority for any updates to a related Authorization object.

Boulder uses gRPC for inter-component communication. For components that you want to be remote, it is necessary to instantiate a "client" and "server" for that component. The client implements the component's Go interface, while the server has the actual logic for the component. A high level overview for this communication model can be found in the gRPC documentation.

The full details of how the various ACME operations happen in Boulder are laid out in DESIGN.md.

Setting up Boulder

Development

Boulder has a Dockerfile and uses Docker Compose to make it easy to install and set up all its dependencies. This is how the maintainers work on Boulder, and is our main recommended way to run it for development/experimentation. It is not suitable for use as a production environment.

While we aim to make Boulder easy to setup ACME client developers may find Pebble, a miniature version of Boulder, to be better suited for continuous integration and quick experimentation.

We recommend setting git's fsckObjects setting before getting a copy of Boulder to have better integrity guarantees for updates.

Make sure you have a local copy of Boulder in your $GOPATH, and that you are in that directory:

export GOPATH=~/gopath
git clone https://github.com/letsencrypt/boulder/ $GOPATH/src/github.com/letsencrypt/boulder
cd $GOPATH/src/github.com/letsencrypt/boulder

Additionally, make sure you have Docker Engine 1.13.0+ and Docker Compose 1.10.0+ installed. If you do not, you can follow Docker's installation instructions.

We recommend having at least 2GB of RAM available on your Docker host. In practice using less RAM may result in the MariaDB container failing in non-obvious ways.

To start Boulder in a Docker container, run:

docker-compose up

To run our standard battery of tests (lints, unit, integration):

docker-compose run --use-aliases boulder ./test.sh

To run all unit tests:

docker-compose run --use-aliases boulder ./test.sh --unit

To run specific unit tests (example is of the ./va directory):

docker-compose run --use-aliases boulder ./test.sh --unit --filter=./va

To run all integration tests:

docker-compose run --use-aliases boulder ./test.sh --integration

To run specific integration tests (example runs TestAkamaiPurgerDrainQueueFails and TestWFECORS):

docker-compose run --use-aliases boulder ./test.sh --filter TestAkamaiPurgerDrainQueueFails/TestWFECORS

To get a list of available integration tests:

docker-compose run --use-aliases boulder ./test.sh --list-integration-tests

The configuration in docker-compose.yml mounts your $GOPATH on top of its own $GOPATH so you can edit code on your host and it will be immediately reflected inside the Docker containers run with docker-compose.

If docker-compose fails with an error message like "Cannot start service boulder: oci runtime error: no such file or directory" or "Cannot create container for service boulder" you should double check that your $GOPATH exists and doesn't contain any characters other than letters, numbers, - and _, and that it doesn't contain any dangling symlinks.

If you have problems with Docker, you may want to try removing all containers and volumes.

By default, Boulder uses a fake DNS resolver that resolves all hostnames to 127.0.0.1. This is suitable for running integration tests inside the Docker container. If you want Boulder to be able to communicate with a client running on your host instead, you should find your host's Docker IP with:

ifconfig docker0 | grep "inet addr:" | cut -d: -f2 | awk '{ print $1}'

And edit docker-compose.yml to change the FAKE_DNS environment variable to match. This will cause Boulder's stubbed-out DNS resolver (sd-test-srv) to respond to all A queries with the address in FAKE_DNS.

Alternatively, you can override the docker-compose.yml default with an environmental variable using -e (replace 172.17.0.1 with the host IPv4 address found in the command above)

docker-compose run --use-aliases -e FAKE_DNS=172.17.0.1 --service-ports boulder ./start.py

Running tests without the ./test.sh wrapper:

Run all unit tests

docker-compose run --use-aliases boulder go test -p 1 ./...

Run unit tests for a specific directory:

docker-compose run --use-aliases boulder go test <DIRECTORY>

Run integration tests (omit --filter <REGEX> to run all):

docker-compose run --use-aliases boulder python3 test/integration-test.py --chisel --gotest --filter <REGEX>

Boulder's default VA configuration (test/config/va.json) is configured to connect to port 5002 to validate HTTP-01 challenges and port 5001 to validate TLS-ALPN-01 challenges. If you want to solve challenges with a client running on your host you should make sure it uses these ports to respond to validation requests, or update the VA configuration's portConfig to use ports 80 and 443 to match how the VA operates in production and staging environments. If you use a host-based firewall (e.g. ufw or iptables) make sure you allow connections from the Docker instance to your host on the required ports.

Working with Certbot

Check out the Certbot client from https://github.com/certbot/certbot and follow their setup instructions. Once you've got the client set up, you'll probably want to run it against your local Boulder. There are a number of command line flags that are necessary to run the client against a local Boulder, and without root access. The simplest way to run the client locally is to use a convenient alias for certbot (certbot_test) with a custom SERVER environment variable:

SERVER=http://localhost:4001/directory certbot_test certonly --standalone -d test.example.com

Your local Boulder instance uses a fake DNS resolver that returns 127.0.0.1 for any query, so you can use any value for the -d flag. To return an answer other than 127.0.0.1 change the Boulder FAKE_DNS environment variable to another IP address.

To use the legacy ACME v1 API over change SERVER to http://localhost:4000/directory.

Working with another ACME Client

Once you have followed the Boulder development environment instructions and have started the containers you will find the ACME endpoints exposed to your host at the following URLs:

  • ACME v1, HTTP: http://localhost:4000/directory
  • ACME v2, HTTP: http://localhost:4001/directory
  • ACME v1, HTTPS: https://localhost:4430/directory
  • ACME v2, HTTPS: https://localhost:4431/directory

To access the HTTPS versions of the endpoints you will need to configure your ACME client software to use a CA truststore that contains the test/wfe-tls/minica.pem CA certificate. See test/PKI.md for more information.

Your local Boulder instance uses a fake DNS resolver that returns 127.0.0.1 for any query, allowing you to issue certificates for any domain as if it resolved to your localhost. To return an answer other than 127.0.0.1 change the Boulder FAKE_DNS environment variable to another IP address.

Most often you will want to configure FAKE_DNS to point to your host machine where you run an ACME client. Remember to also configure the ACME client to use ports 5002 and 5001 instead of 80 and 443 for HTTP-01 and TLS-ALPN-01 challenge servers (or customize the Boulder VA configuration to match your port choices).

Production

Boulder is custom built for Let's Encrypt and is intended only to support the Web PKI and the CA/Browser forum's baseline requirements. In our experience often Boulder is not the right fit for organizations that are evaluating it for production usage. In most cases a centrally managed PKI that doesn't require domain-authorization with ACME is a better choice. For this environment we recommend evaluating cfssl or a project other than Boulder.

We offer a brief deployment and implementation guide that describes some of the required work and security considerations involved in using Boulder in a production environment. As-is the docker based Boulder development environment is not suitable for production usage. It uses private key material that is publicly available, exposes debug ports and is brittle to component failure.

While we are supportive of other organization's deploying Boulder in a production setting we prioritize support and development work that favors Let's Encrypt's mission. This means we may not be able to provide timely support or accept pull-requests that deviate significantly from our first line goals. If you've thoroughly evaluated the alternatives and Boulder is definitely the best fit we're happy to answer questions to the best of our ability.

Contributing

Please take a look at CONTRIBUTING.md for our guidelines on submitting patches, code review process, code of conduct, and various other tips related to working on the codebase.

License

This project is licensed under the Mozilla Public License 2.0, the full text of which can be found in the LICENSE.txt file.