Kafka在CentOS上的安全配置主要包括以下方面:
server.properties
中设置security.protocol
为sasl_plaintext
或sasl_ssl
,指定security.inter.broker.protocol
和sasl.mechanism
(如PLAIN、SCRAM-SHA-256、Kerberos),并创建JAAS配置文件(如kafka_server_jaas.conf
)加载认证模块。security.protocol=ssl
,指定信任库(ssl.truststore.location
)和密钥库(ssl.keystore.location
)路径及密码,使用keytool
工具管理证书。kafka-acls.sh
工具设置用户/组对主题的访问权限,配置authorizer.class.name
为SimpleAclAuthorizer
。firewall-cmd
开放Kafka端口(默认9092),建议将Kafka部署在VPC或专用子网中。/etc/passwd
等关键文件权限。/etc/security/limits.conf
限制进程数和文件描述符,防止资源滥用。参考来源: