Skip to content

Conversation

@christianhoelzl
Copy link
Contributor

@christianhoelzl christianhoelzl commented Jul 3, 2025

This commit adds a new function Order::send_device_attestation(). This function can be used for a device-attest-01 challenge, that requires a payload to be provided when the ACME client notifies the ACME server that the challenge is ready. The challenge is described in the draft-acme-device-attest. Pebble has no support for this, so it is untested so far in the pebble test.

This new API method allows to use the ACME challenge device-attest-01. Motivation to use this challenge is to improve device management based on the methods described in the link.

@cpu
Copy link
Collaborator

cpu commented Jul 4, 2025

If the intent is to support device-attest-01, wouldn't we also need the challenge & identifier types? Maybe some broader motivation could be put into the PR desc :-)

More generally I'm wondering if it's premature to implement support here. AFAICT the cited ID hasn't been adopted by the ACME WG yet and is pretty early days. We added profiles support in a similar state so there's some precedent for that being OK, but in that case the diff is pretty small, and there was also both a convenient test server implementation (Pebble) and production deployment (LE).

I could be convinced it's stable enough to merit inclusion in the instant-acme API but I think would prefer to land all the parts at once vs piece by piece. WDYT?

@djc
Copy link
Owner

djc commented Jul 4, 2025

AFAICT the cited ID hasn't been adopted by the ACME WG yet and is pretty early days.

Given that the linked URL is /doc/draft-acme-device-attest/ I think the acme token there means it has been adopted (to some extent?) by the WG, otherwise I think the convention is to have an author's name in the draft identifier?

Generally agree it's probably early but on the other hand I like being somewhat early to support things that look serious enough. Also not too afraid of revving the API semver-incompatibly if necessary especially if breakage is confined to the specific use case.

@cpu
Copy link
Collaborator

cpu commented Jul 4, 2025

Given that the linked URL is /doc/draft-acme-device-attest/ I think the acme token there means it has been adopted

Oops, you're 100% right. The draft page says:

WG state WG Document

That's helpful 👍 I think if all the pieces were put together into one PR (separate commits are OK ofc) then I'm onboard.

@christianhoelzl christianhoelzl changed the title introduce set_ready_with_payload() for device-attest-01 challenge introduce send_device_attestation() for device-attest-01 challenge Jul 6, 2025
@christianhoelzl christianhoelzl force-pushed the set_challenge_with_payload branch from d6ffd8c to 0499228 Compare July 6, 2025 15:26
@christianhoelzl
Copy link
Contributor Author

This is an interesting discussion.

I also feel that it still is in an early stage. On the other hand, there already is support for this ACME challenge device-attest-01 in Step CA and maybe others.

Regarding the API, if limiting the new challenge set ready function to device attestation, then the &impl Serialize is not required and a blob fits better to even do the base64 encoding of payload.attObj. I changed it this way in the last commit.

If you look into the acme-device-attest demo from Brandon Weeks, the ACME server is Step CA and the ACME client based on a GO library from Google. This library provids an arbitrary payload for newer challenges, look here. So I think long term the API could end up having both, challenge-specific and a generic function to add an arbitrary payload for other challenges beyond device-attest-01.

@christianhoelzl christianhoelzl force-pushed the set_challenge_with_payload branch from 0499228 to 3c306f3 Compare July 7, 2025 07:21
@christianhoelzl
Copy link
Contributor Author

Rebased onto main

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.

This seems sensible to me.

@christianhoelzl christianhoelzl force-pushed the set_challenge_with_payload branch from 3c306f3 to 0acd83f Compare July 7, 2025 09:04
@christianhoelzl
Copy link
Contributor Author

Fixed both review comments (DeviceAttest before Empty, and Cow).

@djc djc requested a review from cpu July 7, 2025 09:25
Copy link
Collaborator

@cpu cpu left a comment

Choose a reason for hiding this comment

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

What about the two new Identifier types?

AIUI these can be included in a CSR. It would be fine to ignore them for the rcgen CSR generation code that this crate offers as a helper, but I think in all cases the CSR's identifiers need to match the order's identifiers, so an order would have to be constructed with the new identifier types even if you gin up a CSR externally, right?

@christianhoelzl christianhoelzl force-pushed the set_challenge_with_payload branch from 0acd83f to 993883d Compare July 8, 2025 07:05
@christianhoelzl
Copy link
Contributor Author

christianhoelzl commented Jul 8, 2025

I rebased and fixed the review comments (two new identifiers, better description). Thanks for the suggestions.
I'm not using rcgen for CSR, but it seems that two OIDs could be added to rcgen for the SANs.

Copy link
Collaborator

@cpu cpu left a comment

Choose a reason for hiding this comment

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

Thanks!

One last thought: have you tested this end-to-end with a server implementation? e.g. maybe that fork of step-ca you found? I think it'd be nice to confirm this works in practice before we merge it. I'm still a little bit nervous there's no test coverage.

Comment on lines +660 to +668
/// Permanent Identifier
///
/// Note that this identifier is only used for attestation.
PermanentIdentifier(String),

/// Hardware Module identifier
///
/// Note that this identifier is only used for attestation.
HardwareModule(String),
Copy link
Collaborator

Choose a reason for hiding this comment

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

I went down a bit of a rabbit hole thinking about what the value of these identifier types should be. I think String is the right choice for now, but I also filed some issues upstream about the spec because I think as written it leaves some important details up in the air w.r.t how CSRs and order identifiers interact:

brandonweeks/draft-bweeks-acme-device-attest#9
brandonweeks/draft-bweeks-acme-device-attest#10

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thats great! If it turns out, that there is something better than String then I'll provide a pr.

@christianhoelzl
Copy link
Contributor Author

I have partially tested with a private ACME test server such that the new method works fine. Testing with real hw and e.g. step-ca is on my todo list. Device-attestation is well documented for recent releases of step-ca (Brandon Weeks contributed to step-ca on this topic).

@cpu
Copy link
Collaborator

cpu commented Jul 8, 2025

I have partially tested with a private ACME test server such that the new method works fine

I would be OK merging on the basis of this testing if @djc concurs

@djc djc merged commit c116425 into djc:main Jul 8, 2025
12 checks passed
@christianhoelzl christianhoelzl deleted the set_challenge_with_payload branch July 9, 2025 10:19
@cpu cpu mentioned this pull request Jul 9, 2025
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.

3 participants