Skip to content

Commit

Permalink
Add docs and changelog for elastic#12867 (elastic#23103)
Browse files Browse the repository at this point in the history
(cherry picked from commit 87ff5c0)
  • Loading branch information
jsoriano committed Dec 14, 2020
1 parent 76fb8ab commit cc27426
Show file tree
Hide file tree
Showing 17 changed files with 96 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Allow embedding of CAs, Certificate of private keys for anything that support TLS in ouputs and inputs https://github.com/elastic/beats/pull/21179
- API address is a required setting in `add_cloudfoundry_metadata`. {pull}21759[21759]
- Update to ECS 1.7.0. {pull}22571[22571]
- Add support for SCRAM-SHA-512 and SCRAM-SHA-256 in Kafka output. {pull}12867[12867]

*Auditbeat*

Expand Down
4 changes: 4 additions & 0 deletions auditbeat/auditbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,10 @@ output.elasticsearch:
#username: ''
#password: ''

# SASL authentication mechanism used. Can be one of PLAIN, SCRAM-SHA-256 or SCRAM-SHA-512.
# Defaults to PLAIN when `username` and `password` are configured.
#sasl.mechanism: ''

# Kafka version Auditbeat is assumed to run against. Defaults to the "1.0.0".
#version: '1.0.0'

Expand Down
4 changes: 4 additions & 0 deletions filebeat/filebeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1613,6 +1613,10 @@ output.elasticsearch:
#username: ''
#password: ''

# SASL authentication mechanism used. Can be one of PLAIN, SCRAM-SHA-256 or SCRAM-SHA-512.
# Defaults to PLAIN when `username` and `password` are configured.
#sasl.mechanism: ''

# Kafka version Filebeat is assumed to run against. Defaults to the "1.0.0".
#version: '1.0.0'

Expand Down
4 changes: 4 additions & 0 deletions heartbeat/heartbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -924,6 +924,10 @@ output.elasticsearch:
#username: ''
#password: ''

# SASL authentication mechanism used. Can be one of PLAIN, SCRAM-SHA-256 or SCRAM-SHA-512.
# Defaults to PLAIN when `username` and `password` are configured.
#sasl.mechanism: ''

# Kafka version Heartbeat is assumed to run against. Defaults to the "1.0.0".
#version: '1.0.0'

Expand Down
4 changes: 4 additions & 0 deletions journalbeat/journalbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,10 @@ output.elasticsearch:
#username: ''
#password: ''

# SASL authentication mechanism used. Can be one of PLAIN, SCRAM-SHA-256 or SCRAM-SHA-512.
# Defaults to PLAIN when `username` and `password` are configured.
#sasl.mechanism: ''

# Kafka version Journalbeat is assumed to run against. Defaults to the "1.0.0".
#version: '1.0.0'

Expand Down
4 changes: 4 additions & 0 deletions libbeat/_meta/config/output-kafka.reference.yml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
#username: ''
#password: ''

# SASL authentication mechanism used. Can be one of PLAIN, SCRAM-SHA-256 or SCRAM-SHA-512.
# Defaults to PLAIN when `username` and `password` are configured.
#sasl.mechanism: ''

# Kafka version {{.BeatName | title}} is assumed to run against. Defaults to the "1.0.0".
#version: '1.0.0'

