Repository navigation
Initial challtestsrv package & vendored deps. - #1
Conversation
Boulder has a nice handy [`challtestsrv` package and command](https://github.com/letsencrypt/boulder/tree/9e39680e3f78c410e2d780a7badfe200a31698eb/test/challtestsrv) used for integration tests. Its small and useful enough to live in its own repo. This will make it easy for Boulder's load-generator to use the common package and for Pebble's pebble-challtestsrv command to use it as well. The `challtestsrv` package is ported over from Boulder mostly-as is with a few small improvements. Notably: * The TLS-ALPN-01 and HTTPS HTTP-01 features were split into two separate binds. This helps us preserve strict TLS-ALPN-01 challenge responses while also supporting HTTP-01 -> HTTPS HTTP-01 redirects. (See letsencrypt/boulder#3962) * The "FAKE_DNS" env var is removed. Now there is a default IPv4 and a default IPv6 address that can be set via the management API. These default addresses are used for A/AAAA query responses when there is not a more specific mock. * Hardcoded Boulder specific mock DNS data is removed. In its place are new management API functions for adding/removing mock A, AAAA, and CAA records * The output is less noisy now. The DNS server no longer prints a line per reply.
jsha
left a comment
There was a problem hiding this comment.
Looks great, thanks for this refactoring! I've got some comment-level feedback. I'm going to try something a little different and go ahead and merge this PR, then send you a PR with my proposed fixes.
|
|
||
| // ListenAndServe for a challHTTPServer will call the underlying http.Server's | ||
| // ListenAndServeTLS if the server has a non-nil TLSConfig, otherwise it will | ||
| // use the underlying http.Server's ListenAndServe(). This allos for |
| func (c challHTTPServer) ListenAndServe() error { | ||
| // If the server has a TLSConfig then use ListenAndServeTLS with empty | ||
| // certfile/keyfile arguments. This will use the self-signed certificate we | ||
| // issued when constructing the TLSConfig in `httpOneServer`. |
There was a problem hiding this comment.
We actually issued the self-signed certificate at init time (via the var assignment above). Also, it might be clearer here to say:
"This will use the certificate and key from TLSConfig"
Then, below at line 179-184 we can see that we're using the self-signed certificate generated at startup.
Duplicating the comment both here and there is suboptimal because it increases the chance that one comment will become out of date.
| if !strings.HasSuffix(host, ".") { | ||
| host = host + "." | ||
| } | ||
| fmt.Printf("Adding %#v for %q\n", policies, host) |
| } | ||
|
|
||
| func (c challTLSServer) ListenAndServe() error { | ||
| // We never want to serve a plain cert so leave certFile and keyFile |
There was a problem hiding this comment.
Here I would say instead: "Since we set TLSConfig.GetCertificate, the certfile and keyFile arguments are ignored and we leave them blank."
Boulder has a nice handy
challtestsrvpackage and command used for integration tests. Its small, stand-alone, and useful enough to live in its own repo. This will make it easy for Boulder's load-generator to use the common package and for Pebble's pebble-challtestsrv command to use it as well.The
challtestsrvpackage is ported over from Boulder mostly-as is with a few small improvements. Notably: