50 .common.service =
"SIP",
51 .common.account_id = p->
exten,
52 .common.local_addr = {
56 .common.remote_addr = {
60 .common.session_id = session_id,
63 snprintf(session_id,
sizeof(session_id),
"%p", p);
75 .common.service =
"SIP",
76 .common.account_id = p->
exten,
77 .common.local_addr = {
81 .common.remote_addr = {
85 .common.session_id = session_id,
89 snprintf(session_id,
sizeof(session_id),
"%p", p);
101 .common.service =
"SIP",
102 .common.account_id = p->
exten,
103 .common.local_addr = {
107 .common.remote_addr = {
111 .common.session_id = session_id,
113 .challenge = p->
nonce,
114 .received_challenge = response_challenge,
115 .received_hash = response_hash,
118 snprintf(session_id,
sizeof(session_id),
"%p", p);
130 .common.service =
"SIP",
131 .common.account_id = p->
exten,
132 .common.local_addr = {
136 .common.remote_addr = {
140 .common.session_id = session_id,
144 snprintf(session_id,
sizeof(session_id),
"%p", p);
156 .common.service =
"SIP",
157 .common.account_id = p->
exten,
158 .common.local_addr = {
162 .common.remote_addr = {
166 .common.session_id = session_id,
169 snprintf(session_id,
sizeof(session_id),
"%p", p);
177 char account_id[256];
182 .common.service =
"SIP",
183 .common.account_id = account_id,
184 .common.local_addr = {
188 .common.remote_addr = {
192 .common.session_id = session_id,
194 .challenge = p->
nonce,
205 snprintf(session_id,
sizeof(session_id),
"%p", p);
213 char account_id[256];
218 .common.service =
"SIP",
219 .common.account_id = account_id,
220 .common.local_addr = {
224 .common.remote_addr = {
228 .common.session_id = session_id,
230 .challenge = p->
nonce,
239 snprintf(session_id,
sizeof(session_id),
"%p", p);
251 .common.service =
"SIP",
252 .common.account_id = p->
exten,
253 .common.local_addr = {
257 .common.remote_addr = {
261 .common.session_id = session_id,
266 snprintf(session_id,
sizeof(session_id),
"%p", p);
279 const char *authtoken;
280 char *reqheader, *respheader;
284 [
K_RESP] = {
"response=",
"" },
285 [
K_URI] = {
"uri=",
"" },
286 [
K_USER] = {
"username=",
"" },
331 snprintf(aclname,
sizeof(aclname),
"domain_must_match");
335 snprintf(aclname,
sizeof(aclname),
"peer_not_dynamic");
340 snprintf(aclname,
sizeof(aclname),
"device_must_match_acl");
354 sip_unref_peer(peer_report,
"sip_report_security_event: sip_unref_peer: from handle_incoming");
const char * sip_get_header(const struct sip_request *req, const char *name)
Get header from SIP request.
uint32_t using_password
Using password - if a password was used or not.
An attempt at basic password authentication failed.
enum ast_security_event_type event_type
The security event sub-type.
struct ast_security_event_common common
Common security event descriptor elements.
Asterisk main include file. File version handling, generic pbx functions.
Generate security events in the SIP channel.
FYI FWIW, Successful authentication has occurred.
struct sip_peer * sip_find_peer(const char *peer, struct ast_sockaddr *addr, int realtime, int which_objects, int devstate_only, int transport)
Locate device by name or ip address.
const char * expected_response
Response expected to be received.
void sip_auth_headers(enum sip_auth_type code, char **header, char **respheader)
return the request and response header for a 401 or 407 code
static struct ast_threadstorage check_auth_buf
An attempt at challenge/response auth failed.
const char * transport
Attempted transport.
void sip_report_auth_success(const struct sip_pvt *p, uint32_t using_password)
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
void sip_report_inval_transport(const struct sip_pvt *p, const char *transport)
void sip_report_invalid_peer(const struct sip_pvt *p)
#define AST_SECURITY_EVENT_CHAL_SENT_VERSION
Event descriptor version.
const char * sip_get_transport(enum ast_transport t)
Return transport as string.
Checking against an IP access control list failed.
struct ast_sockaddr ourip
check_auth_result
Authentication result from check_auth* functions.
struct ast_security_event_common common
Common security event descriptor elements.
void sip_report_failed_challenge_response(const struct sip_pvt *p, const char *response, const char *expected_response)
A challenge was sent out.
const char * response
Response received.
const ast_string_field from
struct ast_security_event_common common
Common security event descriptor elements.
static enum ast_transport security_event_get_transport(const struct sip_pvt *p)
Determine transport type used to receive request.
#define AST_SECURITY_EVENT_SUCCESSFUL_AUTH_VERSION
Event descriptor version.
Socket address structure.
const ast_string_field nonce
#define ast_strlen_zero(foo)
void sip_digest_parser(char *c, struct digestkeys *keys)
Takes the digest response and parses it.
int ast_str_set(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Set a dynamic string using variable arguments.
An attempt at basic password auth failed.
int sip_report_security_event(const char *peer, struct ast_sockaddr *addr, const struct sip_pvt *p, const struct sip_request *req, const int res)
Request denied because of a session limit.
Successful authentication.
const ast_string_field exten
#define AST_SECURITY_EVENT_FAILED_ACL_VERSION
Event descriptor version.
const ast_string_field username
Challenge was sent out, informational.
struct ast_security_event_common common
Common security event descriptor elements.
const ast_string_field md5secret
struct ast_security_event_common common
Common security event descriptor elements.
void sip_report_session_limit(const struct sip_pvt *p)
Attempt to contact peer on invalid transport.
#define AST_SECURITY_EVENT_INVAL_ACCT_ID_VERSION
Event descriptor version.
The descriptor of a dynamic string XXX storage will be optimized later if needed We use the ts field ...
An attempt at challenge/response authentication failed.
Structure used for each SIP dialog, ie. a call, a registration, a subscribe. Created and initialized ...
#define sip_unref_peer(peer, tag)
Structure for SIP peer data, we place calls to peers if registered or fixed IP address (host) ...
struct ast_security_event_common common
Common security event descriptor elements.
sip_request: The data grabbed from the UDP socket
Invalid account ID specified (invalid username, for example)
void sip_report_chal_sent(const struct sip_pvt *p)
struct ast_security_event_common common
Common security event descriptor elements.
#define AST_SECURITY_EVENT_INVAL_PASSWORD_VERSION
Event descriptor version.
#define AST_SECURITY_EVENT_INVAL_TRANSPORT_VERSION
Event descriptor version.
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.
const ast_string_field secret
void sip_report_inval_password(const struct sip_pvt *p, const char *response_challenge, const char *response_hash)
void sip_report_failed_acl(const struct sip_pvt *p, const char *aclname)
#define AST_SECURITY_EVENT_CHAL_RESP_FAILED_VERSION
Event descriptor version.
struct ast_str * ast_str_thread_get(struct ast_threadstorage *ts, size_t init_len)
Retrieve a thread locally stored dynamic string.
int ast_security_event_report(const struct ast_security_event_common *sec)
Report a security event.
#define CHECK_AUTH_BUF_INITLEN
#define AST_SECURITY_EVENT_SESSION_LIMIT_VERSION
Event descriptor version.
An attempt to contact a peer on an invalid transport.