HDF/nifi 打开ssl和Kerberos

NIFI-HDF enable ssl and kerberos
1、环境
Hdfmaster (NIFI CA /kerberos) CentOS 7
hdfnode1 (NIFI )
hdfnode2 (NIFI )
hdfnode3 (NIFI )

关闭防火墙

vi /etc/selinux/config
     SELINUX=disabled  #修改内容为disabled
systemctl stop firewalld.service
systemctl disable firewalld.service
firewall-cmd --state  #查看防火墙状态(关闭显示not running,开启显示running)

2、安装kerberos server
2.1 安装Hdfmaster:

yum -y install krb5-server krb5-libs krb5-workstation krb5-auth-dialog

2.2 配置/etc/krb5.conf
Vi /etc/krb5.conf

[libdefaults]
  renew_lifetime = 7d
  forwardable = true
  default_realm = NIFI.COM
  ticket_lifetime = 24h
  dns_lookup_realm = false
  dns_lookup_kdc = false
  default_ccache_name = /tmp/krb5cc_%{uid}
  #default_tgs_enctypes = aes des3-cbc-sha1 rc4 des-cbc-md5
  #default_tkt_enctypes = aes des3-cbc-sha1 rc4 des-cbc-md5

[logging]
  default = FILE:/var/log/krb5kdc.log
  admin_server = FILE:/var/log/kadmind.log
  kdc = FILE:/var/log/krb5kdc.log

[realms]
  NIFI.COM = {
    admin_server = hdfmaster
    kdc = hdfmaster
  }

2.3 配置 /var/kerberos/krb5kdc/kdc.conf
vi /var/kerberos/krb5kdc/kdc.conf

[realms]
 NIFI.COM = {
  #master_key_type = aes256-cts
  acl_file = /var/kerberos/krb5kdc/kadm5.acl
  dict_file = /usr/share/dict/words
  admin_keytab = /var/kerberos/krb5kdc/kadm5.keytab
  supported_enctypes = aes256-cts:normal aes128-cts:normal des3-hmac-sha1:normal arcfour-hmac:normal camellia256-cts:normal camellia128-cts:normal des-hmac-sha1:normal des-cbc-md5:normal des-cbc-crc:normal
 }

2.4 创建初始数据库

kdb5_util create -r NIFI.COM -s

2.5 增加管理员用户

kadmin.local 
addprinc admin/admin
q

vi /var/kerberos/krb5kdc/kadm5.acl –开放管理员用户权限

*/admin@NIFI.COM 

2.6 启动服务并设置开机自启

service krb5kdc start
service kadmin start

chkconfig krb5kdc on
chkconfig kadmin on

2.7 创建UI初始登陆用户

kadmin.local 
addprinc nifi/admin@NIFI.COM

3、HDF ENABLE Kerberos
Admin->Kerberos
这里写图片描述
这里写图片描述
KDC hosts,Realm name填刚刚设置的:
这里写图片描述

等待自动完成配置以及其他节点的Kerberos Clients 安装。

在客户端测试:

Kinit nifi/admin

4、NIFI 打开 SSL
(参考:https://community.hortonworks.com/articles/58009/hdf-20-enable-ssl-for-apache-nifi-from-ambari.html)
Nifi->config->ssl
暂时不使用ranger
Initial admin 填上初始化进入UI的用户。(注意authorizations.xml必须没有策略,可以直接删掉authorizations.xml和users.xml文件)
这里写图片描述
这里写图片描述

5、生产ssl证书
下载JCE,安装JDC以及JCE
(http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html)

yum install java-1.8.0-openjdk
Unzip <JCE压缩包>
Cp *.jar [JRE_HOME]/lib/security/  --替换两个jar即可

下载nifi-toolkit
(http://nifi.apache.org/download.html)

Unzip nifi-toolkit-<version>-bin.zip
./tls-toolkit.sh standalone -n 'hdfnode1,hdfnode2,hdfnode3' -D 'nifi/admin@NIFI.COM' -c hdfmaster -f /usr/hdf/current/nifi/conf/nifi.properties -o'./target' -K hadoop -P hadoop -S hadoop

-n: nifi集群节点
-c: CA hosts
-f: nifi.properties文件,在此基础更改
-K -P -S 密码

生成文件结构:
target
├── nifi_admin@NIFI.COM.p12
├── nifi_admin@NIFI.COM.password
├── hdfnode1
│ ├── keystore.jks
│ ├── nifi.properties
│ └── truststore.jks
├── hdfnode2
│ ├── keystore.jks
│ ├── nifi.properties
│ └── truststore.jks
├── hdfnode3
│ ├── keystore.jks
│ ├── nifi.properties
│ └── truststore.jks
├── nifi-cert.pem
└── nifi-key.key

将节点文件下的文件scp到/conf/ 下覆盖。
将p12文件导入到浏览器,输入password文件中的密码。

5、初始化进入NIFI,设置admin用户
这里写图片描述
点击Users:
这里写图片描述
添加admin用户:名称和kerberos设置的用户名一致
这里写图片描述
给admin用户分配所有权限:
点击Polices,将admin都添加进去即可。
这里写图片描述

配置全局component权限:
这里写图片描述
退出,将证书从浏览器移除。用admin用户login即可配置其他用户。

EXCEPTION:
1.NiFi AuthorizerCreationException: Unable to locate initial admin to seed policies
Remove users.xml and authorizations.xml ,restart

参考:
https://blog.csdn.net/wjqwinn/article/details/76483040
https://community.hortonworks.com/articles/58009/hdf-20-enable-ssl-for-apache-nifi-from-ambari.html
https://community.hortonworks.com/articles/58793/hdf-20-use-ambari-to-enable-kerberos-for-hdf-clust.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值