Skip to content

cluster_backend_zeromq: Automatically enable encryption for multi-node clusters#106

Merged
awelzel merged 1 commit into
masterfrom
topic/awelzel/4432-zeromq-encryption
Apr 14, 2026
Merged

cluster_backend_zeromq: Automatically enable encryption for multi-node clusters#106
awelzel merged 1 commit into
masterfrom
topic/awelzel/4432-zeromq-encryption

Conversation

@awelzel

@awelzel awelzel commented Apr 1, 2026

Copy link
Copy Markdown
Contributor

This change introduces two new options for the ZeroMQ cluster backend:

cluster_backend_zeromq.use_curve_encryption = auto|0|1
cluster_backend_zeromq.curve_dir = ${SpoolDir}/zeromq/curve

The directory is used to persistently store the generated keys. Keys are generated by invoking Zeek and calling the ZeroMQ specific BiF generate_keypair(). To pre-provision keys, it's possible to populate the directory before invoking zeekctl.

By default, when a multi-node cluster is detected, encryption and key generation is implicitly enabled. Setting use_curve_encryption to "0" or "1" allows for explicit configuration. The default is "auto".

The keys are rendered verbatim into zeekctl-config.zeek. The assumption here is that if anyone manages to get access to the zeekctl-config.zeek file, they'll likely have a way to get to the keys in a different way already.

Comment thread ZeekControl/plugins/cluster_backend_zeromq.py Fixed
Comment thread ZeekControl/plugins/cluster_backend_zeromq.py

@ckreibich ckreibich left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM Arne, I just have a quick question here about the choice of spool for the key info.

(
"curve_dir",
"string",
"${SpoolDir}/zeromq/curve",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to make this ${CfgDir}? At least historically the spool is a transient storage place for data awaiting processing, so not a great fit for fixed configs.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used SpoolDir because...

  • didn't want to auto-generate directories/files into CfgDir (this would be next to etc/node.cfg or so)
  • broker stores end/ended up in SpoolDir/stores and they already aren't transient.
  • ${SpoolDir}/state.db is also located there.
  • unless there's non-Zeekctl managed processes connecting: A re-deploy after deleting the keys will re-generate and re-distribute them to all cluster nodes, so they could be seen as somewhat transient.

I'll keep it there. The CfgDir seems less fitting (but certainly debatable and I see the point).

@awelzel awelzel force-pushed the topic/awelzel/4432-zeromq-encryption branch from fdbc469 to bf1f8c5 Compare April 14, 2026 08:36
…e clusters

This change introduces two new options for the ZeroMQ cluster backend:

    cluster_backend_zeromq.use_curve_encryption = auto|0|1
    cluster_backend_zeromq.curve_dir = ${SpoolDir}/zeromq/curve

The directory is used to persistently store the generated keys. Keys are
generated by invoking Zeek and calling the ZeroMQ specific BiF
generate_keypair(). To pre-provision keys, it's possible to populate
the directory before invoking zeekctl.

By default, when a multi-node cluster is detected, encryption and key
generation is implicitly enabled. Setting use_curve_encryption to "0" or "1"
allows for explicit configuration. The default is "auto".

The keys are rendered verbatim into zeekctl-config.zeek. The assumption
here is that if anyone manages to get access to the zeekctl-config.zeek
file, they'll likely have a way to get to the keys in a different way
already.
@awelzel awelzel force-pushed the topic/awelzel/4432-zeromq-encryption branch from a454ce0 to 6c643ae Compare April 14, 2026 10:42
@awelzel awelzel merged commit 045cf68 into master Apr 14, 2026
3 checks passed
@awelzel awelzel deleted the topic/awelzel/4432-zeromq-encryption branch April 14, 2026 10:42
publickey.write_text(public + "\n")

secretkey.touch(exist_ok=True)
secretkey.chmod(0o600)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was updated from 0o400 to 0o600 otherwise can't write, I didn't realize the tests were failing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants