Skip to content

Commit

Permalink
feat: Allow SASL handshake version to be influenced from config
Browse files Browse the repository at this point in the history
why: current kaf uses the older SASL handshake v0, where the SASL payload
is sent unframed down the wire.  v1 uses the dedicated SASL Kafka RPCs.  This
feature allows the user to opt for the v1.  The default remains as v0.
  • Loading branch information
k-wall committed Dec 13, 2023
1 parent 977f0fa commit 99a05b1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions cmd/kaf/kaf.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ func getConfig() (saramaConfig *sarama.Config) {
saramaConfig.Net.SASL.User = cluster.SASL.Username
saramaConfig.Net.SASL.Password = cluster.SASL.Password
}
saramaConfig.Net.SASL.Version = cluster.SASL.Version
}
if cluster.TLS != nil && cluster.SecurityProtocol != "SASL_SSL" {
saramaConfig.Net.TLS.Enable = true
Expand Down
9 changes: 9 additions & 0 deletions examples/sasl_v1_handshake.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
clusters:
- name: test
brokers:
- localhost:9092
SASL:
mechanism: PLAIN
username: admin
password: mypasswordisnotsosimple
version: 1
1 change: 1 addition & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ type SASL struct {
ClientSecret string `yaml:"clientSecret"`
TokenURL string `yaml:"tokenURL"`
Token string `yaml:"token"`
Version int16 `yaml:"version"`
}

type TLS struct {
Expand Down

0 comments on commit 99a05b1

Please sign in to comment.