-
Notifications
You must be signed in to change notification settings - Fork 1.6k
redis: Add authentication support v1 #13851
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #13851 +/- ##
=======================================
Coverage ? 83.73%
=======================================
Files ? 1011
Lines ? 275170
Branches ? 0
=======================================
Hits ? 230412
Misses ? 44758
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Async needs a little work.
static void SCRedisAsyncAuthCallback(redisAsyncContext *ac, void *r, void *privdata) | ||
{ | ||
redisReply *reply = r; | ||
if (reply != NULL && reply->type == REDIS_REPLY_ERROR) { | ||
SCLogError("Redis AUTH failed: %s", reply->str); | ||
} else if (reply != NULL) { | ||
SCLogInfo("Redis authenticated successfully."); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need some flag to tell us if authentication was successful or not.
In non-async mode, the connection is not setup completely if authentication fails, so we re-connect periodically, which is ideal.
In async mode we log that authentication failed, then proceed to send events to to the server. Instead authentication should be retried.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious: don't we have to do anything in case reply == NULL
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’ve reworked the async path to use a proper state machine. It now retries authentication instead of just logging, and also handles the reply == NULL
case in the auth callback.
Replaced by #13898 |
Contribution style:
https://docs.suricata.io/en/latest/devguide/contributing/contribution-process.html
Our Contribution agreements:
https://suricata.io/about/contribution-agreement/ (note: this is only required once)
Changes (if applicable):
(including schema descriptions)
https://redmine.openinfosecfoundation.org/projects/suricata/issues
Link to ticket: https://redmine.openinfosecfoundation.org/issues/7062
Describe changes:
null
for backward compatibility.