Skip to content

ssh/tailssh: use a local error instead of gossh.ErrDenied - #10743

Merged
awly merged 1 commit into
mainfrom
awly/ssh-errdenied
Jan 5, 2024
Merged

awly merged 1 commit into
mainfrom
awly/ssh-errdenied

Conversation

@awly

@awly awly commented Jan 4, 2024

Copy link
Copy Markdown
Member

ErrDenied was added in our fork of
x/crypto/ssh
to short-circuit auth attempts once one fails.

In the case of our callbacks, this error is returned when SSH policy check determines that a connection should not be allowed. Both NoClientAuthCallback and PublicKeyHandler check the policy and will fail anyway. The fakePasswordHandler returns true only if NoClientAuthCallback succeeds the policy check, so it checks it indirectly too.

The difference here is that a client might attempt all 2-3 auth methods instead of just none but will fail to authenticate regardless.

Updates #8593

ErrDenied was added in [our fork of
x/crypto/ssh](golang/crypto@acc6f8f)
to short-circuit auth attempts once one fails.

In the case of our callbacks, this error is returned when SSH policy
check determines that a connection should not be allowed. Both
`NoClientAuthCallback` and `PublicKeyHandler` check the policy and will
fail anyway. The `fakePasswordHandler` returns true only if
`NoClientAuthCallback` succeeds the policy check, so it checks it
indirectly too.

The difference here is that a client might attempt all 2-3 auth methods
instead of just `none` but will fail to authenticate regardless.

Updates #8593

Signed-off-by: Andrew Lytvynov <[email protected]>
@awly
awly requested a review from rhealitycheck January 4, 2024 22:09
@awly
awly merged commit 29e98e1 into main Jan 5, 2024
@awly
awly deleted the awly/ssh-errdenied branch January 5, 2024 16:02
chen8945 pushed a commit to Ckid-Home/tailscale that referenced this pull request Jul 31, 2024
…10743)

ErrDenied was added in [our fork of
x/crypto/ssh](golang/crypto@acc6f8f)
to short-circuit auth attempts once one fails.

In the case of our callbacks, this error is returned when SSH policy
check determines that a connection should not be allowed. Both
`NoClientAuthCallback` and `PublicKeyHandler` check the policy and will
fail anyway. The `fakePasswordHandler` returns true only if
`NoClientAuthCallback` succeeds the policy check, so it checks it
indirectly too.

The difference here is that a client might attempt all 2-3 auth methods
instead of just `none` but will fail to authenticate regardless.

Updates tailscale#8593

Signed-off-by: Andrew Lytvynov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants