Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add EK Certificate Chain support #116

Merged
merged 4 commits into from
Feb 4, 2025
Merged

Add EK Certificate Chain support #116

merged 4 commits into from
Feb 4, 2025

Conversation

ematery
Copy link
Contributor

@ematery ematery commented Oct 21, 2024

No description provided.

Copy link
Member

@THS-on THS-on left a comment

Choose a reason for hiding this comment

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

Thanks for creating a proposal! This is definitely a welcome change


## Proposal

* keylime_agent, send `ek_ca_chain` to registrar
Copy link
Member

Choose a reason for hiding this comment

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

We might get away with just storing the entire chain in the ekcert field. @ansasaki any opinion on that?

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with @THS-on that most probably a new field is not needed. We could simply append the intermediate certificates to the EK certificate.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will then implement the necessary changes to store the chain in the ekcert field and update the existing fields in the database. I will need to add "-----BEGIN CERTIFICATE-----" and "-----END CERTIFICATE-----" (in PEM format) to the existing ekcerts in the database, as I require a delimiter in the chain.

Please notify me when everyone agrees that this is the way to proceed.

Copy link
Member

Choose a reason for hiding this comment

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

Yep using PEM encoding for the chain is probably a good idea, as this is standard and then can also be easily read by e.g. openssl


#### Providing big chains as attack
* Limit the amount of allowed chain size
* Use mTLS to only allow verified clients access
Copy link
Member

Choose a reason for hiding this comment

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

Not really related to this change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will remove this

@THS-on THS-on mentioned this pull request Oct 22, 2024
28 tasks
## Proposal

* keylime_agent, send `ek_ca_chain` to registrar
* keylime registrar, store `ek_ca_chain` in database
Copy link
Contributor

Choose a reason for hiding this comment

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

If possible, the chain should be stored with the EK certificate and no new entry is added to the database.
Sorry for suggesting that before, but I think the less we modify the database the better.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will update


* keylime_agent, send `ek_ca_chain` to registrar
* keylime registrar, store `ek_ca_chain` in database
* keylime tenant, verify `ekcert` against `ek_ca_chain` and `ek_ca_chain` against `tpm_cert_store`
Copy link
Contributor

Choose a reason for hiding this comment

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

The process of verifying the EK certificate necessarily involves verifying its signature against the whole chain.
I think this sentence can be removed or rephrased to not imply that there are separate steps on the verification process.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will update

### Risks and Mitigations

#### Registrar/Tenant could be become incompatible with older database
* Update database to new scheme, only a single key is added to the registar db 'ek_ca_chain'
Copy link
Contributor

Choose a reason for hiding this comment

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

If possible, avoid changing the database and store the certificate chain with the EK certificate.

* Update database to new scheme, only a single key is added to the registar db 'ek_ca_chain'

#### Registrar/Tenant could become incompatible with older Agent
* Make 'ek_ca_chain' optional
Copy link
Contributor

Choose a reason for hiding this comment

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

If possible, avoid adding a new parameter and simply append the chain to the EK certificate.

@ematery
Copy link
Contributor Author

ematery commented Nov 5, 2024

Shall i update the enhancement request and then just open a new pull request?

@THS-on
Copy link
Member

THS-on commented Nov 22, 2024

Shall i update the enhancement request and then just open a new pull request?

@ematery sorry this got lost in my inbox. You can just update the current PR

@THS-on
Copy link
Member

THS-on commented Jan 9, 2025

@ematery what is the status here? I think once the suggested changes are in the PR, we can merge this.

@ematery
Copy link
Contributor Author

ematery commented Jan 9, 2025

@THS-on Thanks for the reminder. I updated the pull request.

@THS-on
Copy link
Member

THS-on commented Jan 10, 2025

@ematery our PR now also includes another markdown document. Can you rebase on latest master and ensure that you are not accidentally including 114-agent-multiple-api.md?

@ematery ematery force-pushed the master branch 2 times, most recently from a608d7a to b54a1cd Compare January 13, 2025 08:56
@ematery ematery closed this Jan 13, 2025
Signed-off-by: Eugen Matery <e.matery@digitalendoscopy.de>
Signed-off-by: Eugen Matery <e.matery@digitalendoscopy.de>
Copy link
Member

@THS-on THS-on left a comment

Choose a reason for hiding this comment

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

Just some leftovers of the initial proposed extra field, that need to be removed. Otherwise LGTM

ematery and others added 2 commits January 22, 2025 09:05
Co-authored-by: Thore Sommer <THS-on@users.noreply.github.com>
Signed-off-by: Eugen Matery <e.matery@digitalendoscopy.de>
Co-authored-by: Thore Sommer <THS-on@users.noreply.github.com>
Signed-off-by: Eugen Matery <e.matery@digitalendoscopy.de>
@ematery
Copy link
Contributor Author

ematery commented Jan 28, 2025

Are there still open points?

@THS-on
Copy link
Member

THS-on commented Feb 3, 2025

Don't think so. @ansasaki can you have a look at it before merging?

### Risks and Mitigations

#### Registrar/Tenant could be become incompatible with older database
* Update existing database values for `ekcert` to PEM format.
Copy link
Contributor

Choose a reason for hiding this comment

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

Note: make sure the newer version of the registrar and tenant can read both formats from the database (DER and PEM), to keep it compatible with data coming from an existing database.


## Proposal

* keylime_agent: update `ekcert` field to use PEM format, so multiple certificates can be stored in the field and a marker exists that shows the start and end of each certificate.
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a note: this is an API breaking change as it changes the ABI (it is backwards incompatible). This requires a major API version bump.

@ansasaki ansasaki merged commit 7c217fa into keylime:master Feb 4, 2025
1 check passed
@ansasaki ansasaki mentioned this pull request Feb 25, 2025
30 tasks
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