Skip to content

Conversation

AmazingPP
Copy link
Contributor

Replaces: #13951

Changes since v3:

  • Fixed memory leak occurring after authentication failure.
  • Added ECHO command in SCConfLogReopenSyncRedis to verify the connection is ready before writing logs, preventing spam in sync mode.

Changes since v2:

  • Made authentication failure retry interval consistent with connection failure.

Changes since v1:

  • Reworked async mode to use a state machine for connection and authentication.
  • Authentication is now retried on failure.
  • Handled reply == NULL in the authentication callback.
  • Added a guard: if a Redis username is set without a password, ignore the username and log a warning.

Manual testing

I manually tested the changes in both sync and async modes across different scenarios. All expected results matched actual results.

Case Scenario Result
1 No auth Success, logs written
2 Wrong password Connection failed, error logged
3 Correct password Success, logs written
4 Missing password Connection failed, error logged
5 ACL (valid) Success, logs written
6 ACL (wrong password) Connection failed, error logged
7 ACL (no username provided) Connection failed, error logged
8 Re-authentication Connection recovered, logs written after re-auth

Contribution style:

Our Contribution agreements:

Changes (if applicable):

Link to ticket: https://redmine.openinfosecfoundation.org/issues/7062

Describe changes:

  • Add authentication support to the Redis logging output.
  • Authentication configuration defaults to null for backward compatibility.

Add authentication support to the Redis logging output.
It introduces `username` and `password` configuration options for Redis,
allowing Suricata to authenticate with Redis servers that require it.

Ticket: 7062
Copy link

codecov bot commented Oct 10, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.87%. Comparing base (7ca95ee) to head (8bbe5bb).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff            @@
##             main   #14002    +/-   ##
========================================
  Coverage   83.86%   83.87%            
========================================
  Files        1011     1011            
  Lines      275556   275671   +115     
========================================
+ Hits       231107   231207   +100     
- Misses      44449    44464    +15     
Flag Coverage Δ
fuzzcorpus 63.51% <ø> (-0.01%) ⬇️
livemode 19.34% <ø> (-0.07%) ⬇️
pcap 44.75% <ø> (+<0.01%) ⬆️
suricata-verify 65.15% <ø> (+0.02%) ⬆️
unittests 59.14% <ø> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants