Step by Step Recipe for Securing Kafka with Kerberos
Short Description:
Step by Step Recipe for Securing Kafka with Kerberos.
Article
I found it is a little tricky to get started with a Kerberos enabled Kafka cluster. I created this step by step recipe for securing Kafka with Kerberos, sending and receiving data on console. This is tested on HDP2.5.0 and Ambari 2.4.1.
- Enabled Kerberos using the Ambari Kerberos setup wizard under Admin -- Kerberos menu.
- On Ambari Kafka Config UI, change "listeners" property to "PLAINTEXTSASL://localhost:6667".
- Restart Kafka as requested by Ambari.
- Create a test topic in Kafka. Must use the kafka service user to do this.
$ cd /usr/hdp/current/kafka-broker/bin
$ sudo su kafka
$ kinit -k -t /etc/security/keytabs/kafka.service.keytab kafka/ip----.ap-northeast-.compute.internal $ ./kafka-topics.sh --zookeeper ip----.ap-northeast-.compute.internal: --create --topic foo --partitions --replication-factor Created topic "bar".
- Grant permission to user. This can be done using Kafka native ACL mechanism or Apache Ranger. In the example, we use Kafka ACL. User bob needs to be existing in KDC.
# Grant user bob as producer on topic foo
./kafka-acls.sh --authorizer-properties zookeeper.connect=ip----.ap-northeast-.compute.internal: \
--add --allow-principal User:bob \
--producer --topic foo Adding ACLs for resource `Topic:foo`:
User:bob has Allow permission for operations: Describe from hosts: *
User:bob has Allow permission for operations: Write from hosts: * Adding ACLs for resource `Cluster:kafka-cluster`:
User:bob has Allow permission for operations: Create from hosts: * Current ACLs for resource `Topic:foo`:
User:bob has Allow permission for operations: Describe from hosts: *
User:bob has Allow permission for operations: Write from hosts: * # Grant user bob as consumer
./kafka-acls.sh --authorizer-properties zookeeper.connect=ip----.ap-northeast-.compute.internal: \
--add --allow-principal User:bob \
--consumer --topic foo --group * #--group后等跟等号,如--group=*。按照上面写法,只是赋给名称为connect-distributed.sh的groupid。因为kafka/bin下面第一个脚本是connect-distributed.shAdding ACLs for resource `Topic:foo`:
User:bob has Allow permission for operations: Read from hosts: *
User:bob has Allow permission for operations: Describe from hosts: * Adding ACLs for resource `Group:connect-distributed.sh`:
User:bob has Allow permission for operations: Read from hosts: * Current ACLs for resource `Topic:foo`:
User:bob has Allow permission for operations: Read from hosts: *
User:bob has Allow permission for operations: Describe from hosts: *
User:bob has Allow permission for operations: Write from hosts: * Current ACLs for resource `Group:connect-distributed.sh`:
User:bob has Allow permission for operations: Read from hosts: *
- Confirm the above works using the kafka console producer and consumer scripts.
# Switch to bob user and log in to KDC.
$ kinit bob # Start console producer
$ ./kafka-console-producer.sh --broker-list ip----.ap-northeast-.compute.internal: --topic foo --security-protocol PLAINTEXTSASL # On another terminal, start console consumer
./kafka-console-consumer.sh --zookeeper ip----.ap-northeast-.compute.internal: --topic foo --security-protocol PLAINTEXTSASL {metadata.broker.list=ip----.ap-northeast-.compute.internal:, request.timeout.ms=, client.id=console-consumer-, security.protocol=PLAINTEXTSASL} # Type something on the producer terminal, it should appears on the console terminal immediately.
Step by Step Recipe for Securing Kafka with Kerberos的更多相关文章
- Problem of Creating Topics in Kafka with Kerberos
Hi, After enabled Kerberos using Ambari, I got problem creating topics in Kafka using the kafka-topi ...
- Step by step Dynamics CRM 2011升级到Dynamics CRM 2013
原创地址:http://www.cnblogs.com/jfzhu/p/4018153.html 转载请注明出处 (一)检查Customizations 从2011升级到2013有一些legacy f ...
- Step by Step 创建一个新的Dynamics CRM Organization
原创地址:http://www.cnblogs.com/jfzhu/p/4012833.html 转载请注明出处 前面演示过如何安装Dynamics CRM 2013,参见<Step by st ...
- Step by step Install a Local Report Server and Remote Report Server Database
原创地址:http://www.cnblogs.com/jfzhu/p/4012097.html 转载请注明出处 前面的文章<Step by step SQL Server 2012的安装 &g ...
- Step by step Dynamics CRM 2013安装
原创地址:http://www.cnblogs.com/jfzhu/p/4008391.html 转载请注明出处 SQL Server可以与CRM装在同一台计算机上,也可安装在不同的计算机上.演示 ...
- Step by step 活动目录中添加一个子域
原创地址:http://www.cnblogs.com/jfzhu/p/4006545.html 转载请注明出处 前面介绍过如何创建一个域,下面再介绍一下如何在该父域中添加一个子域. 活动目录中的森林 ...
- SQL Server 维护计划实现数据库备份(Step by Step)(转)
SQL Server 维护计划实现数据库备份(Step by Step) 一.前言 SQL Server 备份和还原全攻略,里面包括了通过SSMS操作还原各种备份文件的图形指导,SQL Server ...
- 转:eclipse以及step into step over step return的区别
首先来讲一下step into step over step return的区别: step into就是单步执行,遇到子函数就进入并且继续单步执行:(F5) step over是在单步执行时,在函数 ...
- [转]Bootstrap 3.0.0 with ASP.NET Web Forms – Step by Step – Without NuGet Package
本文转自:http://www.mytecbits.com/microsoft/dot-net/bootstrap-3-0-0-with-asp-net-web-forms In my earlier ...
随机推荐
- PostgreSql 使用dblink跨库
此篇介绍下psql下dblink的使用方式,帮助自己记录以备后需.dblink是psql下的扩展功能,可以实现在一个数据库中远程操作另外一个数据库,是实现跨库的一种方法.下面步入正文. 安装dblin ...
- The operation could not be performed because OLE DB provider "SQLNCLI11" for linked server "SDSSDFCC" was unable to begin a distributed transaction.
Question: SQL SERVER 通过Linkserver连接A和B 2台,A对B执行单条的增删改查没有异常(没有配置DTC) 但是开启事务后就会出现报错 Solution: 在A和B上配置D ...
- window系统下如何查看so库的信息
转载请标明出处,维权必究:https://www.cnblogs.com/tangZH/p/10458388.html linux系统下能够直接用命令行查看so库的信息,但是window系统下咋办好 ...
- Windows下docker的安装以及遇到的问题
最近因为业务的需要,需要在本地搭建服务环境测试,不想去安装各种软件,于是就想到了用docker来满足我的需要.由于第一次在Windows下安装(以前一直是在linux下使用,但由于内存等硬件的限制 ...
- eShopOnContainers 知多少[2]:Run起来
环境准备 Win10(开启Hyper-V) .NET Core SDK Docker for Windows VS2017 or VS Code Git SQL Server Management S ...
- 使用 whistle 替代本地 nginx/webpack 服务
加入鹅厂之后,我发现团队都在用一款叫做 Whistle 的工具,起初我以为这只是一款类似 Fiddler/Charles 的普通货色.然鹅,发现下面这两种用法之后,我把自己的膝盖摘下来献给了制作这款工 ...
- java常用工具(jps等)说明
Java为我们提供了大量的工具辅助我们进行开发,位于jdk目录下的bin目录里,本篇博客将会随时更新相关工具的使用说明. jps 获取当前运行的java应用 lgj@lgj-Lenovo-G470:~ ...
- 使用Swiper轮播插件引起的探索
提到Swiper轮播插件,小伙伴们应该不会感到陌生.以前我主要在移动端上使用,PC端使用较少. 注:这里需要注意的是,在PC端和移动端使用Swiper是不同的 官方给的版本有三个,分别是Swiper2 ...
- 【Android Studio安装部署系列】二十八、Android Studio查看其它APP的布局结构
概述 日常使用别家的APP过程中,会遇到一些比较好看的布局,这时候我们就想学习一下别人的布局结构,以便参考. (1)手机连接电脑.设置手机为USB调试模式 参考<[Android Studio安 ...
- BitmapUtil【缩放bitmap以及将bitmap保存成图片到SD卡中】
版权声明:本文为HaiyuKing原创文章,转载请注明出处! 前言 用于缩放bitmap以及将bitmap保存成图片到SD卡中 效果图 代码分析 bitmapZoomByHeight(Bitmap s ...