[asterisk-commits] russell: branch group/security_events r199736 - /team/group/security_events/m...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Jun 9 07:39:31 CDT 2009
Author: russell
Date: Tue Jun 9 07:39:28 2009
New Revision: 199736
URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=199736
Log:
Report failed challenge/response auth for AMI
Modified:
team/group/security_events/main/manager.c
Modified: team/group/security_events/main/manager.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/security_events/main/manager.c?view=diff&rev=199736&r1=199735&r2=199736
==============================================================================
--- team/group/security_events/main/manager.c (original)
+++ team/group/security_events/main/manager.c Tue Jun 9 07:39:28 2009
@@ -1921,6 +1921,38 @@
ast_security_event_report(AST_SEC_EVT(&req_bad_format));
}
+
+static void report_failed_challenge_response(const struct mansession *s,
+ const char *response, const char *expected_response)
+{
+ struct sockaddr_in sin_local = { 0, };
+ struct ast_str *session_id = ast_str_alloca(32);
+ struct ast_security_event_chal_resp_failed chal_resp_failed = {
+ .common.event_type = AST_SECURITY_EVENT_CHAL_RESP_FAILED,
+ .common.version = AST_SECURITY_EVENT_CHAL_RESP_FAILED_VERSION,
+ .common.service = "AMI",
+
+ .account_id = s->session->username,
+ .session_tv = &s->session->sessionstart_tv,
+ .local_addr = {
+ .sin = mansession_encode_sin_local(s, &sin_local),
+ .transport = mansession_get_transport(s),
+ },
+ .remote_addr = {
+ .sin = &s->session->sin,
+ .transport = mansession_get_transport(s),
+ },
+ .challenge = s->session->challenge,
+ .response = response,
+ .expected_response = expected_response,
+ };
+
+ ast_str_set(&session_id, 0, "%p", s->session);
+ chal_resp_failed.session_id = ast_str_buffer(session_id);
+
+ ast_security_event_report(AST_SEC_EVT(&chal_resp_failed));
+}
+
/*
* Here we start with action_ handlers for AMI actions,
* and the internal functions used by them.
@@ -1966,7 +1998,7 @@
if (!strcmp(md5key, key)) {
error = 0;
} else {
- /* XXX Failed Challenge / response */
+ report_failed_challenge_response(s, key, md5key);
}
} else {
ast_debug(1, "MD5 authentication is not possible. challenge: '%s'\n",
More information about the asterisk-commits
mailing list