Skip to content

Commit

Permalink
NIFI-13414 Removed Property Protection Modules and Encrypt Config
Browse files Browse the repository at this point in the history
This closes #8978

- Removed nifi-property-protection-api and implementation modules
- Removed nifi-toolkit-encrypt-config and minifi-toolkit-encrypt-config modules
- Removed extra bootstrap.conf configuration files for property protection implementations

Signed-off-by: Joseph Witt <joewitt@apache.org>
  • Loading branch information
exceptionfactory authored and joewitt committed Jun 20, 2024
1 parent b7a48f7 commit 49a0401
Show file tree
Hide file tree
Showing 181 changed files with 77 additions and 11,967 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/docker-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ on:
- 'nifi-registry/nifi-registry-docker-maven/**'
- 'nifi-toolkit/nifi-toolkit-assembly/**'
- 'nifi-toolkit/nifi-toolkit-cli/**'
- 'nifi-toolkit/nifi-toolkit-encrypt-config/**'
- 'minifi/minifi-assembly/**'
- 'minifi/minifi-docker/**'
pull_request:
Expand All @@ -39,7 +38,6 @@ on:
- 'nifi-registry/nifi-registry-docker-maven/**'
- 'nifi-toolkit/nifi-toolkit-assembly/**'
- 'nifi-toolkit/nifi-toolkit-cli/**'
- 'nifi-toolkit/nifi-toolkit-encrypt-config/**'
- 'minifi/minifi-assembly/**'
- 'minifi/minifi-docker/**'

Expand Down Expand Up @@ -77,7 +75,6 @@ env:
-pl -nifi-registry/nifi-registry-assembly
-pl -nifi-toolkit/nifi-toolkit-assembly
-pl -nifi-toolkit/nifi-toolkit-cli
-pl -nifi-toolkit/nifi-toolkit-encrypt-config
-pl -minifi/minifi-assembly
MAVEN_DOCKER_ARGUMENTS: >-
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public BootstrapProperties getBootstrapProperties() {
}

public BootstrapProperties getProtectedBootstrapProperties() {
return BootstrapPropertiesLoader.loadProtectedProperties(bootstrapConfigFile).getApplicationProperties();
return BootstrapPropertiesLoader.loadProtectedProperties(bootstrapConfigFile);
}

public Properties getStatusProperties() {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,6 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.nifi</groupId>
<artifactId>nifi-property-protection-loader</artifactId>
</dependency>
<dependency>
<groupId>org.apache.nifi</groupId>
<artifactId>nifi-property-protection-cipher</artifactId>
</dependency>
<dependency>
<groupId>org.apache.nifi</groupId>
<artifactId>nifi-property-protection-api</artifactId>
<version>2.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.nifi</groupId>
<artifactId>nifi-properties</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,33 +17,15 @@

package org.apache.nifi.minifi.properties;

import static java.lang.String.format;
import static org.apache.nifi.minifi.commons.utils.SensitivePropertyUtils.MINIFI_BOOTSTRAP_SENSITIVE_KEY;
import static org.apache.nifi.minifi.commons.utils.SensitivePropertyUtils.getFormattedKey;

import java.io.File;
import org.apache.nifi.properties.AesGcmSensitivePropertyProvider;

public class BootstrapPropertiesLoader {

public static BootstrapProperties load(File file) {
ProtectedBootstrapProperties protectedProperties = loadProtectedProperties(file);
if (protectedProperties.hasProtectedKeys()) {
String sensitiveKey = protectedProperties.getApplicationProperties().getProperty(MINIFI_BOOTSTRAP_SENSITIVE_KEY);
validateSensitiveKeyProperty(sensitiveKey);
String keyHex = getFormattedKey(sensitiveKey);
protectedProperties.addSensitivePropertyProvider(new AesGcmSensitivePropertyProvider(keyHex));
}
return protectedProperties.getUnprotectedProperties();
}

public static ProtectedBootstrapProperties loadProtectedProperties(File file) {
return new ProtectedBootstrapProperties(PropertiesLoader.load(file, "Bootstrap"));
return loadProtectedProperties(file);
}

private static void validateSensitiveKeyProperty(String sensitiveKey) {
if (sensitiveKey == null || sensitiveKey.trim().isEmpty()) {
throw new IllegalArgumentException(format("bootstrap.conf contains protected properties but %s is not found", MINIFI_BOOTSTRAP_SENSITIVE_KEY));
}
public static BootstrapProperties loadProtectedProperties(File file) {
return new BootstrapProperties(PropertiesLoader.load(file, "Bootstrap"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
package org.apache.nifi.minifi.properties;

import java.io.File;
import org.apache.nifi.properties.AesGcmSensitivePropertyProvider;
import java.util.Properties;

import org.apache.nifi.util.NiFiBootstrapUtils;
import org.apache.nifi.util.NiFiProperties;

Expand All @@ -26,40 +27,17 @@ public class MiNiFiPropertiesLoader {
private static final String DEFAULT_APPLICATION_PROPERTIES_FILE_PATH = NiFiBootstrapUtils.getDefaultApplicationPropertiesFilePath();

private NiFiProperties instance;
private String keyHex;

public MiNiFiPropertiesLoader(String keyHex) {
this.keyHex = keyHex;
}

/**
* Returns a {@link ProtectedMiNiFiProperties} instance loaded from the
* serialized form in the file. Responsible for actually reading from disk
* and deserializing the properties. Returns a protected instance to allow
* for decryption operations.
*
* @param file the file containing serialized properties
* @return the ProtectedMiNiFiProperties instance
*/
ProtectedMiNiFiProperties loadProtectedProperties(File file) {
return new ProtectedMiNiFiProperties(PropertiesLoader.load(file, "Application"));
}

/**
* Returns an instance of {@link NiFiProperties} loaded from the provided
* {@link File}. If any properties are protected, will attempt to use the
* {@link AesGcmSensitivePropertyProvider} to unprotect them
* transparently.
* {@link File}.
*
* @param file the File containing the serialized properties
* @return the NiFiProperties instance
*/
public NiFiProperties load(File file) {
ProtectedMiNiFiProperties protectedProperties = loadProtectedProperties(file);
if (protectedProperties.hasProtectedKeys()) {
protectedProperties.addSensitivePropertyProvider(new AesGcmSensitivePropertyProvider(keyHex));
}
return new MultiSourceMinifiProperties(protectedProperties.getUnprotectedPropertiesAsMap());
final Properties properties = PropertiesLoader.load(file, "Application");
return new MultiSourceMinifiProperties(properties);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
package org.apache.nifi.minifi.properties;

import java.util.Map;
import java.util.Properties;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
Expand All @@ -29,7 +29,7 @@
*/
public class MultiSourceMinifiProperties extends NiFiProperties {

public MultiSourceMinifiProperties(Map<String, String> props) {
public MultiSourceMinifiProperties(Properties props) {
super(props);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

public interface PropertiesLoader {

static final Logger logger = LoggerFactory.getLogger(PropertiesLoader.class);
Logger logger = LoggerFactory.getLogger(PropertiesLoader.class);

static Properties load(File file, String propertiesType) {
if (file == null || !file.exists() || !file.canRead()) {
Expand Down

This file was deleted.

Loading

0 comments on commit 49a0401

Please sign in to comment.