Managing the NiFi sensitive properties key

Set, match and rotate nifi.sensitive.props.key so passwords and sensitive values in your Apache NiFi flows stay readable across every node and recoverable after a change.

On this page

What the NiFi sensitive properties key protects and when you must manage it

The nifi.sensitive.props.key setting in nifi.properties is the key NiFi uses to encrypt sensitive values it stores, such as passwords and tokens entered on processors, controller services and other components. A production NiFi that holds these values depends on this key every time it reads or writes them. If the key is missing, or if a node starts with a value that differs from the rest of the cluster, that node cannot load the shared flow in the same form as its peers, and the deployment stalls until the values match. Treat the key as a deployment prerequisite that must be in place before any sensitive value is saved.

You must set and manage the key on every NiFi instance that stores sensitive values, which in practice means every production instance that uses secured components. Set it at first install, before anyone builds a flow that contains credentials, and keep one identical value on every cluster node, including nodes added later. Store the value in your secrets manager and inject it into nifi.properties during deployment, so it never appears in a flow export, a ticket or a shared file. Confirm in the administration guide where your install method expects the setting to be read from, so the value your automation writes is the one NiFi actually uses.

Two decisions need an owner before go-live. The first is recovery: encrypted values cannot be read without the key that wrote them, so the key must be backed up under the same controls as other production secrets, with a record of which environment it belongs to. The second is portability: check the NiFi administration guide for how the key affects exported flow definitions and parameter values before you move flows between environments that use different keys, because an export that carries encrypted values may not load elsewhere. The rotation procedure and repository encryption are covered separately, so plan for both now.

Key configuration choices and when each fits

This table compares three ways to set nifi.sensitive.props.key and the recovery and exposure risks each carries. Read each row against your own change process and secrets tooling, and note that every cluster node must end up with the same value.

ChoiceHow it worksTrade-offWhen it fits
Strong key set before first startGenerate a long random value and write it into nifi.properties before the first start, so every encrypted property is created with itSimple and auditable, but the value sits in a file on disk, so anyone who reads that file can decrypt stored sensitive valuesSingle-node or small test deployments where the file is tightly permissioned and backed up with the rest of the configuration
Externally managed value injected at startupThe key is held in a secrets manager and passed to NiFi through the environment or a startup script, so it is not stored in the configuration fileLower exposure at rest, but a missing or changed secret at startup can stop the node from reading its encrypted valuesProduction clusters that already run a secrets manager and can test startup failure and recovery before go-live
Key kept apart from flow definitionsThe key is stored separately from the flow.json.gz file and the exported flow definitions, with different access rightsExported flows and backups carry less risk, but the team must keep the key and the encrypted values together for restoresTeams that share flow definitions across environments or store them in version control
Matching key on every cluster nodeEach node uses the identical value so encrypted properties in the shared flow decrypt on every nodeA node with a different value cannot read sensitive properties, which can block it from joining the cluster correctlyAny clustered deployment, which should be verified on each node after changes

How to set the key on a new NiFi installation

