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" An attempt at basic password authentication failed.
struct ast_security_event_common common
Common security event descriptor elements.
#define AST_CLI_DEFINE(fn, txt,...)
enum ast_security_event_type event_type
The security event sub-type.
#define AST_MODULE_INFO_STANDARD(keystr, desc)
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...
Asterisk main include file. File version handling, generic pbx functions.
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.
int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len)
Unregister multiple commands.
#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.
static void evt_gen_auth_method_not_allowed(void)
#define AST_SECURITY_EVENT_CHAL_SENT_VERSION
Event descriptor version.
Request denied because we don't support it.
Checking against an IP access control list failed.
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.
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
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.
static void evt_gen_inval_transport(void)
void ast_cli(int fd, const char *fmt,...)
#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.
#define AST_SECURITY_EVENT_UNEXPECTED_ADDR_VERSION
Event descriptor version.
static void gen_events(struct ast_cli_args *a)
An attempt at basic password auth failed.
Request received with bad formatting.
Request denied because of a session limit.
static void evt_gen_inval_acct_id(void)
Successful authentication.
#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.
void(* evt_generator)(void)
Auth method used not allowed.
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)
static const evt_generator evt_generators[AST_SECURITY_EVENT_NUM_TYPES]
struct ast_security_event_common common
Common security event descriptor elements.
Module has failed to load, may be in an inconsistent state.
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.
Invalid account ID specified (invalid username, for example)
static struct ast_cli_entry cli_sec_evt[]
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.
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
#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)
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.
Asterisk module definitions.
static void evt_gen_load_avg(void)
#define AST_SECURITY_EVENT_SESSION_LIMIT_VERSION
Event descriptor version.
Request denied because it'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)