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

Fixes #38119: When the "server_ca_cert" is set and has an empty line, it will fail #969

Closed
wants to merge 1 commit into from

Conversation

phess
Copy link

@phess phess commented Dec 31, 2024

When bundle_pem contains non-certificate contents after the final ---END CERTIFICATE--- line, the OpenSSL::X509::Certificate.new(pem.join) action will fail because pem.join will be an empty or non-certificate string and the load_fullchain(bundle_pem) function will fail.

This change adds a check for the presence of -+BEGIN followed (however many lines later) by -+END before trying to load it as an x509 certificate object, thus preventing blank contents from being loaded as x509 certificates.

When bundle_pem contains non-certificate contents after the final `---END CERTIFICATE---` line, the `OpenSSL::X509::Certificate.new(pem.join)` action will fail because `pem.join` will be an empty or non-certificate string and the `load_fullchain(bundle_pem)` function will fail.

This change adds a check for the presence of `-+BEGIN` followed (however many lines later) by `-+END` before trying to load it as an x509 certificate object.
@phess phess changed the title Fixes SAT-30314: prevents new lines at the end of server_ca_cert from causing failures Fixes #38119: When the "server_ca_cert" is set and has an empty line, it will fail Dec 31, 2024
@ehelms
Copy link
Member

ehelms commented Jan 6, 2025

I am first trying to update the tests to show this -- #971

@ehelms
Copy link
Member

ehelms commented Jan 6, 2025

Closing in favor of solution and updates in #971, thanks @phess for the pointer!

@ehelms ehelms closed this Jan 6, 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.

2 participants