Asterisk - The Open Source Telephony Project GIT-master-a358458
security_events_defs.h
Go to the documentation of this file.
1/*
2 * Asterisk -- An open source telephony toolkit.
3 *
4 * Copyright (C) 2012, Digium, Inc.
5 *
6 * Russell Bryant <russell@digium.com>
7 *
8 * See http://www.asterisk.org for more information about
9 * the Asterisk project. Please do not directly contact
10 * any of the maintainers of this project for assistance;
11 * the project provides a web site, mailing lists and IRC
12 * channels for your use.
13 *
14 * This program is free software, distributed under the terms of
15 * the GNU General Public License Version 2. See the LICENSE file
16 * at the top of the source tree.
17 */
18
19/*!
20 * \file
21 *
22 * \brief Security Event Reporting Data Structures
23 *
24 * \author Russell Bryant <russell@digium.com>
25 */
26
27#ifndef __AST_SECURITY_EVENTS_DEFS_H__
28#define __AST_SECURITY_EVENTS_DEFS_H__
29
30#include "asterisk/network.h"
31#include "asterisk/netsock2.h"
32
33#if defined(__cplusplus) || defined(c_plusplus)
34extern "C" {
35#endif
36
37/*!
38 * \brief Security event types
39 */
41 /*!
42 * \brief Failed ACL
43 *
44 * This security event should be generated when an incoming request
45 * was made, but was denied due to configured IP address access control
46 * lists.
47 */
49 /*!
50 * \brief Invalid Account ID
51 *
52 * This event is used when an invalid account identifier is supplied
53 * during authentication. For example, if an invalid username is given,
54 * this event should be used.
55 */
57 /*!
58 * \brief Session limit reached
59 *
60 * A request has been denied because a configured session limit has been
61 * reached, such as a call limit.
62 */
64 /*!
65 * \brief Memory limit reached
66 *
67 * A request has been denied because a configured memory limit has been
68 * reached.
69 */
71 /*!
72 * \brief Load Average limit reached
73 *
74 * A request has been denied because a configured load average limit has been
75 * reached.
76 */
78 /*!
79 * \brief A request was made that we understand, but do not support
80 */
82 /*!
83 * \brief A request was made that is not allowed
84 */
86 /*!
87 * \brief The attempted authentication method is not allowed
88 */
90 /*!
91 * \brief Request received with bad formatting
92 */
94 /*!
95 * \brief FYI FWIW, Successful authentication has occurred
96 */
98 /*!
99 * \brief An unexpected source address was seen for a session in progress
100 */
102 /*!
103 * \brief An attempt at challenge/response authentication failed
104 */
106 /*!
107 * \brief An attempt at basic password authentication failed
108 */
110 /*!
111 * \brief Challenge was sent out, informational
112 */
114 /*!
115 * \brief An attempt to contact a peer on an invalid transport.
116 */
118 /*!
119 * \brief This _must_ stay at the end.
120 */
123
124/*!
125 * \brief the severity of a security event
126 *
127 * This is defined as a bit field to make it easy for consumers of the API to
128 * subscribe to any combination of the defined severity levels.
129 *
130 * XXX \todo Do we need any more levels here?
131 */
133 /*! \brief Informational event, not something that has gone wrong */
135 /*! \brief Something has gone wrong */
137};
138
139#define AST_SEC_EVT(e) ((struct ast_security_event_common *) e)
140
142 const struct ast_sockaddr *addr;
144};
145
146/*!
147 * \brief Common structure elements
148 *
149 * This is the structure header for all event descriptor structures defined
150 * below. The contents of this structure are very important and must not
151 * change. Even though these structures are exposed via a public API, we have
152 * a version field that can be used to ensure ABI safety. If the event
153 * descriptors need to be changed or updated in the future, we can safely do
154 * so and can detect ABI changes at runtime.
155 */
157 /*! \brief The security event sub-type */
159 /*! \brief security event version */
160 uint32_t version;
161 /*!
162 * \brief Service that generated the event
163 * \note Always required
164 *
165 * Examples: "SIP", "AMI"
166 */
167 const char *service;
168 /*!
169 * \brief Module, Normally the AST_MODULE define
170 * \note Always optional
171 */
172 const char *module;
173 /*!
174 * \brief Account ID, specific to the service type
175 * \note optional/required, depending on event type
176 */
177 const char *account_id;
178 /*!
179 * \brief Session ID, specific to the service type
180 * \note Always required
181 */
182 const char *session_id;
183 /*!
184 * \brief Session timeval, when the session started
185 * \note Always optional
186 */
187 const struct timeval *session_tv;
188 /*!
189 * \brief Local address the request came in on
190 * \note Always required
191 */
193 /*!
194 * \brief Remote address the request came from
195 * \note Always required
196 */
198};
199
200/*!
201 * \brief Checking against an IP access control list failed
202 */
204 /*!
205 * \brief Event descriptor version
206 * \note This _must_ be changed if this event descriptor is changed.
207 */
208 #define AST_SECURITY_EVENT_FAILED_ACL_VERSION 1
209 /*!
210 * \brief Common security event descriptor elements
211 * \note Account ID required
212 */
214 /*!
215 * \brief ACL name, identifies which ACL was hit
216 * \note optional
217 */
218 const char *acl_name;
219};
220
221/*!
222 * \brief Invalid account ID specified (invalid username, for example)
223 */
225 /*!
226 * \brief Event descriptor version
227 * \note This _must_ be changed if this event descriptor is changed.
228 */
229 #define AST_SECURITY_EVENT_INVAL_ACCT_ID_VERSION 1
230 /*!
231 * \brief Common security event descriptor elements
232 * \note Account ID required
233 */
235};
236
237/*!
238 * \brief Request denied because of a session limit
239 */
241 /*!
242 * \brief Event descriptor version
243 * \note This _must_ be changed if this event descriptor is changed.
244 */
245 #define AST_SECURITY_EVENT_SESSION_LIMIT_VERSION 1
246 /*!
247 * \brief Common security event descriptor elements
248 * \note Account ID required
249 */
251};
252
253/*!
254 * \brief Request denied because of a memory limit
255 */
257 /*!
258 * \brief Event descriptor version
259 * \note This _must_ be changed if this event descriptor is changed.
260 */
261 #define AST_SECURITY_EVENT_MEM_LIMIT_VERSION 1
262 /*!
263 * \brief Common security event descriptor elements
264 * \note Account ID required
265 */
267};
268
269/*!
270 * \brief Request denied because of a load average limit
271 */
273 /*!
274 * \brief Event descriptor version
275 * \note This _must_ be changed if this event descriptor is changed.
276 */
277 #define AST_SECURITY_EVENT_LOAD_AVG_VERSION 1
278 /*!
279 * \brief Common security event descriptor elements
280 * \note Account ID required
281 */
283};
284
285/*!
286 * \brief Request denied because we don't support it
287 */
289 /*!
290 * \brief Event descriptor version
291 * \note This _must_ be changed if this event descriptor is changed.
292 */
293 #define AST_SECURITY_EVENT_REQ_NO_SUPPORT_VERSION 1
294 /*!
295 * \brief Common security event descriptor elements
296 * \note Account ID required
297 */
299 /*!
300 * \brief Request type that was made
301 * \note required
302 */
303 const char *request_type;
304};
305
306/*!
307 * \brief Request denied because it's not allowed
308 */
310 /*!
311 * \brief Event descriptor version
312 * \note This _must_ be changed if this event descriptor is changed.
313 */
314 #define AST_SECURITY_EVENT_REQ_NOT_ALLOWED_VERSION 1
315 /*!
316 * \brief Common security event descriptor elements
317 * \note Account ID required
318 */
320 /*!
321 * \brief Request type that was made
322 * \note required
323 */
324 const char *request_type;
325 /*!
326 * \brief Request type that was made
327 * \note optional
328 */
329 const char *request_params;
330};
331
332/*!
333 * \brief Auth method used not allowed
334 */
336 /*!
337 * \brief Event descriptor version
338 * \note This _must_ be changed if this event descriptor is changed.
339 */
340 #define AST_SECURITY_EVENT_AUTH_METHOD_NOT_ALLOWED_VERSION 1
341 /*!
342 * \brief Common security event descriptor elements
343 * \note Account ID required
344 */
346 /*!
347 * \brief Auth method attempted
348 * \note required
349 */
350 const char *auth_method;
351};
352
353/*!
354 * \brief Invalid formatting of request
355 */
357 /*!
358 * \brief Event descriptor version
359 * \note This _must_ be changed if this event descriptor is changed.
360 */
361 #define AST_SECURITY_EVENT_REQ_BAD_FORMAT_VERSION 1
362 /*!
363 * \brief Common security event descriptor elements
364 * \note Account ID optional
365 */
367 /*!
368 * \brief Request type that was made
369 * \note required
370 */
371 const char *request_type;
372 /*!
373 * \brief Request type that was made
374 * \note optional
375 */
376 const char *request_params;
377};
378
379/*!
380 * \brief Successful authentication
381 */
383 /*!
384 * \brief Event descriptor version
385 * \note This _must_ be changed if this event descriptor is changed.
386 */
387 #define AST_SECURITY_EVENT_SUCCESSFUL_AUTH_VERSION 1
388 /*!
389 * \brief Common security event descriptor elements
390 * \note Account ID required
391 */
393 /*!
394 * \brief Using password - if a password was used or not
395 * \note required, 0 = no, 1 = yes
396 */
398};
399
400/*!
401 * \brief Unexpected source address for a session in progress
402 */
404 /*!
405 * \brief Event descriptor version
406 * \note This _must_ be changed if this event descriptor is changed.
407 */
408 #define AST_SECURITY_EVENT_UNEXPECTED_ADDR_VERSION 2
409 /*!
410 * \brief Common security event descriptor elements
411 * \note Account ID required
412 */
414 /*!
415 * \brief Expected remote address
416 * \note required
417 */
419};
420
421/*!
422 * \brief An attempt at challenge/response auth failed
423 */
425 /*!
426 * \brief Event descriptor version
427 * \note This _must_ be changed if this event descriptor is changed.
428 */
429 #define AST_SECURITY_EVENT_CHAL_RESP_FAILED_VERSION 1
430 /*!
431 * \brief Common security event descriptor elements
432 * \note Account ID required
433 */
435 /*!
436 * \brief Challenge provided
437 * \note required
438 */
439 const char *challenge;
440 /*!
441 * \brief Response received
442 * \note required
443 */
444 const char *response;
445 /*!
446 * \brief Response expected to be received
447 * \note required
448 */
449 const char *expected_response;
450};
451
452/*!
453 * \brief An attempt at basic password auth failed
454 */
456 /*!
457 * \brief Event descriptor version
458 * \note This _must_ be changed if this event descriptor is changed.
459 */
460 #define AST_SECURITY_EVENT_INVAL_PASSWORD_VERSION 2
461 /*!
462 * \brief Common security event descriptor elements
463 * \note Account ID required
464 */
466 /*!
467 * \brief Challenge provided
468 * \note required
469 */
470 const char *challenge;
471 /*!
472 * \brief Challenge received
473 * \note required
474 */
476 /*!
477 * \brief Hash received
478 * \note required
479 */
480 const char *received_hash;
481};
482
483/*!
484 * \brief A challenge was sent out
485 */
487 /*!
488 * \brief Event descriptor version
489 * \note This _must_ be changed if this event descriptor is changed.
490 */
491 #define AST_SECURITY_EVENT_CHAL_SENT_VERSION 1
492 /*!
493 * \brief Common security event descriptor elements
494 * \note Account ID required
495 */
497 /*!
498 * \brief Challenge sent
499 * \note required
500 */
501 const char *challenge;
502};
503
504/*!
505 * \brief Attempt to contact peer on invalid transport
506 */
508 /*!
509 * \brief Event descriptor version
510 * \note This _must_ be changed if this event descriptor is changed.
511 */
512 #define AST_SECURITY_EVENT_INVAL_TRANSPORT_VERSION 1
513 /*!
514 * \brief Common security event descriptor elements
515 * \note Account ID required
516 */
518 /*!
519 * \brief Attempted transport
520 * \note required
521 */
522 const char *transport;
523};
524
525#if defined(__cplusplus) || defined(c_plusplus)
526}
527#endif
528
529#endif /* __AST_SECURITY_EVENTS_DEFS_H__ */
Network socket handling.
ast_transport
Definition: netsock2.h:59
Wrapper for network related headers, masking differences between various operating systems....
ast_security_event_severity
the severity of a security event
@ AST_SECURITY_EVENT_SEVERITY_ERROR
Something has gone wrong.
@ AST_SECURITY_EVENT_SEVERITY_INFO
Informational event, not something that has gone wrong.
ast_security_event_type
Security event types.
@ AST_SECURITY_EVENT_INVAL_TRANSPORT
An attempt to contact a peer on an invalid transport.
@ AST_SECURITY_EVENT_LOAD_AVG
Load Average limit reached.
@ AST_SECURITY_EVENT_INVAL_PASSWORD
An attempt at basic password authentication failed.
@ AST_SECURITY_EVENT_SESSION_LIMIT
Session limit reached.
@ AST_SECURITY_EVENT_REQ_NO_SUPPORT
A request was made that we understand, but do not support.
@ AST_SECURITY_EVENT_FAILED_ACL
Failed ACL.
@ AST_SECURITY_EVENT_NUM_TYPES
This must stay at the end.
@ AST_SECURITY_EVENT_UNEXPECTED_ADDR
An unexpected source address was seen for a session in progress.
@ AST_SECURITY_EVENT_MEM_LIMIT
Memory limit reached.
@ AST_SECURITY_EVENT_REQ_NOT_ALLOWED
A request was made that is not allowed.
@ AST_SECURITY_EVENT_CHAL_SENT
Challenge was sent out, informational.
@ AST_SECURITY_EVENT_CHAL_RESP_FAILED
An attempt at challenge/response authentication failed.
@ AST_SECURITY_EVENT_REQ_BAD_FORMAT
Request received with bad formatting.
@ AST_SECURITY_EVENT_SUCCESSFUL_AUTH
FYI FWIW, Successful authentication has occurred.
@ AST_SECURITY_EVENT_INVAL_ACCT_ID
Invalid Account ID.
@ AST_SECURITY_EVENT_AUTH_METHOD_NOT_ALLOWED
The attempted authentication method is not allowed.
const char * auth_method
Auth method attempted.
struct ast_security_event_common common
Common security event descriptor elements.
An attempt at challenge/response auth failed.
const char * response
Response received.
struct ast_security_event_common common
Common security event descriptor elements.
const char * expected_response
Response expected to be received.
const char * challenge
Challenge provided.
A challenge was sent out.
struct ast_security_event_common common
Common security event descriptor elements.
const char * challenge
Challenge sent.
Common structure elements.
struct ast_security_event_ip_addr local_addr
Local address the request came in on.
struct ast_security_event_ip_addr remote_addr
Remote address the request came from.
const char * module
Module, Normally the AST_MODULE define.
const char * account_id
Account ID, specific to the service type.
const char * session_id
Session ID, specific to the service type.
enum ast_security_event_type event_type
The security event sub-type.
const struct timeval * session_tv
Session timeval, when the session started.
uint32_t version
security event version
const char * service
Service that generated the event.
Checking against an IP access control list failed.
struct ast_security_event_common common
Common security event descriptor elements.
const char * acl_name
ACL name, identifies which ACL was hit.
Invalid account ID specified (invalid username, for example)
struct ast_security_event_common common
Common security event descriptor elements.
An attempt at basic password auth failed.
struct ast_security_event_common common
Common security event descriptor elements.
const char * received_hash
Hash received.
const char * challenge
Challenge provided.
const char * received_challenge
Challenge received.
Attempt to contact peer on invalid transport.
const char * transport
Attempted transport.
struct ast_security_event_common common
Common security event descriptor elements.
const struct ast_sockaddr * addr
Request denied because of a load average limit.
struct ast_security_event_common common
Common security event descriptor elements.
Request denied because of a memory limit.
struct ast_security_event_common common
Common security event descriptor elements.
Invalid formatting of request.
struct ast_security_event_common common
Common security event descriptor elements.
const char * request_params
Request type that was made.
const char * request_type
Request type that was made.
Request denied because we don't support it.
struct ast_security_event_common common
Common security event descriptor elements.
const char * request_type
Request type that was made.
Request denied because it's not allowed.
struct ast_security_event_common common
Common security event descriptor elements.
const char * request_params
Request type that was made.
const char * request_type
Request type that was made.
Request denied because of a session limit.
struct ast_security_event_common common
Common security event descriptor elements.
uint32_t using_password
Using password - if a password was used or not.
struct ast_security_event_common common
Common security event descriptor elements.
Unexpected source address for a session in progress.
struct ast_security_event_common common
Common security event descriptor elements.
struct ast_security_event_ip_addr expected_addr
Expected remote address.
Socket address structure.
Definition: netsock2.h:97