Commit Graph

5285 Commits

Author SHA1 Message Date
Andrew Gabbitas 066ed3427e
Add GitHub actions workflow for Boulder CI tests (#5308)
- Add GitHub actions workflow for Boulder CI tests in parity with Travis
  CI except the coverage test.
- Change boulder-tools docker image to push to a static docker repo
  instead of creating a new one each time. Use docker version tags and git
  hash to identify go versions in the repo.
- Change docker-compose to pull from the static boulder-tools repo. This
  breaks using the TRAVIS_GO_VERSION env variable to pull the docker image, but
  the default will still work with intent of decommissioning Travis-CI for
  GitHub CI.

Fix: #5289
2021-02-26 12:59:47 -08:00
Aaron Gable a7f5917fb1
Fix bad merge from #5305 (#5309)
Remove two database migration files which were added immediately
prior to 5305, and which should have been removed by it, but were
left in place due to weird git merge semantics.
2021-02-25 13:03:36 -07:00
Aaron Gable f92cefe0c8
Collapse DB migrations into a single file (#5305)
Remove five years of built-up database goose migration files.
Replace them with a single file which contains a snapshot of
the current database schema, which has been confirmed to
be identical to the current schema live in production.

Part of #5254
2021-02-25 09:50:27 -08:00
Andrew Gabbitas a1df5bd35b
Update weppos/publicsuffix-go (#5304)
Update weppos/publicsuffix-go dependency with:
- 4 commits
- Add 19 suffixes
- Remove 0 suffixes

5fd7361...d67cf1d

Fix: #5293
2021-02-24 13:23:25 -07:00
Aaron Gable 0fdaead9b4
Move DropTableChallenges migration to prod (#5302)
This table has been dropped from our staging and prod
databases, so this migration can move from _db-next to _db.

Part of #5254
2021-02-23 16:57:20 -08:00
Aaron Gable 5a081515a7
Drop never-used CRLs table (#5303)
This table was part of the initial schema, but no Boulder
code has ever written to or read from it.

Part of #5254
2021-02-23 16:09:33 -08:00
Samantha 8c1a9dd842
Print the stage when test.sh exits due to failure (#5297)
Resolves #5296
2021-02-23 15:04:49 -08:00
Aaron Gable b4db450357
Remove challenges table (#5285)
This table is not used by any Boulder logic nor by any
offline stats/metrics gathering.
2021-02-22 11:25:19 -08:00
Samantha 7cbfe94f30
Switch docker base image from buster-scm to focal-scm (#5287)
- Switch docker base image from`buster-scm` to `focal-scm`
- Add `dockerfile` lines to correct `/etc/rsyslog.conf` settings

Fixes #5295
2021-02-22 10:33:50 -08:00
Jacob Hoffman-Andrews e042b9a47f
Remove some unused types from core. (#5292) 2021-02-22 10:09:10 -08:00
Aaron Gable 23f5724233
Drop unused index from issuedNames table (#5290)
Drop the reversedName_renewal_notBefore_Idx from the issuedNames table.
This index was added to facilitate rate limit queries, but we now use
the certificatesPerName table for rate limits instead.

Keep the reversedName_notBefore_Idx in place, as it is still useful for
gathering stats on how many hostnames have active certificates.

Fixes #3180
2021-02-18 08:55:39 -08:00
Samantha e2e7dad034
Move cmd.DBConfig fields to their own named sub-struct (#5286)
Named field `DB`, in a each component configuration struct, acts as the
receiver for the value of `db` when component JSON files are
unmarshalled.

When `cmd.DBConfig` fields are received at the root of component
configuration struct instead of `DB` copy them to the `DB` field of the
component configuration struct.

Move existing `cmd.DBConfig` values from the root of each component's
JSON configuration in `test/config-next` to `db`

Part of #5275
2021-02-16 10:48:58 -08:00
Samantha f13b8db2eb
Update publisher tests to use new realistic test certs (#5280)
A new, more realistic, test certificate hierarchy was added in #5273.

Update publisher tests to use the test certificate hierarchy now present
at test/hierarchy.

Fixes #5279
2021-02-11 15:24:20 -08:00
Andrew Gabbitas 0a4b600a09
Move docker login before docker pull. (#5281)
Ensure docker login happens before the docker-compose pull. Change install
section to a more appropriate before_script section for the docker login
and pull.
2021-02-11 11:07:01 -08:00
Jacob Hoffman-Andrews acf5873311
Point WFE2 informational page to RFC 8555 (#5278)
The old repo it linked to was old.
2021-02-10 15:57:57 -08:00
Samantha b306060cad
Fix potential race condition in boulder-ca shutdown (#5277)
`cai.Stop()` called from boulder-ca could potentially exit before errors
emitted by `caSrv` and `ocspSrv` are logged. This could lead to
boulder-ca erroneously exiting `0` instead of `1`.

Add a `sync.WaitGroup`. Increment the waitgroup before `caSrv.Serve()`
and `ocspSrv.Serv()` are spun off. Await the waitgroup before
`cai.Stop()` is called.

Fixes #5246
2021-02-09 11:17:59 -08:00
Aaron Gable 1e11833478
wfe2: Check signatures before serving cert chains (#5273)
Add a check to `wfe2.Certificate` to ensure that the chain we select to
serve with the end-entity cert actually validates the end-entity's
signature. Add new test certificates, generated to match our actual
hierarchy. Update wfe2 tests to use the new test certificates, as well
as new mocks, in order to properly test the new check.

The new test certs and overhauled tests are necessary because the prior
wfe2 tests built and served chains that were not valid, and in
fact could not be valid because they were built with self-signed certs.

Fixes #5225
2021-02-09 09:09:49 -08:00
Samantha 2efabf57b6
Adding support for multiple issuers to publisher (#5272)
Publisher currently loads a PEM formatted certificate bundle from file
using LoadCertBundle a utility function in the core package.
LoadCertBundle parses the PEM file to a slice of x509.Certificates and
returns them to boulder-publisher (without checking validity). Using
these x509 Certificates, boulder-publisher to construct an ASN1Cert
bundle. This bundle is passed to each new publisher instance. When
publisher receives a request it unconditionally appends this bundle to
each end-entity precertificate for submission to CT logs.

This change augments this process to add support for multiple issuers
using the IssuerNameID concept in the Issuance package. Config field
Common.CT.CertificateBundleFilename has been replaced with the Chains
field. LoadChain, a utility function added in PR #5271, loads and
validates the chain (which nets us some added deploy-time safety) before
returning it to boulder-publisher. Using these x509 Certificates,
boulder-publisher constructs a mapping of IssuerNameID to ASN1Cert
bundle and passes this to each new publisher instance. When publisher
receives a request it determines the IssuerNameID of the precertificate
to select and append the correct ASN1Cert bundle for a given Issuer.

A followup issue #5269 has been created to address removal of the Common
field from the publisher configuration and code has been commented with
TODOs where code will need to be removed or refactored.

Fixes #1669
2021-02-08 12:23:44 -08:00
Jacob Hoffman-Andrews d36ab3b9b9
Report metrics by server host, not host:port (#5262)
Fixes #5257
2021-02-08 12:22:17 -08:00
Samantha 7cb0038498
Deprecate MaxDBConns for MaxOpenConns (#5274)
In #5235 we replaced MaxDBConns in favor of MaxOpenConns.

One week ago MaxDBConns was removed from all dev, staging, and
production configurations. This change completes the removal of
MaxDBConns from all components and test/config.

Fixes #5249
2021-02-08 12:00:01 -08:00
Andrew Gabbitas 0fdfbe1211
Deprecate StripDefaultSchemePort flag (#5265)
This flag is now enabled in Let's Encrypt staging/prod.

This change deprecates the flag and prepares it for deletion in a future
change. It can then be removed once no staging/prod configs reference the
flag.

Fixes #5236
2021-02-08 11:30:52 -08:00
Samantha 82b200b8e9
Move core loadChain functionality from boulder-wfe to issuance (#5271)
loadChain is an unexported utility function recently added to
boulder-wfe to support the loading and validating of PEM files that
represent a certificate chain

This change moves the core loadChain functionality out of boulder-wfe to
a new exported LoadChain function in the Issuance package. All
boulder-wfe unit tests have been preserved and most of them have been
pared down and added to the Issuance package as well.

Blocks #1669
Fixes #5270
2021-02-04 16:41:25 -08:00
Andrew Gabbitas 0b1fedad21
Remove deprecated feature flags. (#5264)
features.go contains some feature flags that no longer control any Boulder
behavior. They have been removed from Let's Encrypt staging and prod
configs and can now be removed from Boulder.

This change removes the deprecated feature flags.
2021-02-01 16:46:01 -08:00
Aaron Gable 68c393b081
CA: Create ECDSA issuance allowlist (#5258)
Currently, the CA is configured with a set of `internalIssuer`s,
and a mapping of public key algorithms (e.g. `x509.RSA`) to which
internalIssuer to use. In operation today, we use the same issuer
for all kinds of public key algorithms. In the future, we will use
different issuers for different algorithms (in particular, we will
use R3 to issue for RSA keys, and E1 to issue for ECDSA keys). But
we want to roll that out slowly, continuing to use our RSA issuer
to issue for all types of public keys, except for ECDSA keys which
are presented by a specific set of allowed accounts.

This change adds a new config field to the CA, which lets us specify
a small list of registration IDs which are allowed to have issuance
from our ECDSA issuer. If the config list is empty, then all accounts
are allowed. The CA checks to see if the key being issued for is
ECDSA: if it is, it then checks to make sure that the associated
registration ID is in the allowlist. If the account is not allowed,
it then overrides the issuance algorithm to use RSA instead,
mimicking our old behavior. It also adds a new feature flag, which
can be enabled to skip the allowlist entirely (effectively allowing
all registered accounts). This feature flag will be enabled when
we're done with our testing and confident in our ECDSA issuance.

Fixes #5259
2021-02-01 09:11:38 -08:00
Jacob Hoffman-Andrews 2a8f0fe6ac
Rename several items in bdns (#5260)
[Go style says](https://blog.golang.org/package-names):

> Avoid stutter. Since client code uses the package name as a prefix
> when referring to the package contents, the names for those contents
> need not repeat the package name. The HTTP server provided by the
> http package is called Server, not HTTPServer. Client code refers to
> this type as http.Server, so there is no ambiguity.

Rename DNSClient, DNSClientImpl, NewDNSClientImpl,
NewTestDNSClientImpl, DNSError, and MockDNSClient to follow those
guidelines.

Unexport DNSClientImpl and MockTimeoutError (was only used internally).

Make New and NewTest return the Client interface rather than a concrete
`impl` type.
2021-01-29 17:20:35 -08:00
Jacob Hoffman-Andrews 2a6cb72518
Speed up VA test. (#5261)
We had a test that relied on sleeping to hit a timeout. This doesn't
remove the sleep, but it does tighten the duration significantly. Brings
unit test time for the VA from 11 seconds to 1.7 seconds on my machine.
2021-01-29 17:07:58 -08:00
Andrew Gabbitas aa20bcaded
Add validated timestamp to challenges (#5253)
We do not present a validated timestamp in challenges where status = valid
as required by RFC8555.

This change is the first step to presenting challenge timestamps to the
client. It adds a timestamp to each place where we change a challenge to
valid. This only displays in the logs and will not display to the
subscriber because it is not yet stored somewhere retrievable. The next
step will be to store it in the database and then finally present it to
the client.

Part of #5198
2021-01-29 08:07:32 -08:00
Aaron Gable 379826d4b5
WFE2: Improve support for multiple issuers & chains (#5247)
This change simplifies and hardens the wfe2's support for having
multiple issuers, and multiple chains for each issuer, configured
and loaded in memory.

The only config-visible change is replacing the old two separate config
values (`certificateChains` and `alternateCertificateChains`) with a
single value (`chains`). This new value does not require the user to
know and hand-code the AIA URLs at which the certificates are available;
instead the chains are simply presented as lists of files. If this new
config value is present, the old config values will be ignored; if it
is not, the old config values will be respected.

Behind the scenes, the chain loading code has been completely changed.
Instead of loading PEM bytes directly from the file, and then asserting
various things (line endings, no trailing bits, etc) about those bytes,
we now parse a certificate from the file, and in-memory recreate the
PEM from that certificate. This approach allows the file loading to be
much more forgiving, while also being stricter: we now check that each
certificate in the chain is correctly signed by the next cert, and that
the last cert in the chain is a self-signed root.

Within the WFE itself, most of the internal structure has been retained.
However, both the internal `issuerCertificates` (used for checking
that certs we are asked to revoke were in fact issued by us) and the
`certificateChains` (used to append chains to end-entity certs when
served to clients) have been updated to be maps keyed by IssuerNameID.
This allows revocation checking to not have to iterate through the
whole list of issuers, and also makes it easy to double-check that
the signatures on end-entity certs are valid before serving them. Actual
checking of the validity will come in a follow-up change, due to the
invasive nature of the necessary test changes.

Fixes #5164
2021-01-27 15:07:58 -08:00
Aaron Gable 88ea4432be
Reify RemoveOldAuthzTables migration (#5255)
This migration has happened in prod (IN-5278) so we can move this
migration file from _db-next to _db.

Part of #5252
2021-01-27 13:30:36 -08:00
Aaron Gable c7c666475c
Stop running tests on go1.15.5 (#5256)
The go 1.15.7 security release is running everywhere, so we no
longer need to run tests on this older version.

Fixes #5237
2021-01-27 13:30:00 -08:00
Samantha e0510056cc
Enhancements to SQL driver tuning via JSON config (#5235)
Historically the only database/sql driver setting exposed via JSON
config was maxDBConns. This change adds support for maxIdleConns,
connMaxLifetime, connMaxIdleTime, and renames maxDBConns to
maxOpenConns. The addition of these settings will give our SRE team a
convenient method for tuning the reuse/closure of database connections.

A new struct, DBSettings, has been added to SA. The struct, and each of
it's fields has been commented.

All new fields have been plumbed through to the relevant Boulder
components and exported as Prometheus metrics. Tests have been
added/modified to ensure that the fields are being set. There should be
no loss in coverage

Deployability concerns for the migration from maxDBConns to maxOpenConns
have been addressed with the temporary addition of the helper method
cmd.DBConfig.GetMaxOpenConns(). This method can be removed once
test/config is defaulted to using maxOpenConns. Relevant sections of the
code have TODOs added that link back to an newly opened issue.

Fixes #5199
2021-01-25 15:34:55 -08:00
alexzorin dbf7144ef6
deps: update publicsuffix-go (#5250)
This brings in 1 new commit, adding 15 suffixes and removing 3.

cb9948bdd7..5fd7361351
2021-01-25 11:40:34 -08:00
Andrew Gabbitas f8e82a9889
Authenticate to DockerHub in CI (#5245)
Currently we do not login to DockerHub for CI and are being rate limited
on pulls.

This adds a docker login using env variables that are setup in our Travis
repository.

The login credentials are a bot username and a purpose generated DockerHub
CLI token stored as ENV variables that are not viewable after added to the
TravisCI repository settings.

Risks and best practices for managing these secrets can be found at
https://docs.travis-ci.com/user/best-practices-security.

Fixes #5212
2021-01-21 11:51:14 -08:00
Aaron Gable d9132102d1
WFE: Always use precert revocation path (#5227)
The PrecertificateRevocation flag is turned on everywhere, so the
else case is unused code. This change updates the WFE to always
use the PrecertificateRevocation code path, and deprecates the old
feature flag.

The TestRevokeCertificateWithAuthz method was deleted because
it is redundant with TestRevokeCertificateWithAuthorizations.

Fixes #5240
2021-01-20 16:00:11 -08:00
Andrew Gabbitas e8a6eabbd5
Update to go1.15.7 (#5241)
Go version 1.15.7 is a security release.

Fixes: #5237
2021-01-20 11:38:38 -08:00
Aaron Gable 400bf3a02a
Allow WFEv1 to specify which issuer to use (#5222)
We intend to delete the v1 API (i.e. `wfe` and its associated codepaths)
in the near future, and as such are not giving it new features or
capabilities. However, before then we intend to allow the v2 API to
provide issuance both from our RSA and from our ECDSA intermediates.
The v1 API cannot gain such capability at the same time.

The CA doesn't know which frontend originated any given issuance
request, so we can't simply gate the single- or double-issuer behavior
based on that. Instead, this change introduces the ability for the
WFE (and the RA, which sits between the WFE and the CA) to request
issuance from a specific intermediate. If the specified intermediate is
not available in the CA, issuance will fail. If no intermediate is
specified (as is the case in requests coming from wfe2), it falls back
to selecting the issuer based on the algorithm of the public key to
be signed.

Fixes #5216
2021-01-20 09:22:03 -08:00
Andrew Gabbitas b1abf0f5c4
Fix spelling error (#5244)
Tests are failing because of a misspelled word in a comment.

This fixes the spelling error.

Fixes: #5243
2021-01-19 19:29:07 -08:00
Andrew Gabbitas a0d12af73c
Detect redirect loops in VA (#5234)
Currently the VA checks to see how many redirects have been followed and
bails out if greater than maxRedirect (10), but it does not check to see
if any redirect url has been followed twice which would mean a broken
infinite redirect loop. Storing the validation records for these is
relatively expensive because we store a record for each hop in the
redirect.

This change checks the previous redirect records to see if the URL has
been used before and error if it has. This will catch a redirect loop
earlier than the maxRedirect value in most cases.

Fixes #5224
2021-01-19 16:38:03 -08:00
Aaron Gable 6c1f42fce7
WFE tests: simplify use of mock SAs (#5239)
This change deletes the (used, but not useful)
`mockSANoSuchRegistration` from the wfe2 tests, and updates all
places where the wfe tests create a mock SA to take the existing
mock SA as input instead of building another one from scratch from
the fakeclock.
2021-01-19 14:10:01 -08:00
Jacob Hoffman-Andrews 9464d025d1
Fix OCSP log queue blocking when maxLogLen = 0. (#5230)
Move responsibility for handling the default path (maxLogLen = 0)
from the ocspLogQueue component to CertificateAuthorityImpl. Now the
ocspLogQueue isn't constructed at all unless we configure it to be used.

Also, remove buffer from OCSP audit log chan. The bug this fixes was
hidden by the large buffer, and on reconsideration the large buffer was
unnecessary.

Verified that with the buffer removed, the integration test fails. Then
adding the fixes to the maxLogLen = 0 case fixes the integration test.

Fixes #5228
2021-01-15 11:32:00 -08:00
Jacob Hoffman-Andrews 8b9145838d
Add logging of OCSP generation events (#5223)
This adds a new component to the CA, ocspLogQueue, which batches up
OCSP generation events for audit logging. It will log accumulated
events when it reaches a certain line length, or when a maximum amount
of times has passed.
2021-01-12 15:31:49 -08:00
Aaron Gable f5982c6d44
Use IssuerNameID to get issuer from precertificate (#5217)
Today, when issuing a certificate based on a precertificate, we choose
the issuer based on algorithm: we find the precert's algorithm, look
it up in our table mapping algs to issuers, and then issue the final
cert from that issuer.

It is therefore hypothetically possible for the precertificate and
final certificate to be issued from different issuers, if the mapping
of algs to issuers were updated between precert and final cert issuance.
We don't expect this to be possible given Boulder's architecture, but
it could become possible given sufficient refactoring.

This change updates the lookup method to be based on the IssuerNameID,
which is a truncated hash computed across the whole Name field of the
issuer certificate (or equivalently across the Issuer field of the
issued precertificate). This ensures that final issuance will fail,
rather than have different issuers for the precert and final cert.

Part of #5216
2021-01-07 11:03:31 -08:00
Andrew Gabbitas 55e4262aac
Fix an incorrect line break on bullet point (#5220) 2021-01-07 11:03:03 -08:00
Andrew Gabbitas aab9f38718
Update publicsuffix-go (#5213) (#5221)
This brings in 16 commits, adds 184 new public
suffixes and removes 22.

2c0d957a74...cb9948bdd7

Fixes #5213
2021-01-06 17:23:58 -08:00
Aaron Gable a214fb7757
Remove /issuer-cert endpoint from v2 API (#5215)
The /issuer-cert endpoint was a holdover from the v1 API, where
it is a critical part of the issuance flow. In the v2 issuance
flow, the issuer certificate is provided directly in the response
for the certificate itself. Thus, this endpoint is redundant.

Stats show that it receives approximately zero traffic (less than
one request per week, all of which are now coming from wget or
browser useragents). It also complicates the refactoring necessary
for the v2 API to support multiple issuers.

As such, it is a safe and easy decision to remove it.

Fixes #5196
2021-01-04 11:44:50 -08:00
Samantha ffbc54f343
Updating golang.org/x/crypto/ due to CVE-2020-29652 (#5207) 2020-12-21 14:02:22 -08:00
Aaron Gable beee17c510
Janitor: refactor to be controlled by config (#5195)
Previously, configuration of the boulder-janitor was split into
two places: the actual json config file (which controlled which
jobs would be enabled, and what their rate limits should be), and
the janitor code itself (which controlled which tables and columns
those jobs should query). This resulted in significant duplicated
code, as most of the jobs were identical except for their table
and column names.

This change abstracts away the query which jobs use to find work.
Instead of having each job type parse its own config and produce
its own work query (in Go code), now each job supplies just a few
key values (the table name and two column names) in its JSON config,
and the Go code assembles the appropriate query from there. We are
able to delete all of the files defining individual job types, and
replace them with a single slightly smarter job constructor.

This enables further refactorings, namely:
* Moving all of the logic code into its own module;
* Ensuring that the exported interface of that module is safe (i.e.
  that a client cannot create and run jobs without them being valid,
  because the only exposed methods ensure validity);
* Collapsing validity checks into a single location;
* Various renamings.
2020-12-17 09:53:22 -08:00
Aaron Gable 5ca0c343af
ocsp-responder: move IssuerCerts out of common config (#5203)
The vast majority of Boulder components no longer care about
anything in the common config block. As such, we hope to
remove it entirely in the near future. So let's put the (not-yet-used)
IssuerCerts config item in the main OCSPResponder block,
rather than in the common block.

Part of #5204
2020-12-15 16:59:38 -08:00
Aaron Gable 9ba2d3c00b
ocsp-responder: move IssuerID check after Expires check (#5202)
It is possible for a CertificateStatus row to have a nil IssuerID
(there was a period of time in which we didn't write IssuerIDs into
CertificateStatus rows at all) but all such rows should be old and
therefore expired.

Unfortunately, this code was checking the IssuerID before it was
checking the Expiry, and therefore was generating panics when trying
to dereference a nil pointer.

This change simply moves the IssuerID check to be after the Expires
check, so that we'll only try to dereference the IssuerID on recent
CertificateStatus rows, where it is guaranteed to be non-nil.

Fixes #5200
2020-12-15 14:38:21 -08:00
Samantha 802d4fed9d
Return full CAA RR response from bdns to va (#5181)
When the VA encounters CAA records, it logs the contents of those
records. When those records were the result of following a chain of
CNAMEs, the CNAMEs are included as part of the response from our
recursive resolver. However, the current flow for logging the responses
logs only the CAA records, not the CNAMEs.

This change returns the complete dig-style RR response from bdns to the
va where the response of the authoritative CAA RR is string-quoted and
logged.

This dig-style RR response is quite verbose, however it is only ever
returned from bdns.LookupCAA when a CAA response is non-empty. If the CAA
response is empty only an empty string is returned.

Fixes #5082
2020-12-10 18:17:04 -08:00