This sequence sets nifi.sensitive.props.key before any sensitive value is written, so every node can read and write encrypted configuration from the first start. It ends with a test flow that proves stored secrets survive a restart.

  1. Choose the key source and owner

    Decide where the key value will come from before anyone types it into a file. Your security or platform team typically chooses between a secrets manager, a sealed configuration file managed by configuration tooling, or a value entered by an administrator during the build. Record who owns the key, where the backup copy lives and who may read it. Confirm with your own policy team that the chosen source meets your secret handling rules. The step is complete when the owner, storage location and access list are written down and approved.

  2. Generate a strong key value

    Generate the value with a cryptographically secure random generator rather than a passphrase typed from memory. Use a length and character set that your organization's key standard accepts, and check the format the administration guide expects for this property. Store the generated value only in the approved source chosen in the previous step. The output is a single key value held in the approved store, with no copy in shell history, tickets, chat or version control.

  3. Set the property in nifi.properties

    Set nifi.sensitive.props.key in nifi.properties, or supply it through your approved injection method such as an environment variable mapping or an init step that writes the file at deploy time. Confirm the exact property location and value format in the NiFi System Administrator's Guide before you edit anything. Keep file permissions restricted to the NiFi service account. The step is done when the file or injected value is in place and a check of the running configuration shows the property set, without printing the value to logs.

  4. Confirm identical values on every node

    Before the first cluster start, compare the key on every node using a method that does not reveal the value, such as a keyed hash or checksum computed on each host. Every node must hold the same key, because nodes must decrypt the same flow definition and parameter values. Repeat the comparison after any configuration management run. The step is complete when all node checksums match and the check is recorded in your change record.

  5. Start the cluster and check for errors

    Start the nodes and watch the application logs for messages about sensitive property decryption, invalid keys or flow loading failures. Confirm the cluster forms and every node reports connected in the UI. If a node reports a decryption error, stop it and compare its key against the others before retrying. The step is done when all nodes are connected and the logs show no sensitive-property errors during startup.

  6. Create a test flow with sensitive values

    Build a small test process group with one processor that uses a sensitive property, such as a password field, and a parameter context marked sensitive with a dummy value. Save the flow so the sensitive values are written to the flow definition. Use an illustrative test value that is not a real credential. The step is done when the processor shows the sensitive field as set and the parameter is marked sensitive in the UI.

  7. Verify values after a restart

    Restart each node, then open the test flow and confirm the sensitive field still shows as set and the processor runs against the dummy value, for example by checking its output or a controlled test record. Repeat the restart on one node alone to confirm it decrypts the flow after rejoining. Record the results. The step is complete when every node resolves the sensitive values after restart, which confirms the key is set correctly and consistent.

  8. Document the key and its recovery path

    Record the key location, owner, rotation procedure reference and the backup recovery steps in your runbook. Note that losing the key means encrypted sensitive values can no longer be read, so confirm your backup process with your operations team and test restoring the key to a scratch node if your policy requires it. Ask your DeployOpen or internal team to confirm how exported flow definitions handle sensitive values in your version. The step is done when the runbook entry is approved and the recovery test is logged.

Why every cluster node needs the same key

Every node in a NiFi cluster must hold the same `nifi.sensitive.props.key` value. Sensitive properties in nifi.properties, along with sensitive parameter values and component properties stored in the flow, are encrypted with that key. When a node starts with a different key, it cannot decrypt values written by its peers, so it may fail to load the flow or drop out of the cluster. The exact behavior differs by version and by which values are affected, so confirm how your NiFi release reports a key mismatch during startup and when a node joins, and test that failure on a non-production cluster before you rely on it.

Keep the value consistent through the same configuration management path you use for the rest of nifi.properties. Store the key in a secrets manager, inject it into each node at deployment time, and avoid editing it by hand on individual hosts. Treat a change to the key as a coordinated event rather than a routine config push, because nodes that restart at different times can briefly disagree. Ask your team or partner to document which tool writes the file, who approves changes, and how the key reaches containers or Kubernetes pods if you run NiFi there.

Detect drift before a node joins, not after it fails. Compare a fingerprint of the key on each node against the expected value during provisioning and as part of routine health checks, without printing the key itself into logs or tickets. Make the check part of the change pipeline so a host with a stale or hand-edited value is flagged before it receives traffic. Confirm with your NiFi version's administration guide how cluster nodes report encryption errors, so your alerting catches the failure signature you will actually see.

How to rotate the key with the nifi.sh command

