Commit Graph

4991 Commits

Author SHA1 Message Date
Roland Bracewell Shoemaker 70ff4d9347
Add bad-key-revoker daemon (#4788)
Adds a daemon which monitors the new blockedKeys table and checks for any unexpired, unrevoked certificates that are associated with the added SPKI hashes and revokes them, notifying the user that issued the certificates.

Fixes #4772.
2020-04-23 11:51:59 -07:00
Jacob Hoffman-Andrews d2ae471026
Upgrade gRPC to v1.29.0 (#4790)
Incidentally upgrade golang/protobuf.
2020-04-22 18:33:16 -07:00
Jacob Hoffman-Andrews 4a2029b293
Use explicit fmt.Sprintf for ProblemDetails (#4787)
In #3708, we added formatters for the the convenience methods in the
`probs` package.

However, in #4783, @alexzorin pointed out that we were incorrectly
passing an error message through fmt.Sprintf as the format parameter
rather than as a value parameter.

I proposed a fix in #4784, but during code review we concluded that the
underlying problem was the pattern of using format-style functions that
don't have some variant of printf in the name. That makes this wrong:
`probs.DNS(err.Error())`, and this right: `probs.DNS("%s", err)`. Since
that's an easy mistake to make and a hard one to spot during code review,
we're going to stop using this particular pattern and call `fmt.Sprintf`
directly.

This PR reverts #3708 and adds some `fmt.Sprintf` where needed.
2020-04-21 14:36:11 -07:00
Jacob Hoffman-Andrews 87fb6028c1
Add log validator to integration tests (#4782)
For now this mainly provides an example config and confirms that
log-validator can start up and shut down cleanly, as well as provide a
stat indicating how many log lines it has handled.

This introduces a syslog config to the boulder-tools image that will write
logs to /var/log/program.log. It also tweaks the various .json config
files so they have non-default syslogLevel, to ensure they actually
write something for log-validator to verify.
2020-04-20 13:33:42 -07:00
Roland Bracewell Shoemaker 8259925f7c
Allow passing only --gotest to integration-test.py (#4786) 2020-04-20 13:32:30 -07:00
Jacob Hoffman-Andrews 91aa272354
Revert #4665: "Capture output from stdlib `log` library" (#4781)
The problem with this approach is that there is no way to guarantee the output
is copied to syslog / stdout before shutdown. This is particularly evident when
`log.Fatal` is used, because that calls `os.Exit` immediately after `l.Output`,
creating a race condition where the log line might or might not get printed
before the program exits.

Reverting this change means that in case some component does call `log.Fatal`
we'll still get the output from stdout.

This also changes one instance in cmd/shell.go where we call `log.Fatal` to use
`logger.Errf`.
2020-04-16 20:00:47 -07:00
Jacob Hoffman-Andrews 908e8b5590
Test with Go 1.14.1 only. (#4785)
Now that we've deployed Go 1.14.1 in prod, we can remove 1.13.2 from our
test matrix.
2020-04-16 16:57:05 -07:00
Jacob Hoffman-Andrews 2d7337dcd0
Remove newlines from log messages. (#4777)
Since Boulder's log system adds checksums to lines, but log-validator
processes entries on a per-line basis, including newlines in log
messages can cause a validation failure.
2020-04-16 16:49:08 -07:00
Jacob Hoffman-Andrews bcfdec50c7
Remove one-off weak key search tools. (#4780)
These tools were implemented along with Debian weak key checking,
but aren't needed now since Debian weak key checking is done on a
continuous basis.
2020-04-16 16:48:50 -07:00
Jacob Hoffman-Andrews f3e48d6931
Move cert-checker to zlint v2. (#4779)
And run go mod tidy, which removes v1 of zlint from our go.mod.
2020-04-15 17:35:15 -07:00
Jacob Hoffman-Andrews bc528cf8cd
Error when redirect target is too long. (#4775)
This can happen when a misconfiguration redirects a certain path to
itself, doubled. After 10 redirects the error message can get quite
long. Instead we halt things at 2000 bytes, which should be more than
enough.
2020-04-15 13:44:26 -07:00
Jacob Hoffman-Andrews b351fa5979
log-validator: handle spurious shutdown errors. (#4776)
Also add a logs adapter for tail's built-in logging type.
2020-04-15 13:44:12 -07:00
Roland Bracewell Shoemaker 9df97cbf06
Add a blocked keys table, and use it (#4773)
Fixes #4712 and fixes #4711.
2020-04-15 13:42:51 -07:00
Jacob Hoffman-Andrews 5254844ba2
Make TestValidAuthzExpires non-flaky. (#4778)
Previously, the test called `.Round(time.Minute)` on the expected
and actual expiration times, intending to perform an "approximately
equal" function.

However, when the expected and actual times differed by a second, but
they happened to fall on opposite sides of a rounding interval (i.e. 30
seconds into a minute), they would be rounded in opposite directions,
resulting in a conclusion that they were not equal.

This change instead defines an acceptable range of plus or minus a
minute for the expiration time, and checks that the actual expiration
time is in that interval.
2020-04-15 12:54:53 -07:00
Jacob Hoffman-Andrews 36c1f1ab2d
Deprecate some feature flags (#4771)
Deprecate some feature flags.

These are all enabled in production.
2020-04-13 15:49:55 -07:00
Jacob Hoffman-Andrews db1a1a8595
Set memlock ulimit to unlimited. (#4770)
This works around a kernel bug that is tickled by Go 1.14:

https://github.com/golang/go/issues/37436
2020-04-13 15:49:38 -07:00
Roland Bracewell Shoemaker 7cc5f64a48
Reject RSA keys with non-standard exponent (#4769)
Only allow the RSA exponent 65537, which is the defacto standard (only 3 unexpired certificates issued by Let's Encrypt use a different exponent).
2020-04-13 15:29:32 -07:00
Daniel McCarney 005cd54eef
docs: update multi-va.md for prod deploy (#4767)
Quick update to docs/multi-va.md to reflect that the feature has been promoted out of the test deployment stage into a production feature.
2020-04-09 15:49:51 -07:00
Jacob Hoffman-Andrews 9fbab1a1cd
Switch to golangci-lint for our lints. (#4766)
This makes it easier to configure additional linters, and provides us an
easy command to run locally.

The initial set of linters reflects those we are already running:

govet gofmt ineffassign errcheck misspell staticcheck

Note that misspell is in addition to the Python codespell package.

Since the invocation of these linters from golangci-lint is slightly
different from how we currently invoke them, there are some new
findings. This PR won't pass tests until #4763, #4764, and #4765 are
merged.

Incidentally, rename strat -> strategy to appeal misspell.
2020-04-09 09:42:24 -07:00
Jacob Hoffman-Andrews 0db7d9ff89
Block keys using hex(sha256(spki)). (#4745)
In addition to base64(sha256(spki)).

As part of that, change KeyDigest to return [32]byte, and add KeyDigestB64 which provides the base64-encoded output that KeyDigest used to provide. Also update all call sites.
2020-04-09 09:41:33 -07:00
Roland Bracewell Shoemaker 324d92d7c5
goodkey cleanups (#4754)
Fixes #4748 and fixes #4740.
2020-04-08 17:57:23 -07:00
Jacob Hoffman-Andrews 84a51ecce0
Add error checking in load-generator and ocsp_forever (#4765)
Found by golangci-lint's errcheck invocation.
2020-04-08 17:26:42 -07:00
Jacob Hoffman-Andrews 0a0a776882
Fix some misspellings. (#4764)
Found by golangci-lint's `misspell` linter.

`strat` was a false positive vs `start` but I figured it's easier to
just change the name.
2020-04-08 17:26:10 -07:00
Jacob Hoffman-Andrews 72deb5b798
gofmt code with -s (simplify) flag (#4763)
Found by golangci-lint's `gofmt` linter.
2020-04-08 17:25:35 -07:00
Jacob Hoffman-Andrews aa9ec70ef7
Remove deprecated HeaderMap reference. (#4762)
ResponseRecorder's HeaderMap field is deprecated:
https://godoc.org/net/http/httptest#ResponseRecorder

partial staticcheck cleanup: https://staticcheck.io/docs/checks#SA1019
2020-04-08 17:24:44 -07:00
Jacob Hoffman-Andrews 75024c3ec1
Replace clock.Default() with clock.New() (#4761)
clock.Default is deprecated:
https://godoc.org/github.com/jmhodges/clock#Default
2020-04-08 17:23:43 -07:00
Jacob Hoffman-Andrews b567adb9f5
Switch to godoc-style comments. (#4760)
* Switch to godoc-style comments.

staticcheck cleanup: https://staticcheck.io/docs/checks#ST1021

* Revert spurious diff.
2020-04-08 17:22:40 -07:00
Jacob Hoffman-Andrews 4df94d5215
Use responseWriter.Body.Bytes() (#4759)
staticcheck cleanup: https://staticcheck.io/docs/checks#S1030
2020-04-08 17:21:50 -07:00
Jacob Hoffman-Andrews 0e9ac0c638
Use bytes.Equal instead of bytes.Compare == 0 (#4758)
staticcheck cleanup: https://staticcheck.io/docs/checks#S1004
2020-04-08 17:20:56 -07:00
Jacob Hoffman-Andrews de8855f15b
Use sort.Strings instead of sort.Sort (#4757)
staticcheck cleanup: https://staticcheck.io/docs/checks#S1032
2020-04-08 17:20:20 -07:00
Jacob Hoffman-Andrews 8d99ada705
Change order of "yoda conditions" (1 != foo) (#4756)
staticcheck cleanup: https://staticcheck.io/docs/checks#ST1017
2020-04-08 17:19:56 -07:00
Jacob Hoffman-Andrews cdb0bddbd8
Prefix error names with "Err" (#4755)
Staticcheck cleanup: https://staticcheck.io/docs/checks#ST1012
2020-04-08 17:19:35 -07:00
Roland Bracewell Shoemaker fb0d2ffaa8
Store key hash when adding precertificate, add backfill tool (#4753)
Fixes #4749
2020-04-08 13:53:19 -07:00
Roland Bracewell Shoemaker 36b9c95324
Fix link to test PKI info (#4750)
Fixes #4723
2020-04-08 10:27:32 -07:00
Jacob Hoffman-Andrews 1278679afb
Handle mismatched URLs in key rollover. (#4752)
Fixes #4751
2020-04-07 19:21:02 -07:00
Jacob Hoffman-Andrews aad43e4688
Fix entrypoint.sh / docker-compose up. (#4747)
We no longer use virtualenv; we just install our Python dependencies
globally.
2020-04-07 11:35:42 -07:00
Jacob Hoffman-Andrews 5af7541c85
Improve output when Go integration tests fail. (#4734)
Right now we show output like:

Traceback (most recent call last):
File "test/integration-test.py", line 60, in run_go_tests
subprocess.check_call(cmdLine, shell=False, stderr=subprocess.STDOUT)
File "/usr/lib/python3.5/subprocess.py", line 271, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['go', 'test', '-tags', 'integration', '-count=1', '-race', './test/integration']' returned non-zero exit status 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "test/integration-test.py", line 414, in
main()
File "test/integration-test.py", line 293, in main
run_go_tests(args.test_case_filter)
File "test/integration-test.py", line 62, in run_go_tests
raise(Exception("%s. Output:\n%s" % (e, e.output)))
Exception: Command '['go', 'test', '-tags', 'integration', '-count=1', '-race', './test/integration']' returned non-zero exit status 1. Output:
None

This change removes the try / raise clauses that were causing this
double exception logging. The original purpose of these clauses was to
make sure we logged output on failure. To continue to fulfill that
purpose, I switched the run function to use check_call instead of
check_output. check_output captures the stdout; check_call emits it to
the caller's stdout as normal, so we still see the output.

I also changed the two cases that actually wanted to process output so
they use check_output directly.
2020-04-06 17:42:40 -07:00
Jacob Hoffman-Andrews 48942db1a9
Add staticcheck to CI (#4731)
This adds staticcheck to our "lints" CI, with a list of excluded checks. Some of these are checks that we don't care about much (like error string capitalization). Others are nice to fix (possible nil pointer dereferences in _test.go files), but we'd like to land the automated checking first to catch any new issues, then later winnow down the list.

This builds on #4726, #4725, and #4722, which addressed some of the categories of findings from staticcheck.
2020-04-06 17:37:19 -07:00
Jacob Hoffman-Andrews 28dbbce8da
Make boulder-tools image smaller. (#4732)
Instead of installing Certbot from the repo, install the python-acme
library (the only piece we need) from the apt repository. This also
allows us to skip installing build dependencies for Certbot.

Uninstall cmake after building.

Clean the various Go caches.

Move codespell and acme into requirements.txt. Don't use virtualenv anymore.

This reduces image size from 1.4 GB to 1.0 GB.

Incidentally, move the Go install to its own phase in the Dockerfile.
This will give it its own image layer, making rebuilds faster.
2020-04-06 16:53:42 -07:00
Jacob Hoffman-Andrews 1f0d8c1e4f
Clean up .travis.yml (#4735)
We have a comment in .travis.yml indicating that Travis' version of docker-compose is too old for us, but that's no longer true, so we can simplify things and speed up by using the stock installed one.

The list of custom hostnames in .travis.yml that all point to localhost are no longer used. Instead we use a custom DNS server within our docker-compose setup. So this PR removes those hostnames.

Remove staging and release as special branches to have tests run. We no longer use branches as part of our release process.
2020-04-06 13:51:57 -07:00
Roland Bracewell Shoemaker 9af9de0541
Fix incorrect key name in ceremony docs (#4742) 2020-04-06 13:43:32 -07:00
Jacob Hoffman-Andrews 7e926ca4c6
Remove travis-before-install.sh. (#4733)
The comment in that script, that the master branch isn't present in
Travis builds, is no longer accurate. So we don't need this workaround
anymore.
2020-04-06 11:15:43 -07:00
Jacob Hoffman-Andrews df7ffbe206
Update .travis.yml in response to Travis' validation tool. (#4720)
In our builds, under "View config", Travis was showing two warnings and
4 info-level reports:

root: deprecated key sudo (The key `sudo` has no effect anymore.)
root: deprecated key sudo (The key `sudo` has no effect anymore.)
root: missing dist, using the default xenial
root: missing os, using the default linux
root: key matrix is an alias for jobs, using jobs
root: key matrix is an alias for jobs, using jobs

I believe this should fix all of these. I've selected xenial as the dist
for now because that's what we've been defaulting to, but we can switch
to bionic, which is newer (though it doesn't make much difference since
we're running most things in Docker).
2020-04-06 10:27:46 -07:00
Jacob Hoffman-Andrews 995e25e8c3
Start testing Go 1.14.1 in Travis. (#4718)
As part of the process, pin specific versions of protoc-gen-go, mockgen,
and goveralls. Protoc-gen-go recently released a version that was incompatible
with our current version of gRPC. Mockgen has a version that was generating
spurious diffs in our generate test phase, and goveralls recently added
some code that calls git branch --format=..., which breaks on the version of
git in our Docker image.

Pinning versions required forcing go get into module-aware mode, since the
old-style go get doesn't understand versions.
2020-04-06 09:18:00 -07:00
Jacob Hoffman-Andrews f26228703e
Temporarily remove crl package. (#4725)
This is currently unused, and was a copy of the Go upstream package
anyhow. We will either re-copy when needed or wait for Go 1.15, which
will include the updates we need.
2020-03-30 10:55:38 -07:00
Jacob Hoffman-Andrews bef02e782a
Fix nits found by staticcheck (#4726)
Part of #4700
2020-03-30 10:20:20 -07:00
Roland Bracewell Shoemaker 81bb4047d5
Ceremony monolith (#4678)
Merges gen-ca and gen-key into a single tool that can be used to complete a key/certificate generation ceremony. The driving idea here is that instead of having to write out multiple long commands in a specific order in order to complete a ceremony a configuration file is fed to a single binary. This config file contains all of the information needed to complete the ceremony, and can be easily tested outside of the secure environment before hand without fear of later typing a command/flag incorrectly etc.

The tooling works against the test hardware I have (there are minimal changes to the actual PKCS#11 code behind the scenes). Specific attention should be given to the documentation, and the general UX of the tool.

Fixes #4639 and fixes #4667.
2020-03-27 13:54:56 -07:00
Jacob Hoffman-Andrews 3a1a08a10b
Remove unused code. (#4722)
Found by staticcheck.
2020-03-27 11:55:42 -07:00
Jacob Hoffman-Andrews 3b54070a78
Deflake GetValidAuthorizations2 unittest. (#4721)
The test would sometimes fail based on randomized ordering of map
elements.
2020-03-27 11:55:29 -07:00
Jacob Hoffman-Andrews 9e2e08ece6
Update cfssl to latest. (#4719)
This pulls in an upgrade to zlint 2.0.0.
2020-03-26 10:11:05 -07:00