Table of Contents |
---|
Specify the property nifi.flow.configuration.encrypt=true
, in the properties file, to have the new flow configuration written to the disk encrypted after a flow update (originating from a C2 server). It requires that you have a conf/bootstrap.conf
in your minifi home, containing an encryption key (nifi.bootstrap.sensitive.key
). This "master key" is also used on agent startup to decrypt the flow configuration file.
Manual encryption
MiNiFi comes with a tool called MiNiFi comes with a tool which can encrypt sensitive properties in the minifi.properties
file. It is called encrypt-config
(encrypt-config.exe
on Windows) , and it is which can be found in the bin
directory of the installation, next to the main minifi
binary. It enables the encryption of sensitive properties in the minifi.properties
file along with the encryption of the flow configuration (config.yml
by default).
The goal of the tool is to prevent accidental exposure of passwords etc; it will not stop a determined attacker.security of the encryption depends on the security of the bootstrap.conf
file, storing the encryption key.
Vocabulary
- minifi home: the directory as specified to
encrypt-config
by the--minifi-home
option - properties file: the file
<minifi home>/conf/minifi.properties
- flow configuration: the file specified in the properties file with the key
nifi.flow.configuration.file
, or if not specified it defaults to<minifi home>/conf/config.yml
- bootstrap file: the file
<minifi home>/conf/bootstrap.conf
- sensitive property: all property in the properties file that we wish to encrypt
Basic usage
If you have a minifi.properties
file in your MiNiFi configuration directory /var/tmp/minifi-home/conf
containing the following sensitive properties:
...
You should protect the bootstrap.conf
file to make sure it is only readable by the user which will run MiNiFi.
Additional sensitive properties
By default, encrypt-config
will encrypt a (short) list of default sensitive properties. If you want more properties to be encrypted, you can add a nifi.sensitive.props.additional.keys
setting with a comma-separated list of additional sensitive properties to your minifi.properties
file like this:
...
before running the encrypt-config
tool. The tool will then encrypt these additional properties, as well. You can also do this after you have already encrypted some properties; the tool will encrypt the additional properties using the existing encryption key, and it will leave the other, already encrypted, sensitive properties alone.
Modifying sensitive properties
If you later need to modify the value of a sensitive property which was encrypted earlier, you need to:
...
The tool will then encrypt the modified property using the existing encryption key in bootstrap.conf
, and it will leave the other, already encrypted, sensitive properties alone.
...
.
Encrypting the flow configuration
For manual encryption pass the flag --encrypt-flow-config
to encrypt-config
so that it also encrypts the flow configuration file, not just the sensitive properties.
Updating the encryption key
If you want to generate a new change the encryption key, you need to:
- Remove the If the files are already encrypted, there should be a "
nifi.bootstrap.sensitive.key=..."
line from in thebootstrap.conf
(if it does not contain anything else, you can delete the file)Replace all sensitive property values i.e. have access to the original key), otherwise you have to manually replace all encrypted data (sensitive properties and flow configuration) with their original, unencrypted , values Delete all the "something.protected=...
" lines(or some other new value) - If present, rename the "
nifi.bootstrap.sensitive.key=..."
property inbootstrap.conf
to"nifi.bootstrap.sensitive.key.old=..."
(i.e. add ".old" suffix to the property name) - If you have a specific encryption key you would like to use, add it to the
bootstrap.conf
, (add the line "nifi.bootstrap.sensitive.key=<your encryption key here>"
). If you provide no encryption key (nonifi.bootstrap.sensitive.key
property inbootstrap.conf
, or nobootstrap.conf
at all), a new key will be randomly generated and written tobootstrap.conf.
- Re-run the
encrypt-config
tool.
Take special care when changing the encryption key and the flow configuration is encrypted, so that you also re-encrypt it before deleting the old key (you will get a warning if you do not request its re-encryption).
...
Code Block | ||
---|---|---|
| ||
$ cat /var/tmp/minifi-home/conf/bootstrap.conf nifi.bootstrap.sensitive.key.old=0728061a041edb09445ae4dbd95f11bd255bb0b467b8efb239e665aea5ace46b nifi.bootstrap.sensitive.key=46af2c11a3f24c8c875ab4bee65e18a75f825fc3a4e03abdc8ce49d405b0b730 $ ./bin/encrypt-config --minifi-home /var/tmp/minifi-home Old encryption key found in conf/bootstrap.conf Using the existing encryption key found in conf/bootstrap.conf Property "nifi.security.client.pass.phrase" is already properly encrypted. Could not find any (new) sensitive properties to encrypt in conf/minifi.properties WARNING: you did not request the flow config to be updated, if it is currently encrypted and the old key is removed, you won't be able to recover the flow config. |