The rotation sequence re-encrypts every sensitive property in the flow definition and configuration with a new nifi.sh key, so the cluster keeps running with its flows, controller services and parameter values intact. Each step ends with a check that tells you whether the next step is safe to start.

  1. Back up configuration and flow files

    Before changing anything, copy the conf directory, the properties files and the current flow configuration file from every node to storage outside the NiFi installation. Keep the existing nifi.sensitive.props.key value in the backup, because the old key is the only way to decrypt the flow if the rotation has to be reversed. The step is complete when you can list the backup, open the copied properties file, and confirm the old key is recorded in your secrets store with a restricted access list.

  2. Rehearse rotation in a non-production environment

    Restore the backup into a non-production NiFi built from the same version, then run the full rotation there before touching production. Confirm that the cluster starts, that controller services and sensitive processor properties still work, and that parameter values with sensitive flags resolve correctly. Record the exact commands and any errors so the production runbook reflects what you observed. The rehearsal is done when a restarted test node shows no decryption errors in its logs.

  3. Confirm exact command syntax for your version

    Open the Apache NiFi System Administrator's Guide for the exact version in production and take the nifi.sh subcommand, its arguments and the expected prompts from that page. Do not rely on examples from blog posts or older releases, because option names and the handling of the old and new key can change between versions. The step is complete when your runbook quotes the command from the guide with the version number written beside it.

  4. Stop or coordinate the nodes

    Agree the maintenance window with the people who own the flows, then stop the NiFi processes on every node, or follow the coordinated procedure in the administration guide for your topology. Do not run the re-encryption against a node that is still serving flows, because the on-disk configuration must be consistent across all nodes. The step is complete when the process list on each node shows no running NiFi JVM and the cluster view is no longer needed.

  5. Run the re-encryption with nifi.sh

    On each node, run the re-encryption subcommand of nifi.sh with the old and new key values as the guide specifies, and keep the output in your change record. The command rewrites the protected values in the configuration and flow files, so run it only once per node and only against the matching backup set. The step is complete when the command reports success for each node and the flow configuration file has been updated.

  6. Set the same new key on all nodes

    Update nifi.sensitive.props.key in the properties file on every node with the identical new value, then check the file hashes or the stored value against your secrets record. Nodes with different keys will fail to load the shared flow, so verify the value before any node starts. The step is complete when every node reports the same key fingerprint in your records and no node still holds the old value.

  7. Start nodes and check the flow

    Start the nodes one at a time, wait for each to join the cluster, then open the UI and review the flow. Check that controller services are enabled, that processors with sensitive properties start without errors, and that a sample of parameter values with the sensitive flag resolve. The step is complete when the bulletin board shows no decryption or key errors and the cluster reports all nodes connected.

  8. Verify exported definitions and close the change

    Export a process group or flow definition and confirm how sensitive values appear in it, using the behavior described in the administration guide for your version, and compare that against the expectation you recorded during rehearsal. Store the new key in your secrets manager, retire the old key according to your retention policy, and file the change record with the command output and checks. The change is closed when the flow runs normally, the backup set is catalogued, and the new key is the only active key.

What changes for exported flow definitions and parameter values

The sensitive properties key does not only protect the running node. It also shapes what leaves the node in exported flow definitions, parameter contexts and version-controlled flows. The cards below cover the effects teams most often discover late, and the checks to run before a key change or an environment move.

Exported definitions can carry key-dependent values

Sensitive property values in a flow definition are stored encrypted with the key in effect on the node that wrote them. A copied flow definition therefore may not be readable on a node whose key differs. Treat the export as tied to a specific key until you have tested it. Confirm in your own environment whether the export you produce carries encrypted values or placeholders for them.

Sensitive parameters need the matching key

Parameter values marked as sensitive are encrypted with the key and only resolve on a node that holds the same key. If a node starts with a different key, processors that reference those parameters can fail validation or stop with errors about unreadable values. Before any rotation or restore, list the parameter contexts that hold sensitive values so you know what depends on the key.

Environment moves need the key or re-entry

Moving a flow from test to production with a different key means one of two paths: carry the matching key to the target nodes through a controlled channel, or re-enter each secret on the target after import. The second path avoids sharing key material but adds a manual step to every deployment. Decide which path your change process will use before the first move, and record it.

Keep secrets out of version control

A flow committed to Git should not contain secret values in plain form, and sensitive values should not be committed in encrypted form either, since that ties the repository to a key. Store references to secrets instead, and resolve them at deployment from a secret store or from parameter values supplied per environment. Review each commit for values that a registry client would version.

Test export and import first

Before you rely on any export or registry workflow, run a full cycle in a non-production environment: export the flow, import it to a node with a different key, and confirm which components and parameters need re-entry. Record the results and the steps taken. Repeat the test after each NiFi upgrade, since release behavior can change. Confirm the exact export format with the NiFi administration guide for your version.

Plan for missing or wrong keys

A node that starts with a missing or incorrect key may not be able to decrypt existing configuration, which can block startup or leave components invalid. Keep the active key in a controlled secret store with an access log, and keep a tested recovery procedure that names who may restore it. Ask your NiFi team to show exactly how the node reports a key mismatch in your version, so operators recognize it quickly.

Questions teams ask before changing the NiFi sensitive key

What does rotating the NiFi sensitive properties key cost in effort?

Rotation is mostly planning, testing and coordinated execution rather than a single command. The effort is driven by how many sensitive values your flows and controller services hold, how many nodes your cluster has, how many flow definitions and parameter contexts you export, and how many teams depend on those components. Your costs are one-time for the rotation itself and recurring only if your policy requires periodic rotation. Ask any partner to price the inventory of protected values, the test plan, the change window and the rollback steps as separate line items in a written scope.

How long does a sensitive key rotation take?

