mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-02 11:58:40 +00:00
AST-2022-002 - res_stir_shaken/curl: Add ACL checks for Identity header.
Adds a new configuration option, stir_shaken_profile, in pjsip.conf that can be specified on a per endpoint basis. This option will reference a stir_shaken_profile that can be configured in stir_shaken.conf. The type of this option must be 'profile'. The stir_shaken option can be specified on this object with the same values as before (attest, verify, on), but it cannot be off since having the profile itself implies wanting STIR/SHAKEN support. You can also specify an ACL from acl.conf (along with permit and deny lines in the object itself) that will be used to limit what interfaces Asterisk will attempt to retrieve information from when reading the Identity header. ASTERISK-29476 Change-Id: I87fa61f78a9ea0cd42530691a30da3c781842406
This commit is contained in:
@@ -217,13 +217,16 @@ static int stir_shaken_incoming_request(struct ast_sip_session *session, pjsip_r
|
||||
int mismatch = 0;
|
||||
struct ast_stir_shaken_payload *ss_payload;
|
||||
int failure_code = 0;
|
||||
RAII_VAR(struct stir_shaken_profile *, profile, NULL, ao2_cleanup);
|
||||
|
||||
/* Check if this is a reinvite. If it is, we don't need to do anything */
|
||||
if (rdata->msg_info.to->tag.slen) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((session->endpoint->stir_shaken & AST_SIP_STIR_SHAKEN_VERIFY) == 0) {
|
||||
profile = ast_stir_shaken_get_profile(session->endpoint->stir_shaken_profile);
|
||||
if ((profile && !ast_stir_shaken_profile_supports_verification(profile))
|
||||
&& ((session->endpoint->stir_shaken & AST_SIP_STIR_SHAKEN_VERIFY) == 0)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -309,7 +312,8 @@ static int stir_shaken_incoming_request(struct ast_sip_session *session, pjsip_r
|
||||
|
||||
attestation = get_attestation_from_payload(payload);
|
||||
|
||||
ss_payload = ast_stir_shaken_verify2(header, payload, signature, algorithm, public_cert_url, &failure_code);
|
||||
ss_payload = ast_stir_shaken_verify_with_profile(header, payload, signature, algorithm, public_cert_url, &failure_code, profile);
|
||||
|
||||
if (!ss_payload) {
|
||||
|
||||
if (failure_code == AST_STIR_SHAKEN_VERIFY_FAILED_TO_GET_CERT) {
|
||||
@@ -471,7 +475,11 @@ static void add_date_header(const struct ast_sip_session *session, pjsip_tx_data
|
||||
|
||||
static void stir_shaken_outgoing_request(struct ast_sip_session *session, pjsip_tx_data *tdata)
|
||||
{
|
||||
if ((session->endpoint->stir_shaken & AST_SIP_STIR_SHAKEN_ATTEST) == 0) {
|
||||
RAII_VAR(struct stir_shaken_profile *, profile, NULL, ao2_cleanup);
|
||||
|
||||
profile = ast_stir_shaken_get_profile(session->endpoint->stir_shaken_profile);
|
||||
if ((profile && !ast_stir_shaken_profile_supports_attestation(profile))
|
||||
&& ((session->endpoint->stir_shaken & AST_SIP_STIR_SHAKEN_ATTEST) == 0)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user