fix(TLS): create OpenSSL strict-mode compliant certs #1531
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As mentioned in #1530, I recently ran into some issues with Valet certs not passing OpenSSL's X509 strict mode, which was enabled by default in Python 3.13. This made it difficult for python apps to communicate with php apps run under Valet during development.
This PR adds the necessary X509 extensions to both the CA and per-site leaf certificates to satisfy strict mode.
Note that the reference to the extension config file has been removed from the CSR creation command as the AKID extension can't be added without the CA certificate present (which it isn't when running this command). This has no effect on the final certificate as the CSR extensions were being overwritten when the certificate was signed anyway.
I have tested the migration pathway of this change under VirtualBuddy, and securing sites after this change continues to work regardless of whether the CA certificate was generated before or after this change.
The only thing to note is if the CA cert was generated prior to this change (and therefore doesn't have a SKID extension), generated leaf certificates will have a blank AKID, which shouldn't impact their validity to non-strict mode clients, however they will not pass strict mode validation until the CA is deleted and re-created with the new extensions.
If desired, logic could be added to detect the presence of the SKID extension in the CA certificate and forcibly re-create it if not found, however I didn't think this was wise as a default as it would disrupt the trust of other Valet site certificates until they too were re-created, which would likely be unexpected behaviour.