【问题标题】:fluentd/kafka : SASL authentication requires that SSL is configuredfluentd/kafka :SASL 身份验证需要配置 SSL
【发布时间】:2019-04-30 09:11:52
【问题描述】:

我打算将日志发送到我们合作的弹性搜索集群。

我正在使用 td-agent 将日志转发到连接到协作弹性搜索集群的 Kafka 端点。我已经使用 td-agent 安装了 fluent-plugin-kafka 插件,以将日志发送到连接到协作弹性搜索集群的 Kafka 端点

插件网址:https://github.com/fluent/fluent-plugin-kafka

日志发送路径如下:

logs --> td-agent+fluent-plugin-kafka --> kafka cluster --> elasticsearch --> kibana

问题是,Kafka 端点被配置为支持 SASL AUTHENTICATION 而不支持 SSL,由于日志仅通过协作网络路由,我想不需要 SSL 支持。

我收到以下错误:

  2019-04-30 17:46:39 +0900 [error]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluentd-1.3.3/bin/fluentd:8:in `<top (required)>'
  2019-04-30 17:46:39 +0900 [error]: #0 /opt/td-agent/embedded/bin/fluentd:23:in `load'
  2019-04-30 17:46:39 +0900 [error]: #0 /opt/td-agent/embedded/bin/fluentd:23:in `<main>'
2019-04-30 17:46:39 +0900 [error]: #0 unexpected error error_class=ArgumentError error="SASL authentication requires that SSL is configured"
  2019-04-30 17:46:39 +0900 [error]: #0 suppressed same stacktrace
2019-04-30 17:46:39 +0900 [info]: Worker 0 finished unexpectedly with status 1
^C

我的 td-agent 配置是:

#
<source>
  @type dummy
  dummy {"hello":"world"}
  tag test
</source>

<match test>
  @type kafka2
  brokers               stg-ageapdsk101.stg.hnd2.bdd.local:9002,stg-ageapdsk102.stg.hnd2.bdd.local:9002,stg-ageapdsk103.stg.hnd2.bdd.local:9002
  principal             'appuser@STGKAFKA100.GEAP.XXX.COM'
  keytab                'appuser.keytab'
  client_id             'kafka'
  sasl_over_ssl         false
  get_kafka_client_log  true
  <format>
    @type json
  </format>
  topic_key             'stg_esd_app_elk_1'
  get_kafka_client_log  true

  <buffer topic>
    flush_interval 10s
  </buffer>
</match>

请帮我解决这个问题。

【问题讨论】:

    标签: security networking apache-kafka fluentd sasl


    【解决方案1】:

    在 Cloudera 6.3 的环境中,使用 Kerberos 身份验证(GSSAPI),fluentd v1.9.2 插件 fluent-plugin-kafkav0.13.0,out_kafka2 不起作用。作为同一插件中的替代模块,我尝试了 rdkafka2,它现在可以工作了。

    详情;

    principal 和 keytab 与 kafka2 相同

    rdkafka2 特有的参数 service_name 'kafka'

    您可以查看the code,因为它填充了 GSSAPI、SASL_PAINTEXT 场景的所有必要参数。

    if @principal
    sasl = true
    config[:"sasl.mechanisms"] = "GSSAPI"
    config[:"sasl.kerberos.principal"] = @principal
    config[:"sasl.kerberos.service.name"] = @service_name if @service_name
    config[:"sasl.kerberos.keytab"] = @keytab if @keytab
    end
    
      if ssl && sasl
        security_protocol = "SASL_SSL"
      elsif ssl && !sasl
        security_protocol = "SSL"
      elsif !ssl && sasl
        security_protocol = "SASL_PLAINTEXT"
      else
        security_protocol = "PLAINTEXT"
      end
      config[:"security.protocol"] = security_protocol
    

    添加到这里,别忘了添加环境变量-Djava.security.auth.login.config=/home/user/jaas.conf 有关 jaas conf 的详细信息,请参阅link

    【讨论】:

      【解决方案2】:

      使用没有值的 ssl_ca_cert 而不是 sasl_over_ssl false
      例如
      client_id '卡夫卡'
      ssl_ca_cert
      keytab 'appuser.keytab

      谢谢

      【讨论】:

        猜你喜欢
        • 2017-09-14
        • 2021-01-19
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-10-31
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多