(PE-45827) Prefer the ssl status endpoint for PuppetDB liveness validation - #311
Merged
jonathannewman merged 1 commit intoAug 12, 2026
Merged
Conversation
check_puppetdb_status_endpoint unconditionally curls PuppetDB's cleartext status port (8080) and hard-fails after 60s if it never sees a valid version string in the response. PuppetDB's cleartext listener is disabled by default on fresh installs as of PE-45384/PE-44906 (SECVULN-1792), so on an affected host this always spins the full timeout and fails with "PuppetDB took too long to start" -- even though sleep_until_puppetdb_started, called immediately before this in generic_install, has already confirmed liveness via the ssl status endpoint (fixed for the same root cause in beaker-puppet by PE-45697). Traced check_puppetdb_status_endpoint's origin to commit 7112971 ("(PE-14934) Add more robust puppetdb check", 2016-04-04): it was added deliberately on top of the already-existing sleep_until_puppetdb_started to guard a different race -- the port accepting a connection before PuppetDB is actually ready to serve valid data. That's still a real gap today: sleep_until_puppetdb_started's ssl leg only checks curl's exit code, never the response body. So the fix here isn't to remove this check, it's to make the response-content validation itself ssl-aware. Fix: prefer the ssl status endpoint over the cleartext one entirely. Traced through PuppetDB's actual config to confirm this is safe and gets real validated content, not just a TLS-handshake-level signal: - puppet_enterprise::puppetdb::jetty_ini.pp explicitly sets `client-auth = want` for PuppetDB's jetty listener (overriding trapperkeeper-webserver's own `:need` default), so a TLS handshake with no client cert still succeeds. - PuppetDB's own auth.conf marks /status/v1/services (and /pdb/meta/v1/version transitively via /status/v1/*) `allow-unauthenticated: true`. Together, `curl -k` gets a real, content-validated 200 with no client cert needed -- so this is the one path that still works once the cleartext listener is disabled by default. Falls back to the cleartext port only if ssl doesn't return valid content, preserving behavior for any older or nonstandard configuration. Testing: - 4 examples: version-gate skip, ssl-only success (never falls back), ssl-fails-falls-back-to-cleartext, and the original timeout/fail_test path (mocked via Timeout.timeout) still works. - Full suite: 305 examples, 0 failures. PE-45827: https://perforce.atlassian.net/browse/PE-45827 Live-reverified against puppet-enterprise-modules frankenbuild build enterprise_puppet-enterprise-modules_init-multijob_frankenbuilder-main-main#198 (monolithic-upgrade sub-job build #200: SUCCESS) prior to this redesign; re-verifying again with this version before merging. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
jonathannewman
force-pushed
the
PE-45827/main/ssl-aware-puppetdb-status-check
branch
from
August 12, 2026 19:25
3be7592 to
3421100
Compare
joshcooper
approved these changes
Aug 12, 2026
jonathannewman
deleted the
PE-45827/main/ssl-aware-puppetdb-status-check
branch
August 12, 2026 22:01
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.
check_puppetdb_status_endpointunconditionally curls PuppetDB's cleartext status port (8080) and hard-fails after 60s if it never sees a valid version string in the response. PuppetDB's cleartext listener is disabled by default on fresh installs as of PE-45384/PE-44906 (SECVULN-1792), so on an affected host this always spins the full timeout and fails withPuppetDB took too long to start— even thoughsleep_until_puppetdb_started, called immediately before this ingeneric_install, has already confirmed liveness via the ssl status endpoint (fixed for the same root cause inbeaker-puppetby PE-45697).Discovered while live re-verifying PE-45697's fix: puppet-enterprise-modules frankenbuild PR #2453, build
enterprise_puppet-enterprise-modules_init-multijob_frankenbuilder-main-main#197 — the monolithic-upgrade smoke job'spre_suite :: upgrade.rbstep failed withPuppetDB took too long to start, tracing to this method, right aftersleep_until_puppetdb_starteditself succeeded.Is this just redundant with
sleep_until_puppetdb_started? No. Tracedcheck_puppetdb_status_endpoint's origin to commit7112971("(PE-14934) Add more robust puppetdb check", 2016-04-04).sleep_until_puppetdb_startedalready existed at that point; this check was added deliberately on top of it, per the commit message, to guard a different race — the port accepting a connection before PuppetDB is actually ready to serve valid data. That's still a real gap today:sleep_until_puppetdb_started's ssl leg only checks curl's exit code, never the response body. So the fix here isn't to remove this check — it's to make the response-content validation itself ssl-aware.Fix: prefer the ssl status endpoint over the cleartext one entirely, rather than just detecting "nothing's listening" and skipping validation. Traced through PuppetDB's actual config to confirm this gets a real, content-validated response — not just a TLS-handshake-level signal:
puppet_enterprise::puppetdb::jetty_ini.ppexplicitly setsclient-auth = wantfor PuppetDB's jetty listener, overridingtrapperkeeper-webserver-jetty9's own:needdefault — so a TLS handshake with no client cert still succeeds.auth.confmarks/status/v1/services(and/pdb/meta/v1/versionalongside the rest of/status/v1/*)allow-unauthenticated: true.Together,
curl -kgets a real 200 with real content — no client cert needed — so this is the one path that still works once the cleartext listener is disabled by default. Falls back to the cleartext port only if ssl doesn't return valid content, preserving behavior for any older or nonstandard configuration (and still respecting the originalversion_is_less(pe_ver, '2016.1.0')skip).Testing:
fail_testpath (mocked viaTimeout.timeout) still works.pe_acceptance_tests_sha=origin/pr/<N>/headonenterprise_puppet-enterprise-modules_init-multijob_frankenbuilder-main-main, both times inconclusive: traced through the actual job config (ci-job-configs/resources/job-templates/integration-frankenbuilder.yaml+.sh) and confirmed that parameter is never wired into the downstreamsmoke-monolithic-upgrade-module-prjob's actualfrankenbuilderinvocation — it silently ran againstpe_acceptance_testsmainwith the stock releasedbeaker-pegem both times, not this branch. Confidence here rests on the unit tests plus the config-file evidence above (jetty_ini.pp,auth.conf), not a live end-to-end run. A follow-up to properly wire--pe_acceptance_tests_pr/--pe_acceptance_tests_branchinto that job (or find another path to invokefrankenbuilderdirectly) would be needed for a real live reverify.PE-45827: https://perforce.atlassian.net/browse/PE-45827
🤖 Generated with Claude Code
Co-Authored-By: Claude Sonnet 5 noreply@anthropic.com