test(e2e): add Kerberos/SPNEGO end-to-end test harness#755
Closed
aborovsky wants to merge 22 commits into
Closed
Conversation
Self-contained Docker Compose environment for validating Kerberos/SPNEGO authentication in the bright-cli repeater (PR #751). Stack: - kdc/ MIT krb5 KDC — creates EXAMPLE.COM realm, principals, keytab - httpd/ Apache httpd + mod_auth_gssapi — SPNEGO-protected /protected endpoint - repeater/ bright-cli built from feat/kerberos-auth with @brightsec/node-libcurl overridden to feat/gssapi-support (node-libcurl PR #19, unmerged) which compiles libcurl with GSSAPI via vcpkg test.sh runs 7 automated steps: 1. Stack startup + KDC healthcheck 2. GSS-API present in Curl.getVersion() output 3. kinit smoke test (ticket acquisition) 4. Direct curl --negotiate baseline against httpd 5. Regression: Connection: close not injected for Kerberos requests 6. Regression: CURLGSSAPI_DELEGATION_FLAG = 2 (unconditional), not 1 (policy) 7. Repeater platform registration (optional, requires BRIGHT_TOKEN + REPEATER_ID) Depends on: #751 NeuraLegion/node-libcurl#19
typedoc-plugin-ga@1.1.1 requires typedoc@^0.27.x but feat/gssapi-support has typedoc@0.28 as a dev dep. This conflict is dev-only and does not affect the native C++ build or the packed tarball.
- Switch to Node.js 22 (node-libcurl feat/gssapi-support requires >=22.14) - Use --ignore-scripts on npm install to skip Windows-only vcpkg-setup.js - Manually generate vcpkg.json: substitute version/OpenSSL placeholders and inject 'gssapi' feature (absent from vcpkg.template.json) - Run vcpkg install --triplet x64-linux to compile libcurl with GSSAPI - Build native addon via node-pre-gyp with explicit --curl_include_dirs / --curl_libraries flags (bypasses curl-config entirely) - Add LD_LIBRARY_PATH for vcpkg_installed shared libs - Verify GSS-API present in Curl.getVersion() before packing
Docker parser treats bare words at line-start inside RUN as Dockerfile instructions. Extract the two multi-line Node.js snippets into gen-vcpkg-json.js and check-gssapi.js, COPY them in, and call them from single-line RUN commands.
openldap requires autoconf/automake/libtool (not installed in the build container); gsasl would have the same issue. Neither feature is needed for SPNEGO/Kerberos E2E testing, so exclude them alongside sspi.
libunistring (idn2 dep) and other vcpkg autotools-based ports require autoconf, autoconf-archive, automake, and libtool to be present.
…copy binary manually
…un does not conflict
…Executor Exercises the actual code path changed by PR #751: HttpRequestExecutor (kerberos: true, credentials: scanner@EXAMPLE.COM:ScannerPass1) → libcurl CURLAUTH_NEGOTIATE (HTTPAUTH=4) → mit-krb5 GSSAPI handshake → Apache httpd mod_auth_gssapi (Require valid-user) → HTTP 200 Previously test.sh only validated build-time artifacts and static analysis. This new step confirms the end-to-end authentication path works at runtime.
kerberos-integration-test.ts uses Docker-context relative imports (./src/RequestExecutor/...) that do not exist at the repo root. Excluding kerberos-e2e/ from the root tsconfig prevents webpack and ts-jest from trying to compile it during the main build and unit test jobs.
tsconfig.build.json has its own exclude array that does not inherit from tsconfig.json, so the previous fix did not cover the webpack build. Both tsconfig files now exclude kerberos-e2e/.
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.
Kerberos/SPNEGO E2E Test Harness
This PR adds a self-contained Docker Compose E2E test harness that validates Kerberos/SPNEGO authentication through the bright-cli repeater, exercising the changes in:
feat/kerberos-auth)feat/gssapi-support)What's included
Test results (all passing ✅)
Step 6 — Full E2E integration test
kerberos-integration-test.tsruns inside the repeater container viats-nodeand exercises the exact code path changed by PR #751:Apache returns 401 on any SPNEGO failure with
Require valid-user. Getting HTTP 200 is definitive proof the full authentication chain works end-to-end.Key build findings
x64-linuxtriplet). Linking only-lcurlleaves GSSAPI symbols unresolved; fixed by usingpkg-config --static libcurlfor all transitive link flags.scripts/vcpkg-common.jsexits immediately on non-Windows; the entire npm install/preinstall hook chain is a no-op on Linux. All vcpkg work is done manually in the Dockerfile.npm run build:dist) afternode-pre-gyp;--ignore-scriptsskips it..nodebinary is excluded fromnpm pack; must be copied manually after installing the tarball with--ignore-scripts.GssapiAllowedMechdirective is not available in the Ubuntu 22.04 version ofmod_auth_gssapi; removed (default behavior accepts SPNEGO).Documented bugs in PR #751
CURLGSSAPI_DELEGATION_FLAG = 1(PolicyFlag) — should be2(DelegationFlag).--kerberos-delegationsilently uses policy-gated delegation.Connection: closewas being injected for all requests (not confirmed in current bundle — may be refactored).Running the tests