fix(traefik): exclude private keys by suffix so -key hostnames are served - #165
Merged
Conversation
…rved #163 The certificate scan dropped every path containing -key, so a certificate for a hostname such as my-keycloak.spark.loc was never referenced in auto-tls.yml while certs list showed it installed. The filter is now find's own suffix match on -key.pem and -key.crt, which also removes the stray-backslash warning GNU grep printed. The integration suite runs the scan on such a certificate in a throwaway container and asserts it is referenced once. Closes: #163 Assisted-by: claude-code/claude-fable-5-1
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨No code suggestions found for the PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
User description
Closes #163.
What changes
The certificate scan in
build/traefik/entrypoint.shexcluded private keys withgrep -v "\-key", a substring match on the whole path. Any certificate whose hostname contains-key(my-keycloak.spark.loc,api-keys.spark.loc) was dropped with the keys, so Traefik never served it whilecerts listshowed it installed.The filter is now
find's own suffix match:! -name "*-key.pem" ! -name "*-key.crt". Nogrep, so thestray \ before -warning GNU grep printed on every scan is gone too.test/test-certs.sh, which mirrors the scan, gets the same line.Verification
Run in a throwaway container from the current
http-proxy-traefikimage with the fixed entrypoint mounted over/ep.sh, against a scratch directory holdingmy-keycloak.spark.loc,audiolyzer.spark.locand another.crtpair:test/test.shgains the same case: amy-keycloak.spark.locpair through the scan, asserting the certificate is referenced exactly once.shellcheck -s shon the entrypoint is clean.Takes effect
This is a container change, so a machine sees it after the images are rebuilt on
mainand pulled withspark-http-proxy upgrade.PR Type
Bug fix, Tests, Documentation
Description
Match private keys by filename suffix
Serve certificates containing
-keyin hostnamesAdd regression coverage for certificate scanning
Document the certificate filtering fix
Diagram Walkthrough
File Walkthrough
entrypoint.sh
Correct Traefik private-key certificate filteringbuild/traefik/entrypoint.sh
findsuffix exclusions*-key.pemand*-key.crt-keyin hostnamestest-certs.sh
Align certificate test filtering with entrypointtest/test-certs.sh
test.sh
Test certificates with `-key` hostnamestest/test.sh
my-keycloak.spark.locregression caseCHANGELOG.md
Document corrected certificate suffix filteringCHANGELOG.md
-key#163