Skip to content

Conversation

@dnwe
Copy link
Collaborator

@dnwe dnwe commented Sep 5, 2025

For some reason we were still pinning the old v0 SASL when using GSSAPI and this doesn't work if an ApiVersionsRequest is sent before the auth flow.
Add support for sending the krb5 bytes in the v1 SASL SaslAuthenticate protocol wrapping.

Note: this is just a draft for now as although it is tested and working against a GSSAPI enabled cluster, the underlying code is very much a copy-and-paste of the existing v0 auth flow, just wrappering the bytes in the SaslAuthenticate rather than sending them to the broker directly. This needs more work to tidyup the implementation

Copy link
Collaborator

@puellanivis puellanivis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understanding this is a draft. I mean, it all looks pretty good so far. I think all I commented on was style things. 😂

}

// AuthorizeV2 performs the SASL v2 GSSAPI authentication with the Kafka broker.
func (krbAuth *GSSAPIKerberosAuth) AuthorizeV2(broker *Broker, authSendReceiver func(authBytes []byte) (*SaslAuthenticateResponse, error)) error {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😬 I’m not sure how I feel about passing in a fairly arbitrary function here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah as you've probably seen, this is mimicking what the other b.sendAndReceiveSASLFoo funcs currently accept and use and was just the simplest way to get a V2 flow working

@dnwe dnwe mentioned this pull request Sep 16, 2025
For some reason we were still pinning the old v0 SASL when using GSSAPI
and this doesn't work if an ApiVersionsRequest is sent before the auth
flow.
Add support for sending the krb5 bytes in the v1 SASL SaslAuthenticate
protocol wrapping.

Signed-off-by: Dominic Evans <[email protected]>
Signed-off-by: Dominic Evans <[email protected]>
Use the simpler parameter name consistently. Also re-order params for initSecContext

Signed-off-by: Dominic Evans <[email protected]>
Also use consistent func doc comment format

Signed-off-by: Dominic Evans <[email protected]>
@dnwe dnwe marked this pull request as ready for review September 17, 2025 09:59
@dnwe dnwe changed the title feat: experimental SASLv1 support for Kerberos feat: add SASLv1 support for Kerberos Sep 17, 2025
@dnwe dnwe added the feat label Sep 17, 2025
@dnwe dnwe merged commit 603e8f8 into main Sep 18, 2025
17 checks passed
@dnwe dnwe deleted the dnwe/kerberos branch September 18, 2025 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants