[
https://issues.apache.org/jira/browse/NIFI-4708?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16313825#comment-16313825
]
ASF GitHub Bot commented on NIFI-4708:
--------------------------------------
Github user alopresto commented on a diff in the pull request:
https://github.com/apache/nifi/pull/2376#discussion_r159972582
--- Diff:
nifi-toolkit/nifi-toolkit-encrypt-config/src/main/groovy/org/apache/nifi/toolkit/encryptconfig/util/BootstrapUtil.groovy
---
@@ -0,0 +1,132 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.toolkit.encryptconfig.util
+
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+
+class BootstrapUtil {
+
+ static final String NIFI_BOOTSTRAP_KEY_PROPERTY =
"nifi.bootstrap.sensitive.key";
+ static final String REGISTRY_BOOTSTRAP_KEY_PROPERTY =
"nifi.registry.bootstrap.sensitive.key";
+
+ private static final Logger logger =
LoggerFactory.getLogger(BootstrapUtil.class)
+
+ private static final String BOOTSTRAP_KEY_COMMENT = "# Master key in
hexadecimal format for encrypted sensitive configuration values"
+
+ /**
+ * Tries to load keyHex from input bootstrap.conf
+ *
+ * @return keyHex, if present in input bootstrap file; otherwise, null
+ */
+ static String extractKeyFromBootstrapFile(String inputBootstrapPath,
String bootstrapKeyPropertyName) throws IOException {
+
+ File inputBootstrapConfFile
+ if (!(inputBootstrapPath && (inputBootstrapConfFile = new
File(inputBootstrapPath)).exists() && inputBootstrapConfFile.canRead())) {
--- End diff --
Not required for this PR, but in the future this is a good anti-pattern for
extracting the control logic to a boolean checker method like
`isInputBootstrapConfValid()`.
> Add support for NiFi Registry to the encrypt-config tool in NiFi Toolkit
> ------------------------------------------------------------------------
>
> Key: NIFI-4708
> URL: https://issues.apache.org/jira/browse/NIFI-4708
> Project: Apache NiFi
> Issue Type: Improvement
> Reporter: Kevin Doran
> Assignee: Kevin Doran
> Fix For: 1.5.0
>
>
> NiFi Registry now supports loading encrypted config files (e.g.,
> nifi-registry.properties, authorizers.xml, login-identity-providers.xml).
> These files are very difficult to encrypt by hand, and is not recommended.
> Because NiFi Registry utilizes the same encryption algorithms supported by
> NiFi, the easiest way to build a tool for encrypting NiFi Registry config
> properties is to extend the the encrypt-config tool in NiFi Toolkit to
> support NiFi Registry as well.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)