Duration depends on the size of the cluster, the number of sensitive properties in flows and parameter contexts, the number of environments that must be rotated in sequence, and how much testing your change process requires. No fixed figure applies to every environment, so ask for a schedule that separates inventory, a rehearsal on a non-production copy, the production window and post-change verification. Confirm the change window you can offer, since the work typically needs node restarts coordinated with your operations team.

What must our team provide before a key rotation starts?

The engagement depends on several inputs from your side:

  • Administrative access to the NiFi UI, the nodes and the configuration files, with a named owner for approvals
  • Change windows agreed with application owners who depend on the flows
  • Representative test flows and a non-production NiFi environment that matches production
  • Current, verified backups of the flow definition, the configuration directory and the key material
  • A list of external systems that receive exported flow definitions or parameter values

Missing any of these usually extends the schedule more than the technical work itself.

Can our in-house team rotate the NiFi sensitive properties key without a partner?

Yes, a capable in-house team can rotate the key, provided it has NiFi administration skills, a tested backup and a rehearsed rollback. The rotation uses the nifi.sh command, but the risk lies in ordering the steps across nodes, verifying that every sensitive value still decrypts and updating any exported definitions. Teams that run NiFi regularly and have a non-production copy usually handle it internally. Teams without that experience, or without a rehearsal environment, often bring in a partner for planning and verification.

What happens if we lose the NiFi sensitive properties key?

Without the key, NiFi cannot decrypt the sensitive values it stored, so passwords, tokens and other protected properties in flows and controller services must be re-entered. Flow definitions remain intact, but components that depend on those secrets will not work until they are reconfigured. This is why the key should be stored in your secrets management system with access logging and a documented custodian, and why backups must include the key alongside the configuration. Confirm with your vendor and your own environment exactly which files and properties depend on the key before you rely on that recovery path.

What does a partner's fixed-scope engagement for key rotation cover?

A fixed-scope engagement covers only the work listed in the written scope, which for key handling usually includes an inventory of protected values, a rotation plan, rehearsal in a non-production environment, the production change with verification, updated runbooks and handover. Deliverables, environments and timelines are agreed in writing before work starts. Ongoing key policy, periodic rotation or broader hardening are separate items and can be added as a retainer or a new scope. Ask for the exclusions in writing, including how exported flow definitions and parameter values in other systems will be handled.

Does rotating the key change exported flow definitions and parameter values?

Exported flow definitions may contain values encrypted with the previous key, so exports made before rotation can require the old key to be read correctly in some cases. Parameter values stored in parameter contexts that are marked sensitive are protected the same way. Check which exports leave your NiFi environment, such as copies in version control or migration packages, and decide whether they must be re-exported after rotation. Confirm the exact behavior for your NiFi version against the administration guide before the change window.

How DeployOpen works on this

DeployOpen plans, implements and documents self-hosted open-source platforms inside your own infrastructure, including the sensitive properties key that protects NiFi configuration values. Work starts from a written, fixed scope so that key ownership, rotation steps and evidence are agreed before anything changes on a production cluster.

How we scope

  • Inventory every NiFi instance, cluster and registry that stores encrypted sensitive values or exports flow definitions.
  • Record where the nifi.sensitive.props.key value is held today, who can read it and which nodes use it.
  • Agree in writing who owns key custody, the rotation window and the approval path before work begins.
  • Confirm the NiFi version and migration plans, since 2.x handling of sensitive values is part of the scope.

How we build

  • Set the key in every node's properties file through your configuration management, with matching values verified before startup.
  • Rehearse the nifi.sh rotation procedure on a non-production cluster and capture the exact steps and rollback points.
  • Test that flow exports, parameter contexts and Registry-stored versions still load after a rotation.
  • Restrict who can read the key file and check that backups do not store it alongside encrypted flow data.

How we hand over

  • Deliver a runbook covering key generation, node-by-node distribution, rotation and recovery if a key is lost.
  • Document which values are encrypted, what the key does not protect, and where encryption at rest is handled separately.
  • Provide evidence of configuration checks, rotation test results and access reviews for your change records.
  • Walk your operators through the procedure so routine rotation runs without the original implementation team.

How we support

  • Keep the runbook current as your NiFi version moves through upgrades and cluster changes.
  • Review key access and rotation records on a schedule agreed in the scope.
  • Ongoing support, upgrades and continuous testing are available as a retainer after handover.
  • Ask any quote to list the scoped deliverables, the test environments needed and the handover sessions included.

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.