Skip to content

Latest commit

ย 

History

History
60 lines (39 loc) ยท 2.28 KB

SASL_PLAINTEXT_์ธ์ฆ.md

File metadata and controls

60 lines (39 loc) ยท 2.28 KB

Kafka SASL/PLAINTEXT ์ธ์ฆ

Kafka์—์„œ ํ—ˆ๊ฐ€๋˜์ง€ ์•Š์€ ์‚ฌ์šฉ์ž์˜ ์ ‘๊ทผ์„ ๋ง‰๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉํ•˜๋Š” ๋ฐฉ์‹ ์ค‘ JAAS ๊ธฐ๋ฐ˜์˜ SASL์„ ์‚ฌ์šฉ

New Consumer(Kafka Consumer)์—์„œ SASL์„ ์„ค์ •ํ•˜๋Š” ๋ฐฉ๋ฒ•์€ ๋‹ค์Œ๊ณผ ๊ฐ™๋‹ค.

Kafka Server

  • server_jaas.conf
KafkaServer {
	org.apache.kafka.common.security.plain.PlainLoginModule required
	username="admin"
	password="admin-secret"
	user_admin="admin-secret"
	user_sphong="sphong-secret";
};

-Djava.security.auth.login.config=/sever_jaas.conf/path/ ์„ ์ถ”๊ฐ€ํ•˜์—ฌ Kafka Server๋ฅผ ์‹คํ–‰ํ•œ๋‹ค.

  • server.conf

     listeners=SASL_SSL://host.name:port
     security.inter.broker.protocol=SASL_PLAINTEXT
     sasl.mechanism.inter.broker.protocol=PLAIN
     sasl.enabled.mechanisms=PLAIN
    

Kafka Client

  • consumer.properties

    security.protocol=SASL_PLAINTEXT
    sasl.mechanism=PLAIN
    sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required \
    username="sphong" \
    password="alice-secret";
    

Kafka Old Consumer vs New Consumer

Kafka Consumer๋Š” Old Consumer์™€ New Consumer๋กœ ๋‚˜๋ˆ„์–ด์ง„๋‹ค. ๋‘ ์ปจ์Šˆ๋จธ์˜ ์ฐจ์ด๋Š” offset ๊ด€๋ฆฌ๋ฅผ Kafka์—์„œ ํ•˜๋Š”์ง€, Zookeeper์—์„œ ํ•˜๋Š”์ง€์ด๋‹ค. Kafka 0.9 ๋ฒ„์ „๋ถ€ํ„ฐ ์„ฑ๋Šฅ์ƒ์˜ ์ด์Šˆ๋กœ Consumer์˜ Offset ์ €์žฅ์„ Kafka Topic _consumer_offsets์— ๋ณด๊ด€ํ•˜๋„๋ก ๋ณ€๊ฒฝ๋˜์—ˆ๋‹ค.

Graylog Issue

Graylog๋Š” Old / New Kafka Consumer๋ฅผ ์ง€์›ํ•˜๊ณ  ์žˆ์ง€๋งŒ, ๋‘ ๋ฒ„์ „์˜ Client ๋ชจ๋‘ 0.9 ๋ฒ„์ „์ด๋‹ค. SASL/PLAINTEXT ์ธ์ฆ ๋ฐฉ์‹์€ kafka 0.10 ๋ฒ„์ „๋ถ€ํ„ฐ ์ ์šฉ๋˜์—ˆ๊ธฐ ๋•Œ๋ฌธ์— ์œ„์˜ ์„ค์ •์„ ์ ์šฉํ•  ๊ฒฝ์šฐ, org.apache.kafka.common.security.plain.PlainLoginModule์„ ์ฐพ์„ ์ˆ˜ ์—†๋‹ค๋Š” ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•œ๋‹ค.

๋‹ค๋ฅธ ์‹œ๋„๋Š” Old Consumer๋ฅผ ์‚ฌ์šฉํ•˜๊ณ  Zookeeper์˜ SASL/PLAINTEXT ๋ฐฉ์‹์„ ์‚ฌ์šฉํ•˜๋Š” ๋ฐฉ๋ฒ•. ์ด๋Š” Zookeeper์˜ ์ธ์ฆ์€ ์ˆ˜ํ–‰ํ•˜์ง€๋งŒ Old Kafka Consumer๋ฅผ Graylog์—์„œ ์‚ฌ์šฉํ•˜๋Š” ๊ฒฝ์šฐ consumer.properties๋ฅผ override ํ•  ์ˆ˜ ์—†๊ธฐ ๋•Œ๋ฌธ์—, security.protocol์„ SASL_PLAINTEXT ๋ณ€๊ฒฝํ•˜์ง€ ๋ชปํ•˜๊ณ  Default ๊ฐ’์ธ PLAINTEXT๋ฅผ ์‚ฌ์šฉํ•˜๊ฒŒ ๋œ๋‹ค. ์ด์— ๋”ฐ๋ผ kafka.common.BrokerEndPointNotAvailableException: End point PLAINTEXT not found for broker 0 ๋ผ๋Š” ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•˜๊ฒŒ ๋œ๋‹ค.

์ฐธ๊ณ ์ž๋ฃŒ

https://kafka.apache.org/documentation/#security_sasl_plain