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:
2.2 配置/etc/krb5.conf
Vi /etc/krb5.conf
[libdefaults]
renew_lifetime = d
forwardable = true
default_realm = NIFI.COM
ticket_lifetime = h
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 创建初始数据库
2.5 增加管理员用户
kadmin.local
addprinc admin/admin
q
vi /var/kerberos/krb5kdc/kadm5.acl –开放管理员用户权限
*/[email protected]
2.6 启动服务并设置开机自启
service krb5kdc start
service kadmin start
chkconfig krb5kdc on
chkconfig kadmin on
2.7 创建UI初始登陆用户
kadmin.local
addprinc nifi/[email protected]
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-.-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/[email protected]' -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
├── [email protected]
├── [email protected]
├── 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