Apache Nifi Web Server一直无法启动解密异常



我有一个设置,其中NiFi Web服务器在从1.15.3升级到1.16.1版本时突然开始启动失败。Apache NiFi集群上一直出现以下异常:

2022-05-11 22:53:40,570 WARN [main] org.apache.nifi.web.server.JettyServer Failed to start web server... shutting down.
org.apache.nifi.encrypt.EncryptionException: Decryption Failed with Algorithm [PBEWITHMD5AND256BITAES-CBC-OPENSSL]
at org.apache.nifi.encrypt.CipherPropertyEncryptor.decrypt(CipherPropertyEncryptor.java:78)
at org.apache.nifi.fingerprint.FingerprintFactory.decrypt(FingerprintFactory.java:931)
at org.apache.nifi.fingerprint.FingerprintFactory.getLoggableRepresentationOfSensitiveValue(FingerprintFactory.java:561)
at org.apache.nifi.fingerprint.FingerprintFactory.addParameter(FingerprintFactory.java:330)
at org.apache.nifi.fingerprint.FingerprintFactory.addParameterContext(FingerprintFactory.java:302)
at org.apache.nifi.fingerprint.FingerprintFactory.addFlowControllerFingerprint(FingerprintFactory.java:210)
at org.apache.nifi.fingerprint.FingerprintFactory.createFingerprint(FingerprintFactory.java:153)
at org.apache.nifi.fingerprint.FingerprintFactory.createFingerprint(FingerprintFactory.java:127)
at org.apache.nifi.controller.inheritance.FlowFingerprintCheck.checkInheritability(FlowFingerprintCheck.java:45)
at org.apache.nifi.controller.XmlFlowSynchronizer.sync(XmlFlowSynchronizer.java:200)
at org.apache.nifi.controller.serialization.StandardFlowSynchronizer.sync(StandardFlowSynchronizer.java:43)
at org.apache.nifi.controller.FlowController.synchronize(FlowController.java:1524)
at org.apache.nifi.persistence.StandardFlowConfigurationDAO.load(StandardFlowConfigurationDAO.java:104)
at org.apache.nifi.controller.StandardFlowService.loadFromBytes(StandardFlowService.java:815)
at org.apache.nifi.controller.StandardFlowService.load(StandardFlowService.java:457)
at org.apache.nifi.web.server.JettyServer.start(JettyServer.java:1086)
at org.apache.nifi.NiFi.<init>(NiFi.java:170)
at org.apache.nifi.NiFi.<init>(NiFi.java:82)
at org.apache.nifi.NiFi.main(NiFi.java:330)
Caused by: javax.crypto.BadPaddingException: pad block corrupted
at org.bouncycastle.jcajce.provider.symmetric.util.BaseBlockCipher$BufferedGenericBlockCipher.doFinal(Unknown Source)
at org.bouncycastle.jcajce.provider.symmetric.util.BaseBlockCipher.engineDoFinal(Unknown Source)
at javax.crypto.Cipher.doFinal(Cipher.java:2168)
at org.apache.nifi.encrypt.CipherPropertyEncryptor.decrypt(CipherPropertyEncryptor.java:74)
... 18 common frames omitted

相关nifi.properties:

nifi.sensitive.props.key=<hidden>
nifi.sensitive.props.key.protected=
nifi.sensitive.props.algorithm=PBEWITHMD5AND256BITAES-CBC-OPENSSL
nifi.sensitive.props.additional.keys=

我已经试图将其全部拆除并重新安装1.15.3而没有任何其他更改,但同样的问题仍然存在。有人可以分享任何想法,如果有任何关于如何解决这个问题?

注意:这是一个迟来的回复,但无论如何都要回答,因为其他人可能会从中受益。

新的NiFi版本无法解密来自旧版本的flow.xml.gz。

当为nifi.sensitive.props.key设置值时。属性,指定的密钥用于加密流中的敏感属性(例如组件中的密码字段)。i)如果需要更改密钥,Ii)或者你忘了道具钥匙iii)或遇到类似上述问题的新NiFi无法解密flow.xml.gz,那么NiFi工具包中的Encrypt-Config工具可以迁移敏感属性密钥并更新flow.xml.gz。

特别是Encrypt-Config:读取现有的flow.xml.gz,并使用当前密钥解密敏感值。

使用指定的新密钥加密所有敏感值。

更新nifi。属性和flow.xml.gz文件,或者创建它们的新版本。

所以要解决你的问题,我们将需要旧的flow.xml.gz, nifi。属性,bootstrap.conf和一个新密码(props key)来使用。

运行以下命令:

$ ./nifi-toolkit-1.10.0/bin/encrypt-config.sh -f /path/to/oldNiFi_Conf/flow.xml.gz -g /path/to/newNiFi_Conf/flow.xml.gz -s new_password -n /path/to/oldNiFi_Conf/nifi.properties -o /path/to/newNiFi_Conf/nifi.properties -b /path/to/oldNiFi_Conf/bootstrap.conf -x

然后将newNiFi_Conf/flow.xml.gz放到NiFi工作目录下,将NiFi. sensitive.props.key设置为命令中使用的new_password,重新启动NiFi。

请参阅加密配置工具的使用。

最新更新