Asterisk - The Open Source Telephony Project  GIT-master-1b41629
test_security_events.c
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 /*! \file
20  *
21  * \brief Test security event generation
22  *
23  * \author Russell Bryant <russell@digium.com>
24  */
25 
26 /*** MODULEINFO
27  <depend>TEST_FRAMEWORK</depend>
28  <support_level>core</support_level>
29  ***/
30 
31 #include "asterisk.h"
32 
33 #include "asterisk/module.h"
34 #include "asterisk/cli.h"
35 #include "asterisk/utils.h"
37 #include "asterisk/netsock2.h"
38 
39 static void evt_gen_failed_acl(void);
40 static void evt_gen_inval_acct_id(void);
41 static void evt_gen_session_limit(void);
42 static void evt_gen_mem_limit(void);
43 static void evt_gen_load_avg(void);
44 static void evt_gen_req_no_support(void);
45 static void evt_gen_req_not_allowed(void);
46 static void evt_gen_auth_method_not_allowed(void);
47 static void evt_gen_req_bad_format(void);
48 static void evt_gen_successful_auth(void);
49 static void evt_gen_unexpected_addr(void);
50 static void evt_gen_chal_resp_failed(void);
51 static void evt_gen_inval_password(void);
52 static void evt_gen_chal_sent(void);
53 static void evt_gen_inval_transport(void);
54 
55 typedef void (*evt_generator)(void);
72 };
73 
74 static void evt_gen_failed_acl(void)
75 {
76  struct ast_sockaddr addr_local = { {0,} };
77  struct ast_sockaddr addr_remote = { {0,} };
78 
79  struct timeval session_tv = ast_tvnow();
80  struct ast_security_event_failed_acl failed_acl_event = {
82  .common.version = AST_SECURITY_EVENT_FAILED_ACL_VERSION,
83  .common.service = "TEST",
84  .common.module = AST_MODULE,
85  .common.account_id = "Username",
86  .common.session_id = "Session123",
87  .common.session_tv = &session_tv,
88  .common.local_addr = {
89  .addr = &addr_local,
90  .transport = AST_TRANSPORT_UDP,
91  },
92  .common.remote_addr = {
93  .addr = &addr_remote,
94  .transport = AST_TRANSPORT_UDP,
95  },
96 
97  .acl_name = "TEST_ACL",
98  };
99 
100  char localaddr[53];
101  char remoteaddr[53];
102 
103  ast_copy_string(localaddr, "192.168.1.1:12121", sizeof(localaddr));
104  ast_copy_string(remoteaddr, "192.168.1.2:12345", sizeof(remoteaddr));
105 
106  ast_sockaddr_parse(&addr_local, localaddr, 0);
107  ast_sockaddr_parse(&addr_remote, remoteaddr, 0);
108 
109  ast_security_event_report(AST_SEC_EVT(&failed_acl_event));
110 }
111 
112 static void evt_gen_inval_acct_id(void)
113 {
114  struct ast_sockaddr addr_local = { {0,} };
115  struct ast_sockaddr addr_remote = { {0,} };
116 
117  struct timeval session_tv = ast_tvnow();
118  struct ast_security_event_inval_acct_id inval_acct_id = {
121  .common.service = "TEST",
122  .common.module = AST_MODULE,
123  .common.account_id = "FakeUser",
124  .common.session_id = "Session456",
125  .common.session_tv = &session_tv,
126  .common.local_addr = {
127  .addr = &addr_local,
128  .transport = AST_TRANSPORT_TCP,
129  },
130  .common.remote_addr = {
131  .addr = &addr_remote,
132  .transport = AST_TRANSPORT_TCP,
133  },
134  };
135 
136  char localaddr[53];
137  char remoteaddr[53];
138 
139  ast_copy_string(localaddr, "10.1.2.3:4321", sizeof(localaddr));
140  ast_copy_string(remoteaddr, "10.1.2.4:123", sizeof(remoteaddr));
141 
142  ast_sockaddr_parse(&addr_local, localaddr, 0);
143  ast_sockaddr_parse(&addr_remote, remoteaddr, 0);
144 
145  ast_security_event_report(AST_SEC_EVT(&inval_acct_id));
146 }
147 
148 static void evt_gen_session_limit(void)
149 {
150  struct ast_sockaddr addr_local = { {0,} };
151  struct ast_sockaddr addr_remote = { {0,} };
152 
153  struct timeval session_tv = ast_tvnow();
154  struct ast_security_event_session_limit session_limit = {
157  .common.service = "TEST",
158  .common.module = AST_MODULE,
159  .common.account_id = "Jenny",
160  .common.session_id = "8675309",
161  .common.session_tv = &session_tv,
162  .common.local_addr = {
163  .addr = &addr_local,
164  .transport = AST_TRANSPORT_TLS,
165  },
166  .common.remote_addr = {
167  .addr = &addr_remote,
168  .transport = AST_TRANSPORT_TLS,
169  },
170  };
171 
172  char localaddr[53];
173  char remoteaddr[53];
174 
175  ast_copy_string(localaddr, "10.5.4.3:4444", sizeof(localaddr));
176  ast_copy_string(remoteaddr, "10.5.4.2:3333", sizeof(remoteaddr));
177 
178  ast_sockaddr_parse(&addr_local, localaddr, 0);
179  ast_sockaddr_parse(&addr_remote, remoteaddr, 0);
180 
181  ast_security_event_report(AST_SEC_EVT(&session_limit));
182 }
183 
184 static void evt_gen_mem_limit(void)
185 {
186  struct ast_sockaddr addr_local = { {0,} };
187  struct ast_sockaddr addr_remote = { {0,} };
188 
189  struct timeval session_tv = ast_tvnow();
190  struct ast_security_event_mem_limit mem_limit = {
192  .common.version = AST_SECURITY_EVENT_MEM_LIMIT_VERSION,
193  .common.service = "TEST",
194  .common.module = AST_MODULE,
195  .common.account_id = "Felix",
196  .common.session_id = "Session2604",
197  .common.session_tv = &session_tv,
198  .common.local_addr = {
199  .addr = &addr_local,
200  .transport = AST_TRANSPORT_UDP,
201  },
202  .common.remote_addr = {
203  .addr = &addr_remote,
204  .transport = AST_TRANSPORT_UDP,
205  },
206  };
207 
208  char localaddr[53];
209  char remoteaddr[53];
210 
211  ast_copy_string(localaddr, "10.10.10.10:555", sizeof(localaddr));
212  ast_copy_string(remoteaddr, "10.10.10.12:5656", sizeof(remoteaddr));
213 
214  ast_sockaddr_parse(&addr_local, localaddr, 0);
215  ast_sockaddr_parse(&addr_remote, remoteaddr, 0);
216 
218 }
219 
220 static void evt_gen_load_avg(void)
221 {
222  struct ast_sockaddr addr_local = { {0,} };
223  struct ast_sockaddr addr_remote = { {0,} };
224 
225  struct timeval session_tv = ast_tvnow();
226  struct ast_security_event_load_avg load_avg = {
228  .common.version = AST_SECURITY_EVENT_LOAD_AVG_VERSION,
229  .common.service = "TEST",
230  .common.module = AST_MODULE,
231  .common.account_id = "GuestAccount",
232  .common.session_id = "XYZ123",
233  .common.session_tv = &session_tv,
234  .common.local_addr = {
235  .addr = &addr_local,
236  .transport = AST_TRANSPORT_UDP,
237  },
238  .common.remote_addr = {
239  .addr = &addr_remote,
240  .transport = AST_TRANSPORT_UDP,
241  },
242  };
243 
244  char localaddr[53];
245  char remoteaddr[53];
246 
247  ast_copy_string(localaddr, "10.11.12.13:9876", sizeof(localaddr));
248  ast_copy_string(remoteaddr, "10.12.11.10:9825", sizeof(remoteaddr));
249 
250  ast_sockaddr_parse(&addr_local, localaddr, 0);
251  ast_sockaddr_parse(&addr_remote, remoteaddr, 0);
252 
254 }
255 
256 static void evt_gen_req_no_support(void)
257 {
258  struct ast_sockaddr addr_local = { {0,} };
259  struct ast_sockaddr addr_remote = { {0,} };
260 
261  struct timeval session_tv = ast_tvnow();
262  struct ast_security_event_req_no_support req_no_support = {
265  .common.service = "TEST",
266  .common.module = AST_MODULE,
267  .common.account_id = "George",
268  .common.session_id = "asdkl23478289lasdkf",
269  .common.session_tv = &session_tv,
270  .common.local_addr = {
271  .addr = &addr_local,
272  .transport = AST_TRANSPORT_UDP,
273  },
274  .common.remote_addr = {
275  .addr = &addr_remote,
276  .transport = AST_TRANSPORT_UDP,
277  },
278 
279  .request_type = "MakeMeDinner",
280  };
281 
282  char localaddr[53];
283  char remoteaddr[53];
284 
285  ast_copy_string(localaddr, "10.110.120.130:9888", sizeof(localaddr));
286  ast_copy_string(remoteaddr, "10.120.110.100:9777", sizeof(remoteaddr));
287 
288  ast_sockaddr_parse(&addr_local, localaddr, 0);
289  ast_sockaddr_parse(&addr_remote, remoteaddr, 0);
290 
291  ast_security_event_report(AST_SEC_EVT(&req_no_support));
292 }
293 
294 static void evt_gen_req_not_allowed(void)
295 {
296  struct ast_sockaddr addr_local = { {0,} };
297  struct ast_sockaddr addr_remote = { {0,} };
298 
299  struct timeval session_tv = ast_tvnow();
300  struct ast_security_event_req_not_allowed req_not_allowed = {
303  .common.service = "TEST",
304  .common.module = AST_MODULE,
305  .common.account_id = "George",
306  .common.session_id = "alksdjf023423h4lka0df",
307  .common.session_tv = &session_tv,
308  .common.local_addr = {
309  .addr = &addr_local,
310  .transport = AST_TRANSPORT_UDP,
311  },
312  .common.remote_addr = {
313  .addr = &addr_remote,
314  .transport = AST_TRANSPORT_UDP,
315  },
316 
317  .request_type = "MakeMeBreakfast",
318  .request_params = "BACONNNN!",
319  };
320 
321  char localaddr[53];
322  char remoteaddr[53];
323 
324  ast_copy_string(localaddr, "10.110.120.130:9888", sizeof(localaddr));
325  ast_copy_string(remoteaddr, "10.120.110.100:9777", sizeof(remoteaddr));
326 
327  ast_sockaddr_parse(&addr_local, localaddr, 0);
328  ast_sockaddr_parse(&addr_remote, remoteaddr, 0);
329 
330  ast_security_event_report(AST_SEC_EVT(&req_not_allowed));
331 }
332 
334 {
335  struct ast_sockaddr addr_local = { {0,} };
336  struct ast_sockaddr addr_remote = { {0,} };
337 
338  struct timeval session_tv = ast_tvnow();
339  struct ast_security_event_auth_method_not_allowed auth_method_not_allowed = {
342  .common.service = "TEST",
343  .common.module = AST_MODULE,
344  .common.account_id = "Bob",
345  .common.session_id = "010101010101",
346  .common.session_tv = &session_tv,
347  .common.local_addr = {
348  .addr = &addr_local,
349  .transport = AST_TRANSPORT_TCP,
350  },
351  .common.remote_addr = {
352  .addr = &addr_remote,
353  .transport = AST_TRANSPORT_TCP,
354  },
355 
356  .auth_method = "PlainText"
357  };
358 
359  char localaddr[53];
360  char remoteaddr[53];
361 
362  ast_copy_string(localaddr, "10.110.120.135:8754", sizeof(localaddr));
363  ast_copy_string(remoteaddr, "10.120.110.105:8745", sizeof(remoteaddr));
364 
365  ast_sockaddr_parse(&addr_local, localaddr, 0);
366  ast_sockaddr_parse(&addr_remote, remoteaddr, 0);
367 
368  ast_security_event_report(AST_SEC_EVT(&auth_method_not_allowed));
369 }
370 
371 static void evt_gen_req_bad_format(void)
372 {
373  struct ast_sockaddr addr_local = { {0,} };
374  struct ast_sockaddr addr_remote = { {0,} };
375 
376  struct timeval session_tv = ast_tvnow();
377  struct ast_security_event_req_bad_format req_bad_format = {
380  .common.service = "TEST",
381  .common.module = AST_MODULE,
382  .common.account_id = "Larry",
383  .common.session_id = "838383fhfhf83hf8h3f8h",
384  .common.session_tv = &session_tv,
385  .common.local_addr = {
386  .addr = &addr_local,
387  .transport = AST_TRANSPORT_TCP,
388  },
389  .common.remote_addr = {
390  .addr = &addr_remote,
391  .transport = AST_TRANSPORT_TCP,
392  },
393 
394  .request_type = "CheeseBurger",
395  .request_params = "Onions,Swiss,MotorOil",
396  };
397 
398  char localaddr[53];
399  char remoteaddr[53];
400 
401  ast_copy_string(localaddr, "10.110.220.230:1212", sizeof(localaddr));
402  ast_copy_string(remoteaddr, "10.120.210.200:2121", sizeof(remoteaddr));
403 
404  ast_sockaddr_parse(&addr_local, localaddr, 0);
405  ast_sockaddr_parse(&addr_remote, remoteaddr, 0);
406 
407  ast_security_event_report(AST_SEC_EVT(&req_bad_format));
408 }
409 
410 static void evt_gen_successful_auth(void)
411 {
412  struct ast_sockaddr addr_local = { {0,} };
413  struct ast_sockaddr addr_remote = { {0,} };
414 
415  struct timeval session_tv = ast_tvnow();
416  struct ast_security_event_successful_auth successful_auth = {
419  .common.service = "TEST",
420  .common.module = AST_MODULE,
421  .common.account_id = "ValidUser",
422  .common.session_id = "Session456",
423  .common.session_tv = &session_tv,
424  .common.local_addr = {
425  .addr = &addr_local,
426  .transport = AST_TRANSPORT_TCP,
427  },
428  .common.remote_addr = {
429  .addr = &addr_remote,
430  .transport = AST_TRANSPORT_TCP,
431  },
432  };
433 
434  char localaddr[53];
435  char remoteaddr[53];
436 
437  ast_copy_string(localaddr, "10.1.2.3:4321", sizeof(localaddr));
438  ast_copy_string(remoteaddr, "10.1.2.4:1234", sizeof(remoteaddr));
439 
440  ast_sockaddr_parse(&addr_local, localaddr, 0);
441  ast_sockaddr_parse(&addr_remote, remoteaddr, 0);
442 
443  ast_security_event_report(AST_SEC_EVT(&successful_auth));
444 }
445 
446 static void evt_gen_unexpected_addr(void)
447 {
448  struct ast_sockaddr addr_local = { {0,} };
449  struct ast_sockaddr addr_remote = { {0,} };
450  struct ast_sockaddr addr_expected = { {0,} };
451 
452  struct timeval session_tv = ast_tvnow();
453  struct ast_security_event_unexpected_addr unexpected_addr = {
456  .common.service = "TEST",
457  .common.module = AST_MODULE,
458  .common.account_id = "CoolUser",
459  .common.session_id = "Session789",
460  .common.session_tv = &session_tv,
461  .common.local_addr = {
462  .addr = &addr_local,
463  .transport = AST_TRANSPORT_UDP,
464  },
465  .common.remote_addr = {
466  .addr = &addr_remote,
467  .transport = AST_TRANSPORT_UDP,
468  },
469 
470  .expected_addr = {
471  .addr = &addr_expected,
472  .transport = AST_TRANSPORT_UDP,
473  },
474  };
475 
476  char localaddr[53];
477  char remoteaddr[53];
478  char expectedaddr[53];
479 
480  ast_copy_string(localaddr, "10.1.2.3:4321", sizeof(localaddr));
481  ast_copy_string(remoteaddr, "10.1.2.4:1234", sizeof(remoteaddr));
482  ast_copy_string(expectedaddr, "10.1.2.5:2343", sizeof(expectedaddr));
483 
484  ast_sockaddr_parse(&addr_local, localaddr, 0);
485  ast_sockaddr_parse(&addr_remote, remoteaddr, 0);
486  ast_sockaddr_parse(&addr_expected, expectedaddr, 0);
487 
488  ast_security_event_report(AST_SEC_EVT(&unexpected_addr));
489 }
490 
491 static void evt_gen_chal_resp_failed(void)
492 {
493  struct ast_sockaddr addr_local = { {0,} };
494  struct ast_sockaddr addr_remote = { {0,} };
495 
496  struct timeval session_tv = ast_tvnow();
497  struct ast_security_event_chal_resp_failed chal_resp_failed = {
500  .common.service = "TEST",
501  .common.module = AST_MODULE,
502  .common.account_id = "SuperDuperUser",
503  .common.session_id = "Session1231231231",
504  .common.session_tv = &session_tv,
505  .common.local_addr = {
506  .addr = &addr_local,
507  .transport = AST_TRANSPORT_TCP,
508  },
509  .common.remote_addr = {
510  .addr = &addr_remote,
511  .transport = AST_TRANSPORT_TCP,
512  },
513 
514  .challenge = "8adf8a9sd8fas9df23ljk4",
515  .response = "9u3jlaksdjflakjsdfoi23",
516  .expected_response = "oiafaljhadf9834luahk3k",
517  };
518 
519  char localaddr[53];
520  char remoteaddr[53];
521 
522  ast_copy_string(localaddr, "10.1.2.3:4321", sizeof(localaddr));
523  ast_copy_string(remoteaddr, "10.1.2.4:1234", sizeof(remoteaddr));
524 
525  ast_sockaddr_parse(&addr_local, localaddr, 0);
526  ast_sockaddr_parse(&addr_remote, remoteaddr, 0);
527 
528  ast_security_event_report(AST_SEC_EVT(&chal_resp_failed));
529 }
530 
531 static void evt_gen_inval_password(void)
532 {
533  struct ast_sockaddr addr_local = { {0,} };
534  struct ast_sockaddr addr_remote = { {0,} };
535 
536  struct timeval session_tv = ast_tvnow();
537  struct ast_security_event_inval_password inval_password = {
540  .common.service = "TEST",
541  .common.module = AST_MODULE,
542  .common.account_id = "AccountIDGoesHere",
543  .common.session_id = "SessionIDGoesHere",
544  .common.session_tv = &session_tv,
545  .common.local_addr = {
546  .addr = &addr_local,
547  .transport = AST_TRANSPORT_TCP,
548  },
549  .common.remote_addr = {
550  .addr = &addr_remote,
551  .transport = AST_TRANSPORT_TCP,
552  },
553  .challenge = "GoOdChAlLeNgE",
554  .received_challenge = "BaDcHaLlEnGe",
555  .received_hash = "3ad9023adf309",
556  };
557 
558  char localaddr[53];
559  char remoteaddr[53];
560 
561  ast_copy_string(localaddr, "10.200.100.30:4321", sizeof(localaddr));
562  ast_copy_string(remoteaddr, "10.200.100.40:1234", sizeof(remoteaddr));
563 
564  ast_sockaddr_parse(&addr_local, localaddr, 0);
565  ast_sockaddr_parse(&addr_remote, remoteaddr, 0);
566 
567  ast_security_event_report(AST_SEC_EVT(&inval_password));
568 }
569 
570 static void evt_gen_chal_sent(void)
571 {
572  struct ast_sockaddr addr_local = { {0,} };
573  struct ast_sockaddr addr_remote = { {0,} };
574 
575  struct timeval session_tv = ast_tvnow();
576  struct ast_security_event_chal_sent chal_sent = {
578  .common.version = AST_SECURITY_EVENT_CHAL_SENT_VERSION,
579  .common.service = "TEST",
580  .common.module = AST_MODULE,
581  .common.account_id = "AccountIDGoesHere",
582  .common.session_id = "SessionIDGoesHere",
583  .common.session_tv = &session_tv,
584  .common.local_addr = {
585  .addr = &addr_local,
586  .transport = AST_TRANSPORT_TCP,
587  },
588  .common.remote_addr = {
589  .addr = &addr_remote,
590  .transport = AST_TRANSPORT_TCP,
591  },
592  .challenge = "IcHaLlEnGeYoU",
593  };
594 
595  char localaddr[53];
596  char remoteaddr[53];
597 
598  ast_copy_string(localaddr, "10.200.10.30:5392", sizeof(localaddr));
599  ast_copy_string(remoteaddr, "10.200.10.31:1443", sizeof(remoteaddr));
600 
601  ast_sockaddr_parse(&addr_local, localaddr, 0);
602  ast_sockaddr_parse(&addr_remote, remoteaddr, 0);
603 
605 }
606 
607 static void evt_gen_inval_transport(void)
608 {
609  struct ast_sockaddr addr_local = { {0,} };
610  struct ast_sockaddr addr_remote = { {0,} };
611 
612  struct timeval session_tv = ast_tvnow();
613  struct ast_security_event_inval_transport inval_transport = {
616  .common.service = "TEST",
617  .common.module = AST_MODULE,
618  .common.account_id = "AccountIDGoesHere",
619  .common.session_id = "SessionIDGoesHere",
620  .common.session_tv = &session_tv,
621  .common.local_addr = {
622  .addr = &addr_local,
623  .transport = AST_TRANSPORT_TCP,
624  },
625  .common.remote_addr = {
626  .addr = &addr_remote,
627  .transport = AST_TRANSPORT_TCP,
628  },
629  .transport = "UDP",
630  };
631 
632  char localaddr[53];
633  char remoteaddr[53];
634 
635  ast_copy_string(localaddr, "10.200.103.45:8223", sizeof(localaddr));
636  ast_copy_string(remoteaddr, "10.200.103.44:1039", sizeof(remoteaddr));
637 
638  ast_sockaddr_parse(&addr_local, localaddr, 0);
639  ast_sockaddr_parse(&addr_remote, remoteaddr, 0);
640 
641  ast_security_event_report(AST_SEC_EVT(&inval_transport));
642 }
643 
644 static void gen_events(struct ast_cli_args *a)
645 {
646  unsigned int i;
647 
648  ast_cli(a->fd, "Generating some security events ...\n");
649 
650  for (i = 0; i < ARRAY_LEN(evt_generators); i++) {
651  const char *event_type = ast_security_event_get_name(i);
652 
653  if (!evt_generators[i]) {
654  ast_cli(a->fd, "*** No event generator for event type '%s' ***\n",
655  event_type);
656  continue;
657  }
658 
659  ast_cli(a->fd, "Generating a '%s' security event ...\n", event_type);
660 
661  evt_generators[i]();
662  }
663 
664  ast_cli(a->fd, "Security event generation complete.\n");
665 }
666 
667 static char *handle_cli_sec_evt_test(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
668 {
669  switch (cmd) {
670  case CLI_INIT:
671  e->command = "securityevents test generation";
672  e->usage = ""
673  "Usage: securityevents test generation"
674  "";
675  return NULL;
676  case CLI_GENERATE:
677  return NULL;
678  case CLI_HANDLER:
679  gen_events(a);
680  return CLI_SUCCESS;
681  }
682 
683  return CLI_FAILURE;
684 }
685 
686 static struct ast_cli_entry cli_sec_evt[] = {
687  AST_CLI_DEFINE(handle_cli_sec_evt_test, "Test security event generation"),
688 };
689 
690 static int unload_module(void)
691 {
692  return ast_cli_unregister_multiple(cli_sec_evt, ARRAY_LEN(cli_sec_evt));
693 }
694 
695 static int load_module(void)
696 {
697  int res;
698 
699  res = ast_cli_register_multiple(cli_sec_evt, ARRAY_LEN(cli_sec_evt));
700 
702 }
703 
704 AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Test Security Event Generation");
An attempt at basic password authentication failed.
struct ast_security_event_common common
Common security event descriptor elements.
#define AST_CLI_DEFINE(fn, txt,...)
Definition: cli.h:197
enum ast_security_event_type event_type
The security event sub-type.
#define AST_MODULE_INFO_STANDARD(keystr, desc)
Definition: module.h:567
static int unload_module(void)
struct ast_security_event_common common
Common security event descriptor elements.
static struct ast_ha * localaddr
List of local networks We store "localnet" addresses from the config file into an access list...
Definition: chan_sip.c:1148
Asterisk main include file. File version handling, generic pbx functions.
#define ARRAY_LEN(a)
Definition: isdn_lib.c:42
FYI FWIW, Successful authentication has occurred.
Security Event Reporting API.
int ast_sockaddr_parse(struct ast_sockaddr *addr, const char *str, int flags)
Parse an IPv4 or IPv6 address string.
Definition: netsock2.c:230
int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len)
Unregister multiple commands.
Definition: clicompat.c:30
#define AST_SECURITY_EVENT_REQ_NO_SUPPORT_VERSION
Event descriptor version.
static void evt_gen_chal_resp_failed(void)
const char * ast_security_event_get_name(const enum ast_security_event_type event_type)
Get the name of a security event sub-type.
An attempt at challenge/response auth failed.
descriptor for a cli entry.
Definition: cli.h:171
static void evt_gen_auth_method_not_allowed(void)
#define AST_SECURITY_EVENT_CHAL_SENT_VERSION
Event descriptor version.
Request denied because we don&#39;t support it.
Checking against an IP access control list failed.
Definition: cli.h:152
struct ast_security_event_common common
Common security event descriptor elements.
static void evt_gen_failed_acl(void)
The attempted authentication method is not allowed.
A challenge was sent out.
#define ast_cli_register_multiple(e, len)
Register multiple commands.
Definition: cli.h:265
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
Definition: time.h:150
Unexpected source address for a session in progress.
struct ast_security_event_common common
Common security event descriptor elements.
A request was made that is not allowed.
struct ast_security_event_common common
Common security event descriptor elements.
static void evt_gen_inval_transport(void)
#define NULL
Definition: resample.c:96
void ast_cli(int fd, const char *fmt,...)
Definition: clicompat.c:6
#define AST_SECURITY_EVENT_SUCCESSFUL_AUTH_VERSION
Event descriptor version.
An unexpected source address was seen for a session in progress.
struct ast_security_event_common common
Common security event descriptor elements.
Socket address structure.
Definition: netsock2.h:97
#define AST_SEC_EVT(e)
#define AST_SECURITY_EVENT_UNEXPECTED_ADDR_VERSION
Event descriptor version.
Utility functions.
static void gen_events(struct ast_cli_args *a)
An attempt at basic password auth failed.
const int fd
Definition: cli.h:159
Request received with bad formatting.
Request denied because of a session limit.
static void evt_gen_inval_acct_id(void)
#define AST_SECURITY_EVENT_FAILED_ACL_VERSION
Event descriptor version.
static void evt_gen_successful_auth(void)
Challenge was sent out, informational.
struct ast_security_event_common common
Common security event descriptor elements.
struct ast_security_event_common common
Common security event descriptor elements.
static void evt_gen_req_no_support(void)
#define AST_SECURITY_EVENT_AUTH_METHOD_NOT_ALLOWED_VERSION
Event descriptor version.
#define AST_SECURITY_EVENT_MEM_LIMIT_VERSION
Event descriptor version.
Network socket handling.
void(* evt_generator)(void)
static void evt_gen_inval_password(void)
Attempt to contact peer on invalid transport.
#define AST_SECURITY_EVENT_INVAL_ACCT_ID_VERSION
Event descriptor version.
struct ast_security_event_common common
Common security event descriptor elements.
Request denied because of a memory limit.
static void evt_gen_mem_limit(void)
struct ast_security_event_common common
Common security event descriptor elements.
static void evt_gen_session_limit(void)
Load Average limit reached.
Request denied because of a load average limit.
An attempt at challenge/response authentication failed.
static char * handle_cli_sec_evt_test(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static void evt_gen_req_bad_format(void)
#define CLI_FAILURE
Definition: cli.h:46
static const evt_generator evt_generators[AST_SECURITY_EVENT_NUM_TYPES]
char * command
Definition: cli.h:186
struct ast_security_event_common common
Common security event descriptor elements.
Module has failed to load, may be in an inconsistent state.
Definition: module.h:78
struct ast_security_event_common common
Common security event descriptor elements.
static int load_module(void)
This must stay at the end.
#define AST_SECURITY_EVENT_LOAD_AVG_VERSION
Event descriptor version.
const char * usage
Definition: cli.h:177
Invalid account ID specified (invalid username, for example)
static struct ast_cli_entry cli_sec_evt[]
#define CLI_SUCCESS
Definition: cli.h:44
struct ast_security_event_common common
Common security event descriptor elements.
struct ast_security_event_common common
Common security event descriptor elements.
#define AST_SECURITY_EVENT_INVAL_PASSWORD_VERSION
Event descriptor version.
static void evt_gen_unexpected_addr(void)
#define AST_SECURITY_EVENT_INVAL_TRANSPORT_VERSION
Event descriptor version.
Standard Command Line Interface.
struct ast_security_event_common common
Common security event descriptor elements.
#define AST_MODULE
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Definition: strings.h:401
#define AST_SECURITY_EVENT_REQ_BAD_FORMAT_VERSION
Event descriptor version.
#define AST_SECURITY_EVENT_CHAL_RESP_FAILED_VERSION
Event descriptor version.
static void evt_gen_chal_sent(void)
Invalid formatting of request.
int ast_security_event_report(const struct ast_security_event_common *sec)
Report a security event.
#define ASTERISK_GPL_KEY
The text the key() function should return.
Definition: module.h:46
Asterisk module definitions.
static void evt_gen_load_avg(void)
#define AST_SECURITY_EVENT_SESSION_LIMIT_VERSION
Event descriptor version.
Request denied because it&#39;s not allowed.
An attempt to contact a peer on an invalid transport.
#define AST_SECURITY_EVENT_REQ_NOT_ALLOWED_VERSION
Event descriptor version.
A request was made that we understand, but do not support.
static void evt_gen_req_not_allowed(void)
static struct test_val a