feat: add SASL/GSSAPI auth for kafka clusters - #3
Conversation
|
Good job, will review it carefully when I got time after work. |
|
A general comment on the plaintext principle. This project's rule is "passwords never in config files; Keychain only" (see Overall, the PR is solid. Good job. |
|
Thanks for the thoughtful note — agreed this deserves an explicit decision. Decision: keep principal + keytab/krb5 paths in clusters.json. Rationale, aligned with the existing v1.0.0 rule: • Secrets stay out of config — same as today: only SASL passwords (PLAIN/SCRAM) go to I don’t think moving the principal to Keychain adds meaningful security (it’s not I’ll add doc comments on the Kerberos fields clarifying they are non-secret |
Summary
This PR adds SASL/GSSAPI (Kerberos) as a cluster authentication option in Swifka, alongside the existing PLAIN and SCRAM mechanisms.
Kerberos-protected clusters can be configured with:
kafka)client@REALM)KRB5_CONFIGforkinit/ GSSAPI)Works with both SASL_PLAINTEXT and SASL_SSL (via the existing Use TLS toggle).
Motivation
I work at a large company where virtually all internal Kafka clusters are protected with Kerberos (GSSAPI over SASL). Keytab-based authentication and a custom
krb5.conf(with realm/KDC settings) are the standard way to connect from developer tooling.Swifka already covers PLAIN/SCRAM well, but there was no path to connect to Kerberos-enabled environments without falling back to Java clients or CLI tools. I use Swifka daily for read-only monitoring and wanted the same workflow for our production-like and staging clusters.
This change is based on a setup that already works in our internal Rust Kafka explorer (keytab +
krb5.conf+SASL_PLAINTEXT).What changed
Core
ClusterConfigfields:saslKerberosPrincipal,saslKerberosServiceName,saslKerberosKeytabPath,saslKerberosKrb5ConfPathKafkaService: sharedapplySaslConfig();KerberosEnvironmentsetsKRB5_CONFIGbefore connect / test / browseUI
.fileImportermodifiers)Other
.gitignore: ignore Xcodebuild/derived data directoryScreenshots
Cluster form — GSSAPI settings
![GSSAPI cluster configuration]

Successful connection test
![Connection test success]

Connected cluster (topics / dashboard)
![Connected to Kerberos cluster]

Test plan
Notes for reviewers
krb5.confis optional in the model but required in many enterprise setups where/etc/krb5.confdoes not define the corporate realm/KDC. Swifka setsKRB5_CONFIGto the user-provided path before librdkafka runskinit.Bootstrap host should be a DNS name, not an IP — Kerberos service principals are hostname-based (
kafka/broker.example.com@REALM).No
client.dns.lookup=resolve_canonical_bootstrap_servers_only— that setting caused librdkafka to authenticate against IP-based principals (kafka/10.x.x.x@…), which failed against our KDC. Default DNS lookup works with our clusters.Backward compatible: existing cluster JSON without Kerberos fields decodes normally; new fields are optional.
Example configuration
kafkab01.example.corp.cloud9093kafkamy_client@CORP.REALM/path/to/client.keytab/path/to/krb5.conf