Repository navigation
Active Directory LDAPS connector, tested against Samba AD (§4.4) - #13
Merged
Merged
Conversation
Yoshiofthewire
force-pushed
the
kyguard/broker-schedule
branch
from
November 25, 2026 09:53
52fc62f to
4425d13
Compare
Yoshiofthewire
force-pushed
the
kyguard/connector-ad
branch
from
November 25, 2026 09:53
b58ccbb to
5c0fb93
Compare
Yoshiofthewire
force-pushed
the
kyguard/broker-schedule
branch
from
November 25, 2026 09:59
4425d13 to
8e4bd31
Compare
Yoshiofthewire
force-pushed
the
kyguard/connector-ad
branch
from
November 25, 2026 09:59
5c0fb93 to
d4f83ee
Compare
Member
Author
PR Reviewer Guide 🔍Here are some key observations to aid the review process: ⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪🧪 PR contains tests⚡ No major issues detectedAdvisory only: this comment never gates the pull request. |
Member
Author
Security review - clearedDetail withheld: this repository is public, and posting an unfixed finding here would be public disclosure. The full report was posted to the hand-off board at https://myslop.urlxl.us/f/pr-reviewer-busnes-app-kyguard-server-13, where it is readable by the operator and expires seven days after the last post. gpt-6.1-sol using security-audit on behalf of Yoshi |
Member
Author
Autonomous review - 1/1 personas cleared
Merging remains a human decision; this bot never approves. gpt-6.1-sol using security-audit on behalf of Yoshi |
Yoshiofthewire
force-pushed
the
kyguard/broker-schedule
branch
from
November 25, 2026 10:56
8e4bd31 to
fff702c
Compare
Yoshiofthewire
force-pushed
the
kyguard/connector-ad
branch
from
November 25, 2026 10:56
d4f83ee to
2c08435
Compare
Yoshiofthewire
force-pushed
the
kyguard/broker-schedule
branch
from
November 25, 2026 11:14
fff702c to
6c5a94c
Compare
Yoshiofthewire
force-pushed
the
kyguard/connector-ad
branch
from
November 25, 2026 11:14
2c08435 to
2a36617
Compare
Yoshiofthewire
force-pushed
the
kyguard/broker-schedule
branch
from
November 25, 2026 12:43
6c5a94c to
ea302d9
Compare
Yoshiofthewire
force-pushed
the
kyguard/connector-ad
branch
from
November 25, 2026 12:43
2a36617 to
6d14826
Compare
Member
Author
|
Note 🤖 Claude Opus 5.5 responding on behalf of Yoshiofthewire PR Reviewer Guide: both items fixed.
|
Yoshiofthewire
force-pushed
the
kyguard/broker-schedule
branch
from
November 25, 2026 12:50
ea302d9 to
d901b32
Compare
Yoshiofthewire
force-pushed
the
kyguard/connector-ad
branch
2 times, most recently
from
November 25, 2026 12:56
04d1930 to
a82c72e
Compare
The ad_ldaps connector dials only the descriptor's host and port, trusts only its tls_ca_pem with the host as server name, simple-binds as the account with P_old, reads pwdLastSet and msDS-KeyVersionNumber as the baseline, and sends one unicodePwd modify (delete old, add new, both UTF-16LE quoted) only after the broker's commit. Verification is a fresh bind with P_new and pwdLastSet advancing. LDAP 49 is a deterministic authentication failure; 19 and 53 on the modify are refusals. It reports the domain minPwdAge, so a refusal waits for the minimum-age deadline. Tests run the real broker state machine against a Samba AD DC in Docker (CI job "connectors"): rotation, kill after ack_received and after the write, the default one-day minimum age, wrong CA and wrong host name. The broker test rig moves to internal/broker/brokerrig for reuse. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
After the TLS handshake go-ldap requests observed only the connection's fixed timeout, so a cancelled or shorter-deadline caller could block 30 seconds per bind, baseline read, password-age search or modify while the directory was unresponsive. Each operation now registers a context.AfterFunc that closes the raw connection, and Change checks the context before the commit and again after it, so no modify starts after cancellation. Tested with a stalling TLS listener (no Docker). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
For an account governed by a fine-grained password policy the domain's minPwdAge is not the enforced minimum age; reporting it could schedule retries before the real minimum age expires, producing refusals that spend the broker's three-refusal limit. PasswordAge now reads the account's msDS-ResultantPSO and that PSO's msDS-MinimumPasswordAge, falling back to the domain policy only when there is no PSO. A PSO the account cannot read makes the minimum age unknown (an error), so the broker keeps its previously known deadline (DECISIONS 65). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Yoshiofthewire
force-pushed
the
kyguard/broker-schedule
branch
from
November 25, 2026 14:11
01699e1 to
053d64f
Compare
Yoshiofthewire
force-pushed
the
kyguard/connector-ad
branch
from
November 25, 2026 14:11
a82c72e to
b10b467
Compare
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
In one line: Brokers can now rotate Active Directory accounts over LDAPS (self-change), proven against a real Samba AD DC in a new CI job.
What changed
internal/connectors/adldaps: dials only the descriptor'shost:port, trusts only itstls_ca_pemwith the host as server name (TLS ≥ 1.2), simple-binds as the account withP_old, baselinepwdLastSet+msDS-KeyVersionNumber, oneunicodePwdmodify (delete old, add new, UTF-16LE quoted) sent only after the broker's commit, verify by a fresh bind withpwdLastSetadvancing (§4.4).52e) → deterministic auth failure (§4.6); 19 / 53 on the modify → refusal. It reports the domainminPwdAge, so a refused rotation waits for the minimum-age deadline.KY_TEST_DOCKER=1 go test -race ./internal/connectors/...;publishnow needs it.internal/broker/brokerrigso connector tests drive the real state machine.Review this
internal/connectors/adldaps/adldaps.goopen/Change: the TLS pinning and the commit-before-modify order..github/workflows/ci.ymlconnectors: the new job and its place inpublish.needs.Safe to skip:
connectortest(Docker helpers), the Samba test image.Checked: against Samba 4.21 AD in Docker on Major (
kslot,-race): 9 tests incl. rotation with the old password refused afterwards, kill afterack_received(no write, quarantine) and after the write (probe verifies), the default 1-day minimum age (refused, deadline set), wrong CA and wrong host name (handshake fails,badPwdCountstays 0), exactly one failed bind on a wrong password. Full suite-race+ FIPS on SQLite (k81) and PostgreSQL (k80), exit 0 (Docker tests skip there). 6 mutations killed (Detail). Not checked: a Windows Server DC; the new CI job has not run yet (first run is on this PR).Decided for you (
docs/DECISIONS.md48–49):go-ldap/v3(its NTLM/GSSAPI code is never called; only simple bind), TLS 1.2 floor for older Windows Servers; the LDAP result codes above. The Samba test image turns off Samba's hour-long acceptance of the previous password (real AD refuses old passwords on LDAP binds) and enables bad-password counting.You need to: nothing.
§13 checklist: Phase 1A "
ad_ldaps… connectors, minimum password age and refusal retry rules"; acceptance 2, 3, 7 (LDAPS CA), 9 (Samba default) on AD. Stacked on #12.Detail
TestWrongCAOrHostFailsTheHandshakeInsecureSkipVerifyTestMinimumAgeRefusalTestLoginAndAuthFailurepwdLastSetto advance<instead of<=TestChangeAndVerifyReview fixes (25 Nov, Guide "Effective policy", "Ignored cancellation")
PasswordAgereadsmsDS-ResultantPSOon the account's own object and reports that PSO'smsDS-MinimumPasswordAge; an unreadable PSO makes the age unknown (an error, never the shorter domain value); no PSO falls back to the domainminPwdAge(DECISIONS 65). Deployments with PSOs should let the account read its PSO.msDS-ResultantPSOTestFineGrainedMinimumAge(Samba AD, PSO with a 2-day minimum)TestOperationsObserveCancellation(each timed out after 5 s)ctx.Err()checkTestNoModifyAfterCancellationChecked: Samba AD suite
-raceunderksloton Major (10 tests) and at the #16 tip.Round 4 (25 Nov):
mainmerged upmain(736e148) and the round-4 fixes on Broker listener, CA and pairing (§4.1) #8 (CodeQL), Control Plane rotation storage and broker channel requests (§3.5, §4.3) #10 (MaxEnvelope), Enrollment and re-enrollment (§3.4, §4.5) #15 and Checkout, possession proofs, leases, manual rotation (§3.4, §3.6) #16. There are no code changes of its own. The only conflict was additive, ininternal/store/store.go(Vault()next toMFA(); both kept, in Control Plane rotation storage and broker channel requests (§3.5, §4.3) #10).Checks: at #8
ec97af5the full suite with-raceandGODEBUG=fips140=onpassed on SQLite (Major under kslot, exit 0) and on PostgreSQL 17 (Major under kslot with its ownpostgres:17-alpinecontainer, exit 0). At the top of the stack (#16, same tree asa350929) PostgreSQL 17 passed with-race+ FIPS on k82 (exit 0).gofmtandgo vet(also-tags docker) are clean at every branch head. The mutation proofs ran on throwaway copies.Round 4b (25 Nov)
CreateCAretry), Control Plane rotation storage and broker channel requests (§3.5, §4.3) #10 (chain room for standing wraps), Broker journal and rotation state machine (§4.2, §4.3, §4.6) #11 (start-up retry), Enrollment and re-enrollment (§3.4, §4.5) #15 and Checkout, possession proofs, leases, manual rotation (§3.4, §3.6) #16. The DECISIONS conflicts were additive, and both sides were kept.Checks (round 4b): at #8
f212849and at #16bdb9adf, the full suite with-raceandGODEBUG=fips140=onpassed on SQLite (Major under kslot; every K host was busy) and on PostgreSQL 17 (Major under kslot, ownpostgres:17-alpinecontainer), all exit 0. #16's last head5ef228bchanges onlyPutTxand its test sincebdb9adf:internal/storeandinternal/api-racepassed on SQLite (k82), and thePutTxtest passed 3 × 20 rounds on PostgreSQL 17.gofmtandgo vet(also-tags docker) are clean at every branch head. The mutations ran on throwaway copies.Round 4c (25 Nov)
store/vault_test.go), and both sides were kept.Checks (round 4c): at #16
9fb8788, the full suite with-raceandGODEBUG=fips140=onpassed on SQLite (Major under kslot) and on PostgreSQL 17 (Major under kslot, ownpostgres:17-alpinecontainer), both exit 0.gofmtandgo vet(also-tags docker) are clean at every changed branch head. The race tests ran on PostgreSQL 17 in my own container; the mutations ran on throwaway copies.Round 5 (25 Nov)
mainto auth: kyguard-cli login, server side (§7.6) #27).f8b4fd1points Broker journal and rotation state machine (§4.2, §4.3, §4.6) #11's new test atbrokerrig.WrapCP, which this PR introduces. vet andinternal/brokerpass at this head (k82). The full suite ran at Broker journal and rotation state machine (§4.2, §4.3, §4.6) #11 and Checkout, possession proofs, leases, manual rotation (§3.4, §3.6) #16.🤖 Generated with Claude Code