Class FileBasedClusterNodeFirewall
java.lang.Object
org.apache.nifi.cluster.firewall.impl.FileBasedClusterNodeFirewall
- All Implemented Interfaces:
ClusterNodeFirewall
A file-based implementation of the ClusterFirewall interface. The class is configured with a file. If the file is empty, then everything is permissible. Otherwise, the file should contain hostnames
or IPs formatted as dotted decimals with an optional CIDR suffix. Each entry must be separated by a newline. An example configuration is given below:
# hash character is a comment delimiter
1.2.3.4 # exact IP
some.host.name # a host name
4.5.6.7/8 # range of CIDR IPs
9.10.11.12/13 # a smaller range of CIDR IPs
This class allows for synchronization with an optionally configured restore directory. If configured, then at startup, if the either the config file or the restore directory's copy is missing, then
the configuration file will be copied to the appropriate location. If both restore directory contains a copy that is different in content to configuration file, then an exception is thrown at
construction time.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final File
private static final org.slf4j.Logger
private final File
private final Collection
<org.apache.commons.net.util.SubnetUtils.SubnetInfo> -
Constructor Summary
ConstructorsConstructorDescriptionFileBasedClusterNodeFirewall
(File config) FileBasedClusterNodeFirewall
(File config, File restoreDirectory) -
Method Summary
Modifier and TypeMethodDescriptionboolean
isPermissible
(String hostOrIp) Returns true if the given host or IP is permissible through the firewall; false otherwise.private void
parseConfig
(File config) private void
-
Field Details
-
config
-
restoreDirectory
-
subnetInfos
-
logger
private static final org.slf4j.Logger logger
-
-
Constructor Details
-
FileBasedClusterNodeFirewall
- Throws:
IOException
-
FileBasedClusterNodeFirewall
- Throws:
IOException
-
-
Method Details
-
isPermissible
Description copied from interface:ClusterNodeFirewall
Returns true if the given host or IP is permissible through the firewall; false otherwise. If an IP is given, then it must be formatted in dotted decimal notation.- Specified by:
isPermissible
in interfaceClusterNodeFirewall
- Parameters:
hostOrIp
- host- Returns:
- true if permissible
-
syncWithRestoreDirectory
- Throws:
IOException
-
parseConfig
- Throws:
IOException
-