Skip to content

Commit

Permalink
address review notes
Browse files Browse the repository at this point in the history
  • Loading branch information
kvch committed Apr 28, 2020
1 parent ed7df99 commit 8ad7086
Show file tree
Hide file tree
Showing 17 changed files with 131 additions and 11 deletions.
9 changes: 9 additions & 0 deletions auditbeat/auditbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,9 @@ output.elasticsearch:
# The pin is a base64 encoded string of the SHA-256 fingerprint.
#ssl.ca_sha256: ""

# Enable Kerberos support. Kerberos is automatically enabled if any Kerberos setting is set.
#kerberos.enabled: true

# Authentication type to use with Kerberos. Available options: keytab, password.
#kerberos.auth_type: password

Expand Down Expand Up @@ -812,6 +815,9 @@ output.elasticsearch:
# never, once, and freely. Default is never.
#ssl.renegotiation: never

# Enable Kerberos support. Kerberos is automatically enabled if any Kerberos setting is set.
#kerberos.enabled: true

# Authentication type to use with Kerberos. Available options: keytab, password.
#kerberos.auth_type: password

Expand Down Expand Up @@ -1398,6 +1404,9 @@ logging.files:
# never, once, and freely. Default is never.
#ssl.renegotiation: never

# Enable Kerberos support. Kerberos is automatically enabled if any Kerberos setting is set.
#kerberos.enabled: true

# Authentication type to use with Kerberos. Available options: keytab, password.
#kerberos.auth_type: password

Expand Down
9 changes: 9 additions & 0 deletions filebeat/filebeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1232,6 +1232,9 @@ output.elasticsearch:
# The pin is a base64 encoded string of the SHA-256 fingerprint.
#ssl.ca_sha256: ""

# Enable Kerberos support. Kerberos is automatically enabled if any Kerberos setting is set.
#kerberos.enabled: true

# Authentication type to use with Kerberos. Available options: keytab, password.
#kerberos.auth_type: password

Expand Down Expand Up @@ -1518,6 +1521,9 @@ output.elasticsearch:
# never, once, and freely. Default is never.
#ssl.renegotiation: never

# Enable Kerberos support. Kerberos is automatically enabled if any Kerberos setting is set.
#kerberos.enabled: true

# Authentication type to use with Kerberos. Available options: keytab, password.
#kerberos.auth_type: password

Expand Down Expand Up @@ -2104,6 +2110,9 @@ logging.files:
# never, once, and freely. Default is never.
#ssl.renegotiation: never

# Enable Kerberos support. Kerberos is automatically enabled if any Kerberos setting is set.
#kerberos.enabled: true

# Authentication type to use with Kerberos. Available options: keytab, password.
#kerberos.auth_type: password

Expand Down
2 changes: 1 addition & 1 deletion filebeat/input/kafka/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ func newSaramaConfig(config kafkaInputConfig) (*sarama.Config, error) {
k.Net.TLS.Config = tls.BuildModuleConfig("")
}

