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

CA-405593: Do not write extraneous data into the host certificate file #6263

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

psafont
Copy link
Member

@psafont psafont commented Jan 29, 2025

When installing host certificates, the parser used accepts string with random characters surrounding the PEM-encoded data. The ad-hoc parser used to read the host certificate file was unable to parse them.

Because the PEM-encoded objects are copied as-is after validating them, the ad-hoc parser fails to read the file correctly when xapi restarts.

This change fixes the issue by making sure that the written file's data has been sanitized, by using parsed datastructures instead of user-provided data.

Parse, don't validate

I've manually tested the fix on a host, before and after to validate that indeed now all the characters in between the PEM-encoded objects are stripped

@psafont psafont force-pushed the private/paus/parsed-pems branch from 2d47ce8 to 3270920 Compare January 30, 2025 09:49
ocaml/gencert/lib.ml Outdated Show resolved Hide resolved
When installing host certificates, the parser used accepts strings with
extraneous characters surrounding the PEM-encoded data. The ad-hoc parser used
to reject such data because it was stricter.

Because the PEM-encoded objects are copied as-is after validating them, the
ad-hoc parser failed to read the file correctly on xapi restarts.

This change fixes the issue by encoding the key and certificates in PEM format
from parsed datastructures instead of using user-provided inputs directly.

    Parse, don't validate

Signed-off-by: Pau Ruiz Safont <pau.ruizsafont@cloud.com>
@psafont psafont force-pushed the private/paus/parsed-pems branch from 3270920 to 8a6af5e Compare January 30, 2025 10:49
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