Expand Down
12 changes: 7 additions & 5 deletions libbeat/outputs/kafka/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ type kafkaConfig struct {

type saslConfig struct {
SaslMechanism string `config:"mechanism"`
//SaslUsername string `config:"username"` //maybe use ssl.username ssl.password instead in future?
//SaslPassword string `config:"password"`
}

type metaConfig struct {
Expand Down Expand Up @@ -146,12 +144,16 @@ func (c *saslConfig) configureSarama(config *sarama.Config) error {
case saslTypePlaintext:
config.Net.SASL.Mechanism = sarama.SASLMechanism(sarama.SASLTypePlaintext)
case saslTypeSCRAMSHA256:
cfgwarn.Beta("SCRAM-SHA-256 authentication for Kafka is beta.")

config.Net.SASL.Handshake = true
config.Net.SASL.Mechanism = sarama.SASLMechanism(sarama.SASLTypeSCRAMSHA256)
config.Net.SASL.SCRAMClientGeneratorFunc = func() sarama.SCRAMClient {
return &XDGSCRAMClient{HashGeneratorFcn: SHA256}
}
case saslTypeSCRAMSHA512:
cfgwarn.Beta("SCRAM-SHA-512 authentication for Kafka is beta.")

config.Net.SASL.Handshake = true
config.Net.SASL.Mechanism = sarama.SASLMechanism(sarama.SASLTypeSCRAMSHA512)
config.Net.SASL.SCRAMClientGeneratorFunc = func() sarama.SCRAMClient {
Expand Down Expand Up @@ -225,7 +227,8 @@ func newSaramaConfig(log *logp.Logger, config *kafkaConfig) (*sarama.Config, err
k.Net.TLS.Config = tls.BuildModuleConfig("")
}

if config.Kerberos.IsEnabled() {
switch {
case config.Kerberos.IsEnabled():
cfgwarn.Beta("Kerberos authentication for Kafka is beta.")

k.Net.SASL.Enable = true
Expand All @@ -239,9 +242,8 @@ func newSaramaConfig(log *logp.Logger, config *kafkaConfig) (*sarama.Config, err
Password: config.Kerberos.Password,
Realm: config.Kerberos.Realm,
}
}

if config.Username != "" {
case config.Username != "":
k.Net.SASL.Enable = true
k.Net.SASL.User = config.Username
k.Net.SASL.Password = config.Password
Expand Down
34 changes: 32 additions & 2 deletions libbeat/outputs/kafka/docs/kafka.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
<titleabbrev>Kafka</titleabbrev>
++++

The Kafka output sends the events to Apache Kafka.
The Kafka output sends events to Apache Kafka.

To use this output, edit the {beatname_uc} configuration file to disable the {es}
output by commenting it out, and enable the Kafka output by uncommenting the
Kafka section.

Example configuration:

Expand Down Expand Up @@ -62,12 +66,29 @@ See <<kafka-compatibility>> for information on supported versions.
===== `username`

The username for connecting to Kafka. If username is configured, the password
must be configured as well. Only SASL/PLAIN is supported.
must be configured as well.

===== `password`

The password for connecting to Kafka.

===== `sasl.mechanism`

beta[]

The SASL mechanism to use when connecting to Kafka. It can be one of:

* `PLAIN` for SASL/PLAIN.
* `SCRAM-SHA-256` for SCRAM-SHA-256.
* `SCRAM-SHA-512` for SCRAM-SHA-512.

If `sasl.mechanism` is not set, `PLAIN` is used if `username` and `password`
are provided. Otherwise, SASL authentication is disabled.

To use `GSSAPI` mechanism to authenticate with Kerberos, you must leave this
field empty, and use the <<kerberos-option-kafka>> options.


[[topic-option-kafka]]
===== `topic`

Expand Down Expand Up @@ -277,3 +298,12 @@ Configuration options for SSL parameters like the root CA for Kafka connections.
`-keyalg RSA` argument to ensure it uses a cipher supported by
https://github.com/Shopify/sarama/wiki/Frequently-Asked-Questions#why-cant-sarama-connect-to-my-kafka-cluster-using-ssl[Filebeat's Kafka library].
See <<configuration-ssl>> for more information.

[[kerberos-option-kafka]]
===== `kerberos`

beta[]

Configuration options for Kerberos authentication.

See <<configuration-kerberos>> for more information.
4 changes: 4 additions & 0 deletions metricbeat/metricbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1523,6 +1523,10 @@ output.elasticsearch:
#username: ''
#password: ''

# SASL authentication mechanism used. Can be one of PLAIN, SCRAM-SHA-256 or SCRAM-SHA-512.
# Defaults to PLAIN when `username` and `password` are configured.
#sasl.mechanism: ''

# Kafka version Metricbeat is assumed to run against. Defaults to the "1.0.0".
#version: '1.0.0'

Expand Down
4 changes: 4 additions & 0 deletions packetbeat/packetbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1241,6 +1241,10 @@ output.elasticsearch:
#username: ''
#password: ''

# SASL authentication mechanism used. Can be one of PLAIN, SCRAM-SHA-256 or SCRAM-SHA-512.
# Defaults to PLAIN when `username` and `password` are configured.
#sasl.mechanism: ''

# Kafka version Packetbeat is assumed to run against. Defaults to the "1.0.0".
#version: '1.0.0'

Expand Down
4 changes: 4 additions & 0 deletions winlogbeat/winlogbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,10 @@ output.elasticsearch:
#username: ''
#password: ''

# SASL authentication mechanism used. Can be one of PLAIN, SCRAM-SHA-256 or SCRAM-SHA-512.
# Defaults to PLAIN when `username` and `password` are configured.
#sasl.mechanism: ''

# Kafka version Winlogbeat is assumed to run against. Defaults to the "1.0.0".
#version: '1.0.0'

Expand Down
4 changes: 4 additions & 0 deletions x-pack/auditbeat/auditbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -803,6 +803,10 @@ output.elasticsearch:
#username: ''
#password: ''

# SASL authentication mechanism used. Can be one of PLAIN, SCRAM-SHA-256 or SCRAM-SHA-512.
# Defaults to PLAIN when `username` and `password` are configured.
#sasl.mechanism: ''

# Kafka version Auditbeat is assumed to run against. Defaults to the "1.0.0".
#version: '1.0.0'

Expand Down
4 changes: 4 additions & 0 deletions x-pack/filebeat/filebeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3403,6 +3403,10 @@ output.elasticsearch:
#username: ''
#password: ''

# SASL authentication mechanism used. Can be one of PLAIN, SCRAM-SHA-256 or SCRAM-SHA-512.
# Defaults to PLAIN when `username` and `password` are configured.
#sasl.mechanism: ''

# Kafka version Filebeat is assumed to run against. Defaults to the "1.0.0".
#version: '1.0.0'

Expand Down
4 changes: 4 additions & 0 deletions x-pack/heartbeat/heartbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -924,6 +924,10 @@ output.elasticsearch:
#username: ''
#password: ''

# SASL authentication mechanism used. Can be one of PLAIN, SCRAM-SHA-256 or SCRAM-SHA-512.
# Defaults to PLAIN when `username` and `password` are configured.
#sasl.mechanism: ''

# Kafka version Heartbeat is assumed to run against. Defaults to the "1.0.0".
#version: '1.0.0'

Expand Down
4 changes: 4 additions & 0 deletions x-pack/metricbeat/metricbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2025,6 +2025,10 @@ output.elasticsearch:
#username: ''
#password: ''

# SASL authentication mechanism used. Can be one of PLAIN, SCRAM-SHA-256 or SCRAM-SHA-512.
# Defaults to PLAIN when `username` and `password` are configured.
#sasl.mechanism: ''

# Kafka version Metricbeat is assumed to run against. Defaults to the "1.0.0".
#version: '1.0.0'

Expand Down
4 changes: 4 additions & 0 deletions x-pack/packetbeat/packetbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1241,6 +1241,10 @@ output.elasticsearch:
#username: ''
#password: ''

# SASL authentication mechanism used. Can be one of PLAIN, SCRAM-SHA-256 or SCRAM-SHA-512.
# Defaults to PLAIN when `username` and `password` are configured.
#sasl.mechanism: ''

# Kafka version Packetbeat is assumed to run against. Defaults to the "1.0.0".
#version: '1.0.0'

Expand Down
4 changes: 4 additions & 0 deletions x-pack/winlogbeat/winlogbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,10 @@ output.elasticsearch:
#username: ''
#password: ''

# SASL authentication mechanism used. Can be one of PLAIN, SCRAM-SHA-256 or SCRAM-SHA-512.
# Defaults to PLAIN when `username` and `password` are configured.
#sasl.mechanism: ''

# Kafka version Winlogbeat is assumed to run against. Defaults to the "1.0.0".
#version: '1.0.0'

Expand Down

0 comments on commit cc27426

Please sign in to comment.