83 .common.service =
"TEST",
85 .common.account_id =
"Username",
86 .common.session_id =
"Session123",
87 .common.session_tv = &session_tv,
88 .common.local_addr = {
92 .common.remote_addr = {
97 .acl_name =
"TEST_ACL",
121 .common.service =
"TEST",
123 .common.account_id =
"FakeUser",
124 .common.session_id =
"Session456",
125 .common.session_tv = &session_tv,
126 .common.local_addr = {
130 .common.remote_addr = {
131 .addr = &addr_remote,
157 .common.service =
"TEST",
159 .common.account_id =
"Jenny",
160 .common.session_id =
"8675309",
161 .common.session_tv = &session_tv,
162 .common.local_addr = {
166 .common.remote_addr = {
167 .addr = &addr_remote,
193 .common.service =
"TEST",
195 .common.account_id =
"Felix",
196 .common.session_id =
"Session2604",
197 .common.session_tv = &session_tv,
198 .common.local_addr = {
202 .common.remote_addr = {
203 .addr = &addr_remote,
229 .common.service =
"TEST",
231 .common.account_id =
"GuestAccount",
232 .common.session_id =
"XYZ123",
233 .common.session_tv = &session_tv,
234 .common.local_addr = {
238 .common.remote_addr = {
239 .addr = &addr_remote,
265 .common.service =
"TEST",
267 .common.account_id =
"George",
268 .common.session_id =
"asdkl23478289lasdkf",
269 .common.session_tv = &session_tv,
270 .common.local_addr = {
274 .common.remote_addr = {
275 .addr = &addr_remote,
279 .request_type =
"MakeMeDinner",
286 ast_copy_string(remoteaddr,
"10.120.110.100:9777",
sizeof(remoteaddr));
303 .common.service =
"TEST",
305 .common.account_id =
"George",
306 .common.session_id =
"alksdjf023423h4lka0df",
307 .common.session_tv = &session_tv,
308 .common.local_addr = {
312 .common.remote_addr = {
313 .addr = &addr_remote,
317 .request_type =
"MakeMeBreakfast",
318 .request_params =
"BACONNNN!",
325 ast_copy_string(remoteaddr,
"10.120.110.100:9777",
sizeof(remoteaddr));
342 .common.service =
"TEST",
344 .common.account_id =
"Bob",
345 .common.session_id =
"010101010101",
346 .common.session_tv = &session_tv,
347 .common.local_addr = {
351 .common.remote_addr = {
352 .addr = &addr_remote,
356 .auth_method =
"PlainText"
363 ast_copy_string(remoteaddr,
"10.120.110.105:8745",
sizeof(remoteaddr));
380 .common.service =
"TEST",
382 .common.account_id =
"Larry",
383 .common.session_id =
"838383fhfhf83hf8h3f8h",
384 .common.session_tv = &session_tv,
385 .common.local_addr = {
389 .common.remote_addr = {
390 .addr = &addr_remote,
394 .request_type =
"CheeseBurger",
395 .request_params =
"Onions,Swiss,MotorOil",
402 ast_copy_string(remoteaddr,
"10.120.210.200:2121",
sizeof(remoteaddr));
419 .common.service =
"TEST",
421 .common.account_id =
"ValidUser",
422 .common.session_id =
"Session456",
423 .common.session_tv = &session_tv,
424 .common.local_addr = {
428 .common.remote_addr = {
429 .addr = &addr_remote,
456 .common.service =
"TEST",
458 .common.account_id =
"CoolUser",
459 .common.session_id =
"Session789",
460 .common.session_tv = &session_tv,
461 .common.local_addr = {
465 .common.remote_addr = {
466 .addr = &addr_remote,
471 .addr = &addr_expected,
478 char expectedaddr[53];
500 .common.service =
"TEST",
502 .common.account_id =
"SuperDuperUser",
503 .common.session_id =
"Session1231231231",
504 .common.session_tv = &session_tv,
505 .common.local_addr = {
509 .common.remote_addr = {
510 .addr = &addr_remote,
514 .challenge =
"8adf8a9sd8fas9df23ljk4",
515 .response =
"9u3jlaksdjflakjsdfoi23",
516 .expected_response =
"oiafaljhadf9834luahk3k",
540 .common.service =
"TEST",
542 .common.account_id =
"AccountIDGoesHere",
543 .common.session_id =
"SessionIDGoesHere",
544 .common.session_tv = &session_tv,
545 .common.local_addr = {
549 .common.remote_addr = {
550 .addr = &addr_remote,
553 .challenge =
"GoOdChAlLeNgE",
554 .received_challenge =
"BaDcHaLlEnGe",
555 .received_hash =
"3ad9023adf309",
579 .common.service =
"TEST",
581 .common.account_id =
"AccountIDGoesHere",
582 .common.session_id =
"SessionIDGoesHere",
583 .common.session_tv = &session_tv,
584 .common.local_addr = {
588 .common.remote_addr = {
589 .addr = &addr_remote,
592 .challenge =
"IcHaLlEnGeYoU",
616 .common.service =
"TEST",
618 .common.account_id =
"AccountIDGoesHere",
619 .common.session_id =
"SessionIDGoesHere",
620 .common.session_tv = &session_tv,
621 .common.local_addr = {
625 .common.remote_addr = {
626 .addr = &addr_remote,
648 ast_cli(
a->fd,
"Generating some security events ...\n");
654 ast_cli(
a->fd,
"*** No event generator for event type '%s' ***\n",
659 ast_cli(
a->fd,
"Generating a '%s' security event ...\n", event_type);
664 ast_cli(
a->fd,
"Security event generation complete.\n");
671 e->
command =
"securityevents test generation";
673 "Usage: securityevents test generation"
Asterisk main include file. File version handling, generic pbx functions.
Standard Command Line Interface.
int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len)
Unregister multiple commands.
#define AST_CLI_DEFINE(fn, txt,...)
void ast_cli(int fd, const char *fmt,...)
#define ast_cli_register_multiple(e, len)
Register multiple commands.
Asterisk module definitions.
#define AST_MODULE_INFO_STANDARD(keystr, desc)
#define ASTERISK_GPL_KEY
The text the key() function should return.
@ AST_MODULE_LOAD_SUCCESS
@ AST_MODULE_LOAD_DECLINE
Module has failed to load, may be in an inconsistent state.
int ast_sockaddr_parse(struct ast_sockaddr *addr, const char *str, int flags)
Parse an IPv4 or IPv6 address string.
Security Event Reporting API.
const char * ast_security_event_get_name(const enum ast_security_event_type event_type)
Get the name of a security event sub-type.
int ast_security_event_report(const struct ast_security_event_common *sec)
Report a security event.
#define AST_SECURITY_EVENT_CHAL_RESP_FAILED_VERSION
Event descriptor version.
#define AST_SECURITY_EVENT_UNEXPECTED_ADDR_VERSION
Event descriptor version.
#define AST_SECURITY_EVENT_MEM_LIMIT_VERSION
Event descriptor version.
#define AST_SECURITY_EVENT_SESSION_LIMIT_VERSION
Event descriptor version.
#define AST_SECURITY_EVENT_REQ_NO_SUPPORT_VERSION
Event descriptor version.
#define AST_SECURITY_EVENT_INVAL_TRANSPORT_VERSION
Event descriptor version.
#define AST_SECURITY_EVENT_AUTH_METHOD_NOT_ALLOWED_VERSION
Event descriptor version.
#define AST_SECURITY_EVENT_REQ_NOT_ALLOWED_VERSION
Event descriptor version.
#define AST_SECURITY_EVENT_REQ_BAD_FORMAT_VERSION
Event descriptor version.
#define AST_SECURITY_EVENT_FAILED_ACL_VERSION
Event descriptor version.
#define AST_SECURITY_EVENT_INVAL_PASSWORD_VERSION
Event descriptor version.
#define AST_SECURITY_EVENT_INVAL_ACCT_ID_VERSION
Event descriptor version.
@ 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.
#define AST_SECURITY_EVENT_LOAD_AVG_VERSION
Event descriptor version.
#define AST_SECURITY_EVENT_SUCCESSFUL_AUTH_VERSION
Event descriptor version.
#define AST_SECURITY_EVENT_CHAL_SENT_VERSION
Event descriptor version.
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
descriptor for a cli entry.
Auth method used not allowed.
struct ast_security_event_common common
Common security event descriptor elements.
An attempt at challenge/response auth failed.
struct ast_security_event_common common
Common security event descriptor elements.
A challenge was sent out.
struct ast_security_event_common common
Common security event descriptor elements.
enum ast_security_event_type event_type
The security event sub-type.
Checking against an IP access control list failed.
struct ast_security_event_common common
Common security event descriptor elements.
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.
Attempt to contact peer on invalid transport.
struct ast_security_event_common common
Common security event descriptor elements.
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.
Request denied because we don't support it.
struct ast_security_event_common common
Common security event descriptor elements.
Request denied because it's not allowed.
struct ast_security_event_common common
Common security event descriptor elements.
Request denied because of a session limit.
Successful authentication.
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.
Socket address structure.
static void evt_gen_inval_password(void)
void(* evt_generator)(void)
static void evt_gen_session_limit(void)
static void evt_gen_mem_limit(void)
static void evt_gen_unexpected_addr(void)
static void evt_gen_chal_resp_failed(void)
static void evt_gen_chal_sent(void)
static void evt_gen_auth_method_not_allowed(void)
static const evt_generator evt_generators[AST_SECURITY_EVENT_NUM_TYPES]
static void gen_events(struct ast_cli_args *a)
static void evt_gen_load_avg(void)
static void evt_gen_successful_auth(void)
static void evt_gen_failed_acl(void)
static void evt_gen_req_not_allowed(void)
static int load_module(void)
static struct ast_cli_entry cli_sec_evt[]
static int unload_module(void)
static void evt_gen_inval_acct_id(void)
static char * handle_cli_sec_evt_test(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static void evt_gen_req_no_support(void)
static void evt_gen_req_bad_format(void)
static void evt_gen_inval_transport(void)
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().