if config.Kerberos != nil {
if config.Kerberos.IsEnabled() {
cfgwarn.Beta("Kerberos authentication for Kafka is beta.")

k.Net.SASL.Enable = true
Expand Down
9 changes: 9 additions & 0 deletions heartbeat/heartbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,9 @@ output.elasticsearch:
# The pin is a base64 encoded string of the SHA-256 fingerprint.
#ssl.ca_sha256: ""

# Enable Kerberos support. Kerberos is automatically enabled if any Kerberos setting is set.
#kerberos.enabled: true

# Authentication type to use with Kerberos. Available options: keytab, password.
#kerberos.auth_type: password

Expand Down Expand Up @@ -963,6 +966,9 @@ output.elasticsearch:
# never, once, and freely. Default is never.
#ssl.renegotiation: never

# Enable Kerberos support. Kerberos is automatically enabled if any Kerberos setting is set.
#kerberos.enabled: true

# Authentication type to use with Kerberos. Available options: keytab, password.
#kerberos.auth_type: password

Expand Down Expand Up @@ -1549,6 +1555,9 @@ logging.files:
# never, once, and freely. Default is never.
#ssl.renegotiation: never

# Enable Kerberos support. Kerberos is automatically enabled if any Kerberos setting is set.
#kerberos.enabled: true

# Authentication type to use with Kerberos. Available options: keytab, password.
#kerberos.auth_type: password

Expand Down
9 changes: 9 additions & 0 deletions journalbeat/journalbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,9 @@ output.elasticsearch:
# The pin is a base64 encoded string of the SHA-256 fingerprint.
#ssl.ca_sha256: ""

# Enable Kerberos support. Kerberos is automatically enabled if any Kerberos setting is set.
#kerberos.enabled: true

# Authentication type to use with Kerberos. Available options: keytab, password.
#kerberos.auth_type: password

Expand Down Expand Up @@ -750,6 +753,9 @@ output.elasticsearch:
# never, once, and freely. Default is never.
#ssl.renegotiation: never

# Enable Kerberos support. Kerberos is automatically enabled if any Kerberos setting is set.
#kerberos.enabled: true

# Authentication type to use with Kerberos. Available options: keytab, password.
#kerberos.auth_type: password

Expand Down Expand Up @@ -1336,6 +1342,9 @@ logging.files:
# never, once, and freely. Default is never.
#ssl.renegotiation: never

# Enable Kerberos support. Kerberos is automatically enabled if any Kerberos setting is set.
#kerberos.enabled: true

# Authentication type to use with Kerberos. Available options: keytab, password.
#kerberos.auth_type: password

Expand Down
9 changes: 9 additions & 0 deletions libbeat/_meta/config.reference.yml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,9 @@ output.elasticsearch:
# The pin is a base64 encoded string of the SHA-256 fingerprint.
#ssl.ca_sha256: ""

# Enable Kerberos support. Kerberos is automatically enabled if any Kerberos setting is set.
#kerberos.enabled: true

# Authentication type to use with Kerberos. Available options: keytab, password.
#kerberos.auth_type: password

Expand Down Expand Up @@ -693,6 +696,9 @@ output.elasticsearch:
# never, once, and freely. Default is never.
#ssl.renegotiation: never

# Enable Kerberos support. Kerberos is automatically enabled if any Kerberos setting is set.
#kerberos.enabled: true

# Authentication type to use with Kerberos. Available options: keytab, password.
#kerberos.auth_type: password

Expand Down Expand Up @@ -1279,6 +1285,9 @@ logging.files:
# never, once, and freely. Default is never.
#ssl.renegotiation: never

# Enable Kerberos support. Kerberos is automatically enabled if any Kerberos setting is set.
#kerberos.enabled: true

# Authentication type to use with Kerberos. Available options: keytab, password.
#kerberos.auth_type: password

Expand Down
22 changes: 14 additions & 8 deletions libbeat/common/transport/kerberos/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,24 @@ import (
type AuthType uint

const (
AUTH_PASSWORD = 1
AUTH_KEYTAB = 2
authPassword = 1
authKeytab = 2

authPassword = "password"
authKeytabStr = "keytab"
authPasswordStr = "password"
authKeytabStr = "keytab"
)

var (
InvalidAuthType = errors.New("invalid authentication type")

authTypes = map[string]AuthType{
authPassword: AUTH_PASSWORD,
authKeytabStr: AUTH_KEYTAB,
authPasswordStr: authPassword,
authKeytabStr: authKeytab,
}
)

type Config struct {
Enabled *bool `config:"enabled" yaml:"enabled,omitempty"`
AuthType AuthType `config:"auth_type" validate:"required"`
KeyTabPath string `config:"keytab"`
ConfigPath string `config:"config_path"`
Expand All @@ -51,6 +52,11 @@ type Config struct {
Realm string `config:"realm"`
}

// IsEnabled returns true if the `enable` field is set to true in the yaml.
func (c *Config) IsEnabled() bool {
return c != nil && (c.Enabled == nil || *c.Enabled)
}

// Unpack validates and unpack "auth_type" config option
func (t *AuthType) Unpack(value string) error {
authT, ok := authTypes[value]
Expand All @@ -65,15 +71,15 @@ func (t *AuthType) Unpack(value string) error {

func (c *Config) Validate() error {
switch c.AuthType {
case AUTH_PASSWORD:
case authPassword:
if c.Username == "" {
return fmt.Errorf("password authentication is selected for Kerberos, but username is not configured")
}
if c.Password == "" {
return fmt.Errorf("password authentication is selected for Kerberos, but password is not configured")
}

case AUTH_KEYTAB:
case authKeytab:
if c.KeyTabPath == "" {
return fmt.Errorf("keytab authentication is selected for Kerberos, but path to keytab is not configured")
}
Expand Down
2 changes: 1 addition & 1 deletion libbeat/esleg/eslegclient/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func NewConnection(s ConnectionSettings) (*Connection, error) {
Timeout: s.Timeout,
}

if s.Kerberos != nil {
if s.Kerberos.IsEnabled() {
c := &http.Client{
Transport: &http.Transport{
Dial: dialer.Dial,
Expand Down
2 changes: 1 addition & 1 deletion libbeat/outputs/kafka/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ func newSaramaConfig(log *logp.Logger, config *kafkaConfig) (*sarama.Config, err
k.Net.TLS.Config = tls.BuildModuleConfig("")
}

if config.Kerberos != nil {
if config.Kerberos.IsEnabled() {
cfgwarn.Beta("Kerberos authentication for Kafka is beta.")

k.Net.SASL.Enable = true
Expand Down
9 changes: 9 additions & 0 deletions metricbeat/metricbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1279,6 +1279,9 @@ output.elasticsearch:
# The pin is a base64 encoded string of the SHA-256 fingerprint.
#ssl.ca_sha256: ""

# Enable Kerberos support. Kerberos is automatically enabled if any Kerberos setting is set.
#kerberos.enabled: true

# Authentication type to use with Kerberos. Available options: keytab, password.
#kerberos.auth_type: password

Expand Down Expand Up @@ -1565,6 +1568,9 @@ output.elasticsearch:
# never, once, and freely. Default is never.
#ssl.renegotiation: never

# Enable Kerberos support. Kerberos is automatically enabled if any Kerberos setting is set.
#kerberos.enabled: true

# Authentication type to use with Kerberos. Available options: keytab, password.
#kerberos.auth_type: password

Expand Down Expand Up @@ -2151,6 +2157,9 @@ logging.files:
# never, once, and freely. Default is never.
#ssl.renegotiation: never

# Enable Kerberos support. Kerberos is automatically enabled if any Kerberos setting is set.
#kerberos.enabled: true

# Authentication type to use with Kerberos. Available options: keytab, password.
#kerberos.auth_type: password

Expand Down
9 changes: 9 additions & 0 deletions packetbeat/packetbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -953,6 +953,9 @@ output.elasticsearch:
# The pin is a base64 encoded string of the SHA-256 fingerprint.
#ssl.ca_sha256: ""

# Enable Kerberos support. Kerberos is automatically enabled if any Kerberos setting is set.
#kerberos.enabled: true

# Authentication type to use with Kerberos. Available options: keytab, password.
#kerberos.auth_type: password

Expand Down Expand Up @@ -1239,6 +1242,9 @@ output.elasticsearch:
# never, once, and freely. Default is never.
#ssl.renegotiation: never

# Enable Kerberos support. Kerberos is automatically enabled if any Kerberos setting is set.
#kerberos.enabled: true

# Authentication type to use with Kerberos. Available options: keytab, password.
#kerberos.auth_type: password

Expand Down Expand Up @@ -1825,6 +1831,9 @@ logging.files:
# never, once, and freely. Default is never.
#ssl.renegotiation: never

# Enable Kerberos support. Kerberos is automatically enabled if any Kerberos setting is set.
#kerberos.enabled: true

# Authentication type to use with Kerberos. Available options: keytab, password.
#kerberos.auth_type: password

Expand Down
9 changes: 9 additions & 0 deletions winlogbeat/winlogbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,9 @@ output.elasticsearch:
# The pin is a base64 encoded string of the SHA-256 fingerprint.
#ssl.ca_sha256: ""

# Enable Kerberos support. Kerberos is automatically enabled if any Kerberos setting is set.
#kerberos.enabled: true

# Authentication type to use with Kerberos. Available options: keytab, password.
#kerberos.auth_type: password

Expand Down Expand Up @@ -735,6 +738,9 @@ output.elasticsearch:
# never, once, and freely. Default is never.
#ssl.renegotiation: never

# Enable Kerberos support. Kerberos is automatically enabled if any Kerberos setting is set.
#kerberos.enabled: true

# Authentication type to use with Kerberos. Available options: keytab, password.
#kerberos.auth_type: password

Expand Down Expand Up @@ -1321,6 +1327,9 @@ logging.files:
# never, once, and freely. Default is never.
#ssl.renegotiation: never

# Enable Kerberos support. Kerberos is automatically enabled if any Kerberos setting is set.
#kerberos.enabled: true

# Authentication type to use with Kerberos. Available options: keytab, password.
#kerberos.auth_type: password

Expand Down
9 changes: 9 additions & 0 deletions x-pack/auditbeat/auditbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,9 @@ output.elasticsearch:
# The pin is a base64 encoded string of the SHA-256 fingerprint.
#ssl.ca_sha256: ""

# Enable Kerberos support. Kerberos is automatically enabled if any Kerberos setting is set.
#kerberos.enabled: true

# Authentication type to use with Kerberos. Available options: keytab, password.
#kerberos.auth_type: password

Expand Down Expand Up @@ -868,6 +871,9 @@ output.elasticsearch:
# never, once, and freely. Default is never.
#ssl.renegotiation: never

# Enable Kerberos support. Kerberos is automatically enabled if any Kerberos setting is set.
#kerberos.enabled: true

# Authentication type to use with Kerberos. Available options: keytab, password.
#kerberos.auth_type: password

Expand Down Expand Up @@ -1454,6 +1460,9 @@ logging.files:
# never, once, and freely. Default is never.
#ssl.renegotiation: never

# Enable Kerberos support. Kerberos is automatically enabled if any Kerberos setting is set.
#kerberos.enabled: true

# Authentication type to use with Kerberos. Available options: keytab, password.
#kerberos.auth_type: password

Expand Down
9 changes: 9 additions & 0 deletions x-pack/filebeat/filebeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1970,6 +1970,9 @@ output.elasticsearch:
# The pin is a base64 encoded string of the SHA-256 fingerprint.
#ssl.ca_sha256: ""

# Enable Kerberos support. Kerberos is automatically enabled if any Kerberos setting is set.
#kerberos.enabled: true

# Authentication type to use with Kerberos. Available options: keytab, password.
#kerberos.auth_type: password

Expand Down Expand Up @@ -2256,6 +2259,9 @@ output.elasticsearch:
# never, once, and freely. Default is never.
#ssl.renegotiation: never

# Enable Kerberos support. Kerberos is automatically enabled if any Kerberos setting is set.
#kerberos.enabled: true

# Authentication type to use with Kerberos. Available options: keytab, password.
#kerberos.auth_type: password

Expand Down Expand Up @@ -2842,6 +2848,9 @@ logging.files:
# never, once, and freely. Default is never.
#ssl.renegotiation: never

# Enable Kerberos support. Kerberos is automatically enabled if any Kerberos setting is set.
#kerberos.enabled: true

# Authentication type to use with Kerberos. Available options: keytab, password.
#kerberos.auth_type: password

Expand Down
Loading

0 comments on commit 8ad7086

Please sign in to comment.