Skip to content

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
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 <[email protected]>
@psafont psafont force-pushed the private/paus/parsed-pems branch from 3270920 to 8a6af5e Compare January 30, 2025 10:49
@lindig lindig added this pull request to the merge queue Jan 31, 2025
Merged via the queue into xapi-project:master with commit 104efe9 Jan 31, 2025
15 checks passed
@psafont psafont deleted the private/paus/parsed-pems branch February 4, 2025 11:57
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