在 NiFi 中启用 TLS

Enabling TLS in NiFi

  1. 我通过 运行 下面的命令在 NiFi 中启用了 TLS,

    nifi-toolkit/nifi-toolkit-assembly/target/nifi-toolkit-1.4.0-SNAPSHOT-bin/nifi-toolkit-1.4.0-SNAPSHOT/bin/tls-toolkit.sh standalone -n "{my-ip},localhost" -C 'CN={my-ip}' -C 'CN=localhost' -o ./certs

  2. 这在目录 certs 下创建了 TLS 所需的文件。

  3. 我把certs目录下的文件移到我机器的deployment的conf文件夹里

  4. 已将证书安装到我机器的 Keychain Access

  5. 现在使用 bin/nifi.sh start 启动服务器。我的服务器启动了,我可以访问服务器,但是我的请求没有被授权。

我收到以下错误,

Not authorized for the requested resource. Contact the system administrator.

在 Apache NiFi 中启用 TLS 后,默认情况下不再启用匿名访问。您将需要作为用户进行身份验证才能访问 UI/API。可以使用三种身份验证机制——客户端证书、LDAP 或 Kerberos。在 $NIFI_HOME/conf/authorizers.xml 中配置 Initial Admin Identity(这将是您在 TLS Toolkit 命令中颁发的客户端证书的确切 CN)后,该用户可以进行身份​​验证并使用NiFi 中的用户管理工具来添加额外的用户。

您可以在 NiFi Admin Guide. Bryan Bende has also written a detailed walkthrough of the process 中找到更多信息。

关于您在上面发布的命令的一个注释 -- 我不确定您想要的输出是什么,但该命令正在为 my-ip 和另一个为 hostname 颁发服务器证书,但是随后两个带有这些 DN 的客户端证书。通常,您需要一个用于 hostname 的服务器证书(可能带有一个用于 my-ip 的 SAN 条目)和一个具有类似 CN=alopresto, OU=Apache NiFi 的 DN 的客户端证书。

例如:

./bin/tls-toolkit.sh standalone 
  -n 'nifi.nifi.apache.org' 
  --subjectAlternativeNames '123.234.234.123' 
  -C 'CN=alopresto, OU=Apache NiFi' 
  -P password 
  -S password 
  -B password 
  -f ...conf/nifi.properties 
  -o ...conf/