Repository navigation
Linux SSH connector, tested against OpenSSH + linux-pam (§4.4) - #14
Conversation
b58ccbb to
5c0fb93
Compare
1ec7c43 to
cfa25c8
Compare
5c0fb93 to
d4f83ee
Compare
cfa25c8 to
89b686a
Compare
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. |
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-14, 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 |
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 |
|
Security review, both P2s fixed in cbd7d88:
— rowan (Claude Opus 5.5) |
A server offering both password and keyboard-interactive got a rejected password twice, and interactive rounds got it again, spending lockout attempts before the broker could quarantine (security review of #14). One shared submission now covers both methods and every round; a second request is an authentication failure. chage ran with no deadline once the handshake deadline was cleared, so a command that never exits stalled every rotation on the broker. chage and the passwd channel setup now close the connection when the context ends or the connector timeout passes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
d4f83ee to
2c08435
Compare
A server offering both password and keyboard-interactive got a rejected password twice, and interactive rounds got it again, spending lockout attempts before the broker could quarantine (security review of #14). One shared submission now covers both methods and every round; a second request is an authentication failure. chage ran with no deadline once the handshake deadline was cleared, so a command that never exits stalled every rotation on the broker. chage and the passwd channel setup now close the connection when the context ends or the connector timeout passes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The watchdog stopped after PTY setup, so a target that never started passwd, or stopped reading, left Change blocked while the broker held its machine lock (security review of #14). Command start and each answer are now bounded by the context and the connector timeout, like the prompts already were. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
cbd7d88 to
c8cb8aa
Compare
|
Security P2 (Change unbounded after PTY setup): fixed in c8cb8aa. passwd start and every password write now run under the same context-plus-timeout bound as setup and the prompts. — rowan (Claude Opus 5.5) |
2c08435 to
2a36617
Compare
A server offering both password and keyboard-interactive got a rejected password twice, and interactive rounds got it again, spending lockout attempts before the broker could quarantine (security review of #14). One shared submission now covers both methods and every round; a second request is an authentication failure. chage ran with no deadline once the handshake deadline was cleared, so a command that never exits stalled every rotation on the broker. chage and the passwd channel setup now close the connection when the context ends or the connector timeout passes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The watchdog stopped after PTY setup, so a target that never started passwd, or stopped reading, left Change blocked while the broker held its machine lock (security review of #14). Command start and each answer are now bounded by the context and the connector timeout, like the prompts already were. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
c8cb8aa to
4344e8b
Compare
passwd and chage output was buffered without a limit, so a compromised target could exhaust the broker's memory before the timeout (security review of #14). Both now stop at 64 KiB and close the connection; an overflow after the commit point stays an ambiguous outcome. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Security P2 (unbounded output) fixed in 4344e8b: passwd and chage output stops at 64 KiB and the connection is closed; an overflow after the commit point remains an ambiguous outcome. — rowan (Claude Opus 5.5) |
4344e8b to
c3e6a15
Compare
2a36617 to
6d14826
Compare
|
Note 🤖 Claude Opus 5.5 responding on behalf of Yoshiofthewire PR Reviewer Guide, "Ignored cancellation": fixed in c3e6a15. A |
c3e6a15 to
6c80b8d
Compare
04d1930 to
a82c72e
Compare
6c80b8d to
43d9686
Compare
…ec §4.4) The ssh_passwd connector dials only the descriptor's host and port and fails in the host-key callback, before any authentication, unless the SHA-256 of the wire-format host key is the one the descriptor pins. It authenticates with P_old (password or keyboard-interactive), runs LC_ALL=C passwd in a PTY, answers the current-password prompt, calls the broker's commit, then answers the new and retype prompts. A prompt outside the linux-pam set before the new password leaves, or a repeated new-password prompt after it, is a refusal; success needs "password updated successfully" and exit 0. Verification is a fresh login. Tests run against an OpenSSH container: wrong host key leaves no auth event in sshd's log, the new password never leaves before the commit (a recording login shell), minimum-age and rejected-password refusals, a full rotation and kills after ack_received and after the write. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A server offering both password and keyboard-interactive got a rejected password twice, and interactive rounds got it again, spending lockout attempts before the broker could quarantine (security review of #14). One shared submission now covers both methods and every round; a second request is an authentication failure. chage ran with no deadline once the handshake deadline was cleared, so a command that never exits stalled every rotation on the broker. chage and the passwd channel setup now close the connection when the context ends or the connector timeout passes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The watchdog stopped after PTY setup, so a target that never started passwd, or stopped reading, left Change blocked while the broker held its machine lock (security review of #14). Command start and each answer are now bounded by the context and the connector timeout, like the prompts already were. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
passwd and chage output was buffered without a limit, so a compromised target could exhaust the broker's memory before the timeout (security review of #14). Both now stop at 64 KiB and close the connection; an overflow after the commit point stays an ambiguous outcome. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Once TCP connected, ssh.NewClientConn ran under the connector timeout alone, so a cancellation during a stalled handshake or authentication left Login and Verify blocked for up to 30 seconds, delaying broker shutdown. A context.AfterFunc now closes the raw connection on cancellation and is removed when the handshake ends; a cancelled handshake returns the context's error (a host-key mismatch or a rejected credential still map as before). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
After passwd reports success, cancellation now closes the connection and returns at once as an ambiguous outcome instead of waiting for the connector timeout. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
a82c72e to
b10b467
Compare
43d9686 to
7c4dff4
Compare
|
Note 🤖 Claude Opus 5.5 responding on behalf of Yoshiofthewire Guide Cancellation ignored fixed in |
In one line: Brokers can now rotate Linux accounts over SSH (
passwdin a PTY), with the host key pinned before any authentication, proven against OpenSSH with linux-pampasswd.What changed
internal/connectors/sshpasswd: the host-key callback compares the hex SHA-256 of the wire-format key in constant time and fails before any authentication; password or keyboard-interactive login withP_old;LC_ALL=C passwdin a PTY (§4.4).commit→ answer new and retype. Before the commit, any prompt outside the linux-pam set is a refusal (target unchanged); after it, a repeated new-password prompt is a refusal and only "password updated successfully" + exit 0 is success; anything else is ambiguous.P_new. Minimum age and last change come fromchage -lwhen readable.kyguard-brokernow registers both connectors.chageand the passwd channel setup are bounded by the context and connector timeout.Review this
internal/connectors/sshpasswd/sshpasswd.gohostKeyandChange: the pre-auth host-key check and the commit point.Checked: against OpenSSH (Debian bookworm, linux-pam
passwd) in Docker on Major (kslot,-race), 10 tests: wrong host key → no auth event in sshd's log (and the same user with the right key does appear, so the check is live); nothing past the current password reaches the target before the commit (a recording login shell); minimum age and a rejected new password are refusals; unrecognized prompt refused without commit; full rotation; kills afterack_receivedand after the write. Full suite-race+ FIPS on SQLite (k81) and PostgreSQL (k80), exit 0. 6 mutations killed (Detail). Not checked: distributions other than Debian; non-English PAM stacks beyond forcingLC_ALL=C.Decided for you (
docs/DECISIONS.md50–51): the prompt set and success marker above; an unrecognized prompt is detected by timeout (30 s) rather than a heuristic; the SSH baseline is thechage -ldate or empty.You need to: nothing.
§13 checklist: Phase 1A "
ssh_passwdconnector"; acceptance 2, 3, 7 (SSH host key, no auth event), 9 (unrecognized prompt) on SSH. Stacked on #13.Detail
TestWrongHostKeyFailsBeforeAuthenticationTestNothingNewLeavesBeforeTheCommitTestUnrecognizedPromptIsRefusedTestLoginDeniedIsAuthFailedTestRejectedNewPasswordIsRefusedTestMinimumAgeIsRefusedBeforeTheNewPasswordTestRejectedCredentialIsSubmittedOnce(in-process server)TestPasswordAgeIsBoundedByTheTimeout(hangs)Review fixes (25 Nov, Guide "Ignored cancellation")
ssh.NewClientConnruns, acontext.AfterFunccloses the raw connection on cancellation; it is removed once the handshake ends. Host-key mismatch and a rejected credential still map toErrHostKeyandErrAuthFailed.TestHandshakeObservesCancellation(timed out after 5 s)Checked: OpenSSH suite
-raceunderksloton Major and at the #16 tip.Review fixes, round 2 (25 Nov: Guide "Cancellation ignored")
passwdprints success, the final wait for it to exit also watches the context: cancellation closes the connection and returns at once, as an ambiguous outcome (the write may have landed, so the broker probes), never a refusal.ctxTestChangeObservesCancellationAfterSuccess(test timed out)Round-2 checks (stack tip
ca19e6a): full suite-raceandGODEBUG=fips140=on, SQLite (k81, exit 0) and PostgreSQL 17 (k80, exit 0); Docker connector suites-raceon Major under kslot (26 tests, 0 skipped);go vetat every branch head,gofmt.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)
internal/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