in_forward: Fix incorrect user auth sequence#11028
Merged
Conversation
WalkthroughThe secure-forward handshake in Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant C as Client
participant S as Server (fw_prot)
participant P as check_ping
participant W as send_pong
participant L as Logger
C->>S: PING (secure_forward)
S->>P: validate/authenticate
P-->>S: ping_ret (>=0 ok, <0 auth fail, -1 error)
alt ping_ret == -1 (validation error)
S->>L: log validation error
S-->>C: Close connection / handshake error
else ping_ret < 0 (authentication failure)
S->>W: send PONG (auth-fail signal)
W-->>S: pong_ret (>=0 ok, -1 write error)
alt pong_ret == -1 (write failure)
S->>L: log write failure
S-->>C: Close connection
else pong_ret >= 0
S->>L: note auth failure and terminate handshake (clean up)
S-->>C: End handshake (no error)
end
else ping_ret >= 0 (auth ok)
S->>W: send PONG (success)
W-->>S: pong_ret (>=0 ok, -1 write error)
alt pong_ret == -1 (write failure)
S->>L: log write failure
S-->>C: Close connection
else pong_ret >= 0
S-->>C: Handshake complete
end
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
c27a546 to
55a9b8e
Compare
7 tasks
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The previous pingpong handshaking is not enough for failing handshake case.
We need to distinguish where the error happens on pingpong handshaking.
This could be made rigid approach to handle this.
Follows up #11026.
This PR is tested with Fluent Bit (receiver)/Fluent Bit (sender) and Fluent Bit (receiver)/Fluentd (sender) cases.
Enter
[N/A]in the box, if an item is not applicable to your change.Testing
Before we can approve your change; please submit the following in a comment:
Fluent Bit (Server Configs)
Fluent Bit (Client Configs)
Fluentd Sender configs
<system> log_level debug </system> <source> @type dummy tag dummy.events </source> <match **> @type forward <server> host 127.0.0.1 port 9999 username user password pass </server> <security> shared_key key self_hostname fluentd-sender.local </security> <buffer> @type memory flush_interval 1s </buffer> </match><system> log_level debug </system> <source> @type dummy tag dummy.events </source> <match **> @type forward <server> host 127.0.0.1 port 9999 username user password pass </server> <security> shared_key "" self_hostname fluentd-sender.local </security> <buffer> @type memory flush_interval 1s </buffer> </match>Both of Fluent Bit case
Shared_Key -> OK
Empty_Shared_Key -> OK
Fluent Bit (receiver)/Fluentd (sender) case
Shared_Key -> OK
Empty_Shared_Key -> OK
If this is a change to packaging of containers or native binaries then please confirm it works for all targets.
ok-package-testlabel to test for all targets (requires maintainer to do).Documentation
Backporting
Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.
Summary by CodeRabbit
Bug Fixes
Refactor