Skip to content

Start implementing Pebble-based integration testing#74

Merged
djc merged 5 commits intodjc:mainfrom
cpu:cpu-pebble_ci
Jan 28, 2025
Merged

Start implementing Pebble-based integration testing#74
djc merged 5 commits intodjc:mainfrom
cpu:cpu-pebble_ci

Conversation

@cpu
Copy link
Collaborator

@cpu cpu commented Jan 26, 2025

👋 Here's the start of some HTTP-01 integration testing w/ Pebble as the ACME CA, and the Pebble challenge test server serving mock DNS and the HTTP-01 response we populate from what instant-acme provides. It should be fairly straight forward to extend to testing other challenges, and different protocol features (e.g. errors with subproblems, ARI, cert profiles) but I wanted to get the minimum viable implementation up for review before going too far. WDYT?

So far a test issuance is performed by:

  • Creating an ACME account, and order for "example.com"
  • Configuring an HTTP-01 challenge response using the pebble-challtestsrv
  • Finalizing the order and fetching the certificate chain
  • Using the randomly generated Pebble issuer CA root to verify the issued certificate chain w/ rustls/webpki

@cpu cpu force-pushed the cpu-pebble_ci branch 2 times, most recently from 292aa93 to 150582e Compare January 26, 2025 22:41
Copy link
Owner

@djc djc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool stuff! Here's a first round of feedback.

Copy link
Owner

@djc djc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good! I like the logging, but think you should use the structured logging capability tracing provides instead of stuffing everything into the message field.

cpu added 5 commits January 28, 2025 09:06
Populate a tests/testdata directory with a PEM encoded CA certificate,
a PEM encoded server certificate issued by the CA, and the PEM encoded
private key for the server certificate.

All of the above is generated by the `certgen.rs` example using `rcgen`.
Run with: `cargo run --example certgen`
This commit adds an integration test using Let's Encrypt's pebble and
pebble-challtestsrv utilities. Since it requires either building Go code
from source, or downloading the pre-built binaries applicable for your
arch, the test is disabled by default for `cargo test`. In CI, or once
you've done the required setup, it can be invoked manually with `cargo
test --test integration`.

Once the test ACME server and challenge response server are ready,
a test issuance is performed by:

* Creating an ACME account, and order for "example.com"
* Configuring a HTTP-01 challenge response using the pebble-challtestsrv
* Finalizing the order and fetching the certificate chain
* Using the Pebble issuer CA root to verify the issued certificate
  chain w/ rustls/webpki
This workflow runs with stable rust on ubuntu-latest. It downloads
the latest available pebble and pebble-challtestsrv binaries, unpacks
them into the pwd and runs the integration tests.
This makes it convenient to verify CI passes without needing to open
a PR first.
@djc djc merged commit b7b4648 into djc:main Jan 28, 2025
9 checks passed
@djc
Copy link
Owner

djc commented Jan 28, 2025

Great, thanks!

@cpu
Copy link
Collaborator Author

cpu commented Jan 28, 2025

Thanks for the reviews :-)

@djc
Copy link
Owner

djc commented Jan 28, 2025

Going to do a followup, will tag you for review. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants