Skip to content

in_forward: accept additional shared keys for key rotation - #5669

Merged
Watson1978 merged 2 commits into
fluent:masterfrom
cvas22:forward-additional-shared-keys
Nov 24, 2026
Merged

Watson1978 merged 2 commits into
fluent:masterfrom
cvas22:forward-additional-shared-keys

Conversation

@cvas22

@cvas22 cvas22 commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Which issue(s) this PR fixes:
Fixes #4024

What this PR does / why we need it:
Adds additional_shared_keys to <security> and <client> in in_forward. A client that proves any of the configured keys gets in, and the PONG is signed with the key it used, so out_forward verifies it without any change on the sender side.

That makes a zero-downtime rotation possible: add the new key on the receiver, move the senders over at their own pace, then drop the old one. A <client> with its own shared_key only uses its own keys, same as today. Without the new param nothing changes.

Docs Changes:
fluent/fluentd-docs-gitbook#728

Release Note:
in_forward: add additional_shared_keys to accept more than one shared key, e.g. while rotating keys

Signed-off-by: Srinivas Chippagiri <cvas22@gmail.com>
@Watson1978 Watson1978 added the enhancement Feature request or improve operations label Nov 22, 2026

@Watson1978 Watson1978 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the PR. The rotation flow works end to end in my tests. out_forward senders using the old key and the new key both got through, including one with keepalive and require_ack_response. A sender with an unrelated key was still rejected. Since the PONG is signed with the matched key, senders do not need any change.

One thing should be fixed before merge. An empty entry in additional_shared_keys passes the shared key check, and a null entry breaks the check for the keys after it (see the inline comment). The other two comments are nits.

FYI, malformed JSON in this option, such as additional_shared_keys "[oldkey", puts part of the value in the startup error log. This comes from the shared config code, so we will fix it separately. No change is needed in this PR.

Comment thread lib/fluent/plugin/in_forward.rb Resolved
Comment thread lib/fluent/plugin/in_forward.rb Resolved
Comment thread lib/fluent/plugin/in_forward.rb Resolved
Signed-off-by: Srinivas Chippagiri <cvas22@gmail.com>

@Watson1978 Watson1978 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the update. I checked 32875e2.

I tried the four invalid configurations from my previous SHOULD comment in both <security> and <client>. All eight failed at configure time with additional_shared_keys must not contain an empty key. Events from out_forward senders using the old and new keys both arrived. The @shared_keys change and the new test for a <client> that inherits the <security> keys look good.

One small follow-up for fluent/fluentd-docs-gitbook#728. The comma example is there. Could you also include additional_shared_keys ["[oldkey"] from our earlier thread? In classic configuration, additional_shared_keys "[oldkey" is parsed as JSON and fails.

LGTM.

@Watson1978
Watson1978 merged commit 04d9106 into fluent:master Nov 24, 2026
34 of 35 checks passed
cvas22 added a commit to cvas22/fluentd-docs-gitbook that referenced this pull request Nov 24, 2026
Add the new parameter to <security> and <client>, and a how-to for
rotating the shared key. See fluent/fluentd#5669.

Signed-off-by: Srinivas Chippagiri <cvas22@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Feature request or improve operations

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support multiple shared_key

2 participants