Skip to content

feat(client): support gssapi-with-mic auth - #738

Merged
Eugeny merged 3 commits into
Eugeny:mainfrom
ayamir:gssapi-with-mic
Aug 11, 2026
Merged

feat(client): support gssapi-with-mic auth#738
Eugeny merged 3 commits into
Eugeny:mainfrom
ayamir:gssapi-with-mic

Conversation

@ayamir

@ayamir ayamir commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Add client-side support for the RFC 4462 gssapi-with-mic userauth method. This keeps russh responsible for the SSH protocol flow while leaving platform GSSAPI/Kerberos integration to callers through a new GssapiAuthenticator trait. Callers provide DER-encoded mechanism OIDs, consume server GSS tokens, and return continuation tokens or the final MIC.

Changes

  • Add MethodKind::GssapiWithMic / Method::GssapiWithMic
  • Add RFC 4462 GSSAPI userauth message constants:
    • USERAUTH_GSSAPI_RESPONSE = 60
    • USERAUTH_GSSAPI_TOKEN = 61
    • USERAUTH_GSSAPI_EXCHANGE_COMPLETE = 63
    • USERAUTH_GSSAPI_ERROR = 64
    • USERAUTH_GSSAPI_ERRTOK = 65
    • USERAUTH_GSSAPI_MIC = 66
  • Add GssapiAuthenticator and GssapiStep
  • Add Handle::authenticate_gssapi_with_mic
  • Handle server GSSAPI response/token/error/errtok packets in the client auth state machine
  • Encode client GSSAPI token, MIC, and exchange-complete packets
  • Add protocol-level tests for:
    • method parsing
    • userauth request encoding
    • MIC data construction
    • token/MIC packet ordering
    • exchange-complete packet ordering

Design Notes

This PR intentionally does not add a dependency on a system GSSAPI library.

Different callers may want to use platform GSS.framework, MIT Kerberos, Heimdal, SSPI, or a fake/test implementation. The trait boundary keeps that platform policy outside russh.

The intended layering is:

russh:
  SSH RFC 4462 protocol flow
  packet constants
  auth state machine
  token/MIC packet encoding
  `GssapiAuthenticator` trait boundary

caller:
  platform GSSAPI/Kerberos/SSPI implementation
  mechanism OID selection
  service principal policy
  credential/cache behavior

Verification

cargo fmt --check
cargo test -p russh gssapi
cargo check -p russh
cargo test -p russh

@Eugeny

Eugeny commented Aug 11, 2026

Copy link
Copy Markdown
Owner

Thank you! @all-contributors add @ayamir for code

@Eugeny
Eugeny merged commit cb79b19 into Eugeny:main Aug 11, 2026
11 checks passed
@allcontributors

Copy link
Copy Markdown
Contributor

@Eugeny

I've put up a pull request to add @ayamir! 🎉

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