| 1 |
;-- |
| 2 |
|
| 3 |
There are 4 object types used by the STIR/SHAKEN process... |
| 4 |
|
| 5 |
The "attestation" object sets the parameters for creating an Identity |
| 6 |
header which attests to the ownership of the caller id on outgoing |
| 7 |
INVITE requests. |
| 8 |
|
| 9 |
One or more "tn" objects that are used to create the outgoing Identity |
| 10 |
header. Each object's "id" is a specific caller-id telephone number |
| 11 |
and the object contains the URL to the certificate that was used to |
| 12 |
attest to the ownership of the caller-id, the level (A,B,C) of the |
| 13 |
attestation you're making, and the private key the asterisk |
| 14 |
attestation service will use to sign the Identity header. When |
| 15 |
an outgoing INVITE request is placed, the attestation service will |
| 16 |
look up the caller-id in the tn object list and if it's found, use |
| 17 |
the information in the object to create the Identity header. |
| 18 |
|
| 19 |
The "verification" object sets the parameters for verification |
| 20 |
of the Identity header and caller id on incoming INVITE requests. |
| 21 |
|
| 22 |
One or more "profile" objects that can be associated to channel |
| 23 |
driver endpoints (currently only chan_pjsip). Profiles can set |
| 24 |
whether verification, attestation, both or neither should be |
| 25 |
performed on requests coming in to this endpoint or requests |
| 26 |
going out from this endpoint. Additionally they can override |
| 27 |
most of the attestation and verification options to make them |
| 28 |
specific to an endpoint. When Asterisk loads the configs, it |
| 29 |
creates "effective profiles" or "eprofiles" on the fly that are |
| 30 |
the amalgamation of the attestation, verification and profile. |
| 31 |
You can see them in the CLI with "stir_shaken show eprofiles". |
| 32 |
|
| 33 |
NOTE: The "tn" object can be configured to source its data from a |
| 34 |
realtime database by configuring sorcery.conf and extconfig.conf. |
| 35 |
Both of those files have examples for "stir_tn". There is also an |
| 36 |
Alembic script in the "config" section of contrib/ast-db-manage that |
| 37 |
will create the table. Since there can be only one "verification" |
| 38 |
or "attestation" object, and will probably be only a few "profile" |
| 39 |
objects, those objects aren't realtime enabled. |
| 40 |
|
| 41 |
--; |
| 42 |
|
| 43 |
;-- |
| 44 |
======================================================================= |
| 45 |
Attestation Object Description |
| 46 |
======================================================================= |
| 47 |
The "attestation" object sets the parameters for creating an Identity |
| 48 |
header which attests to the ownership of the caller id on outgoing |
| 49 |
INVITE requests. |
| 50 |
|
| 51 |
All parameters except 'global_disable" may be overridden in a "profile" |
| 52 |
or "tn" object. |
| 53 |
|
| 54 |
Only one "attestation" object may exist. |
| 55 |
|
| 56 |
Parameters: |
| 57 |
|
| 58 |
-- global_disable ----------------------------------------------------- |
| 59 |
If set, globally disables the attestation service. No Identity headers |
| 60 |
will be added to any outgoing INVITE requests. |
| 61 |
|
| 62 |
Default: no |
| 63 |
|
| 64 |
-- private_key_file --------------------------------------------------- |
| 65 |
The path to a file containing the private key you received from the |
| 66 |
issuing authority. The file must NOT be group or world readable or |
| 67 |
writable so make sure the user the asterisk process is running as is |
| 68 |
the owner. |
| 69 |
|
| 70 |
Default: none |
| 71 |
|
| 72 |
-- public_cert_url ---------------------------------------------------- |
| 73 |
The URL to the certificate you received from the issueing authority. |
| 74 |
They may give you a URL to use or you may have to host the certificate |
| 75 |
yourself and provide your own URL here. |
| 76 |
|
| 77 |
Default: none |
| 78 |
|
| 79 |
WARNING: Make absolutely sure the file that's made public doesn't |
| 80 |
accidentally include the privite key as well as the certificate. |
| 81 |
If you set "check_tn_cert_public_url" in the "attestation" section |
| 82 |
above, the tn will not be loaded and a "DANGER" message will be output |
| 83 |
on the asterisk console if the file does contain a private key. |
| 84 |
|
| 85 |
-- check_tn_cert_public_url ------------------------------------------- |
| 86 |
Identity headers in outgoing requests must contain a URL that points |
| 87 |
to the certificate used to sign the header. Setting this parameter |
| 88 |
tells Asterisk to actually try to retrieve the certificates indicated |
| 89 |
by "public_cert_url" parameters and fail loading that tn if the cert |
| 90 |
can't be retrieved or if its 'Not Valid Before" -> 'Not Valid After" |
| 91 |
date range doesn't include today. This is a network intensive process |
| 92 |
so use with caution. |
| 93 |
|
| 94 |
Default: no |
| 95 |
|
| 96 |
-- attest_level ------------------------------------------------------- |
| 97 |
The level of the attestation you're making. |
| 98 |
One of "A", "B", "C" |
| 99 |
|
| 100 |
Default: none |
| 101 |
|
| 102 |
-- unknown_tn_attest_level -------------------------------------------- |
| 103 |
Attestation level to use for unknown TNs. |
| 104 |
One of "A", "B", "C" |
| 105 |
|
| 106 |
Normally if a callerid TN isn't configured in stir_shaken.conf |
| 107 |
no Identity header will be created. If this option is set, |
| 108 |
however, an Identity header will be sent using this |
| 109 |
attestation level. Since there's no TN object, you must |
| 110 |
ensure that a private_key_file and public_cert_url are |
| 111 |
configured in the attestation or profile objects for |
| 112 |
this to work. |
| 113 |
|
| 114 |
Default: none |
| 115 |
|
| 116 |
-- send_mky ----------------------------------------------------------- |
| 117 |
If set and an outgoing call uses DTLS, an "mky" Media Key grant will |
| 118 |
be added to the Identity header. Although RFC8224/8225 require this, |
| 119 |
not many implementations support it so a remote verification service |
| 120 |
may fail to verify the signature. |
| 121 |
|
| 122 |
Default: no |
| 123 |
|
| 124 |
----------------------------------------------------------------------- |
| 125 |
Example "attestation" object: |
| 126 |
--; |
| 127 |
|
| 128 |
;[attestation] |
| 129 |
;global_disable = no |
| 130 |
;private_key_file = /var/lib/asterisk/keys/stir_shaken/tns/multi-tns-key.pem |
| 131 |
;public_cert_url = https://example.com/tncerts/multi-tns-cert.pem |
| 132 |
;attest_level = C |
| 133 |
;unknown_tn_attest_level = C |
| 134 |
|
| 135 |
;-- |
| 136 |
======================================================================= |
| 137 |
TN Object Description |
| 138 |
======================================================================= |
| 139 |
Each "tn" object contains the parameters needed to create the Identity |
| 140 |
header used to attest to the ownership of the caller-id on outgoing |
| 141 |
requests. When an outgoing INVITE request is placed, the attestation |
| 142 |
service will look up the caller-id in this list and if it's found, use |
| 143 |
the information in the object to create the Identity header. |
| 144 |
The private key and certificate needed to sign the Identity header are |
| 145 |
usually provided to you by the telephone number issuing authority along |
| 146 |
with their certificate authority certificate. You should give the CA |
| 147 |
certificate to any recipients who expect to receive calls from you |
| 148 |
although this has probably already been done by the issuing authority. |
| 149 |
|
| 150 |
The "id" of this object MUST be a canonicalized telephone number which |
| 151 |
starts with a country code. The only valid characters are the numbers |
| 152 |
0-9, '#' and '*'. |
| 153 |
|
| 154 |
Parameters: |
| 155 |
|
| 156 |
-- type (required) ---------------------------------------------------- |
| 157 |
Must be set to "tn" |
| 158 |
|
| 159 |
Default: none |
| 160 |
|
| 161 |
-- private_key_file --------------------------------------------------- |
| 162 |
The path to a file containing the private key you received from the |
| 163 |
issuing authority. The file must NOT be group or world readable or |
| 164 |
writable so make sure the user the asterisk process is running as is |
| 165 |
the owner. |
| 166 |
|
| 167 |
Default: private_key_file from the profile or attestation objects. |
| 168 |
|
| 169 |
-- public_cert_url ---------------------------------------------------- |
| 170 |
The URL to the certificate you received from the issueing authority. |
| 171 |
They may give you a URL to use or you may have to host the certificate |
| 172 |
yourself and provide your own URL here. |
| 173 |
|
| 174 |
Default: public_cert_url from the profile or attestation objects. |
| 175 |
|
| 176 |
WARNING: Make absolutely sure the file that's made public doesn't |
| 177 |
accidentally include the privite key as well as the certificate. |
| 178 |
If you set "check_tn_cert_public_url" in the "attestation" section |
| 179 |
above, the tn will not be loaded and a "DANGER" message will be output |
| 180 |
on the asterisk console if the file does contain a private key. |
| 181 |
|
| 182 |
-- attest_level ------------------------------------------------------- |
| 183 |
The level of the attestation you're making. |
| 184 |
One of "A", "B", "C" |
| 185 |
|
| 186 |
Default: attest_level from the profile or attestation objects. |
| 187 |
|
| 188 |
----------------------------------------------------------------------- |
| 189 |
Example "tn" object: |
| 190 |
--; |
| 191 |
|
| 192 |
;[18005551515] |
| 193 |
;type = tn |
| 194 |
;private_key_file = /var/lib/asterisk/keys/stir_shaken/tns/18005551515-key.pem |
| 195 |
;public_cert_url = https://example.com/tncerts/18005551515-cert.pem |
| 196 |
;attest_level = C |
| 197 |
|
| 198 |
;-- |
| 199 |
======================================================================= |
| 200 |
Verification Object Description |
| 201 |
======================================================================= |
| 202 |
The "verification" object sets the parameters for verification |
| 203 |
of the Identity header on incoming INVITE requests. |
| 204 |
|
| 205 |
All parameters except 'global_disable" may be overridden in a "profile" |
| 206 |
object. |
| 207 |
|
| 208 |
Only one "verification" object may exist. |
| 209 |
|
| 210 |
Parameters: |
| 211 |
|
| 212 |
-- global_disable ----------------------------------------------------- |
| 213 |
If set, globally disables the verification service. |
| 214 |
|
| 215 |
Default: no |
| 216 |
|
| 217 |
-- load_system_certs--------------------------------------------------- |
| 218 |
If set, loads the system Certificate Authority certificates |
| 219 |
(usually located in /etc/pki/CA) into the trust store used to |
| 220 |
validate the certificates in incoming requests. This is not |
| 221 |
normally required as service providers will usually provide their |
| 222 |
CA certififcate to you separately. |
| 223 |
|
| 224 |
Default: no |
| 225 |
|
| 226 |
-- ca_file ----------------------------------------------------------- |
| 227 |
Path to a file containing one or more CA certs in PEM format. |
| 228 |
These certs are used to verify the chain of trust for the |
| 229 |
certificate retrieved from the X5U Identity header parameter. This |
| 230 |
file must have the root CA certificate, the certificate of the |
| 231 |
issuer of the X5U certificate, and any intermediate certificates |
| 232 |
between them. |
| 233 |
|
| 234 |
Default: none |
| 235 |
|
| 236 |
-- ca_path ----------------------------------------------------------- |
| 237 |
Path to a directory containing one or more hashed CA certs. |
| 238 |
See ca_file above. |
| 239 |
For this option, each certificate must be placed in its own |
| 240 |
PEM file in the directory specified and hashed with the |
| 241 |
following command: |
| 242 |
`openssl rehash <ca_path>` |
| 243 |
|
| 244 |
Default: none |
| 245 |
|
| 246 |
NOTE: Both ca_file and ca_path can be specified but at least one |
| 247 |
MUST be. |
| 248 |
|
| 249 |
-- crl_file ----------------------------------------------------------- |
| 250 |
Path to a file containing one or more CRLs in PEM format. |
| 251 |
If you with to check if the certificate in the X5U Identity header |
| 252 |
parameter has been revoked, you'll need the certificate revocation |
| 253 |
list generated by the issuer. |
| 254 |
|
| 255 |
Default: none |
| 256 |
|
| 257 |
-- crl_path ----------------------------------------------------------- |
| 258 |
Path to a directory containing one or more hashed CRLs. |
| 259 |
See crl_file above. |
| 260 |
For this option, each CRL must be placed in its own |
| 261 |
PEM file in the directory specified and hashed with the |
| 262 |
following command: |
| 263 |
`openssl rehash <crl_path>` |
| 264 |
|
| 265 |
Default: none |
| 266 |
|
| 267 |
NOTE: Neither crl_file nor crl_path are required. |
| 268 |
|
| 269 |
-- untrusted_cert_file ------------------------------------------------ |
| 270 |
Path to a file containing one or more untrusted certs in PEM format. |
| 271 |
Unfortunately, sometimes the CRLs are signed by a different CA |
| 272 |
than the certificate being verified. In this case, you'll need to |
| 273 |
provide the certificate belonging to the issuer of the CRL. That |
| 274 |
certificate is considered "untrusted" by OpenSSL and can't be placed |
| 275 |
in the ca_file or ca_path. It has to be specified here. |
| 276 |
|
| 277 |
Default: none |
| 278 |
|
| 279 |
-- untrusted_cert_path ------------------------------------------------ |
| 280 |
Path to a directory containing one or more hashed untrusted certs used |
| 281 |
to verify CRLs. |
| 282 |
See untrusted_cert_file above. |
| 283 |
For this option, each certificates must be placed in its own |
| 284 |
PEM file in the directory specified and hashed with the |
| 285 |
following command: |
| 286 |
`openssl rehash <ca_path>` |
| 287 |
|
| 288 |
Default: none |
| 289 |
|
| 290 |
NOTE: Neither untrusted_cert_file nor untrusted_cert_path are required |
| 291 |
unless you're verifying CRLs that aren't signed by the same CA as the |
| 292 |
X5U certificate. |
| 293 |
|
| 294 |
-- cert_cache_dir ----------------------------------------------------- |
| 295 |
Incoming Identity headers will have a URL pointing to the certificate |
| 296 |
used to sign the header. To prevent us from having to retrieve the |
| 297 |
certificate for every request, we maintain a cache of them in the |
| 298 |
'cert_cache_dir' specified. The directory will be checked for |
| 299 |
existence and writability at startup. |
| 300 |
|
| 301 |
Default: <astvarlibdir>/keys/stir_shaken/cache |
| 302 |
|
| 303 |
-- curl_timeout ------------------------------------------------------- |
| 304 |
The number of seconds we'll wait for a response when trying to retrieve |
| 305 |
the certificate specified in the incoming Identity header's "x5u" |
| 306 |
parameter. |
| 307 |
|
| 308 |
Default: 2 |
| 309 |
|
| 310 |
-- max_cache_entry_age ------------------------------------------------ |
| 311 |
Maximum age in seconds a certificate in the cache can reach before |
| 312 |
re-retrieving it. |
| 313 |
|
| 314 |
Default: 86400 (24 hours per ATIS-1000074) |
| 315 |
|
| 316 |
NOTE: If, when retrieving the URL specified by the "x5u" parameter, |
| 317 |
we receive a recognized caching directive in the HTTP response AND that |
| 318 |
directive indicates caching for MORE than the value set here, we'll use |
| 319 |
that time for the max_cache_entry_age. |
| 320 |
|
| 321 |
-- max_cache_size ----------------------------------------------------- |
| 322 |
Maximum number of entries the cache can hold. |
| 323 |
Not presently implemented. |
| 324 |
|
| 325 |
-- max_iat_age -------------------------------------------------------- |
| 326 |
The "iat" parameter in the Identity header indicates the time the |
| 327 |
sender actually created their attestation. If that is older than the |
| 328 |
current time by the number of seconds set here, the request will be |
| 329 |
considered "failed". |
| 330 |
|
| 331 |
Default: 15 |
| 332 |
|
| 333 |
-- ignore_sip_date_header --------------------------------------------- |
| 334 |
When set to true, will cause the verification process to not consider a |
| 335 |
missing or invalid SIP "Date" header to be a failure. This will make |
| 336 |
the IAT the sole "truth" for Date in the verification process. |
| 337 |
|
| 338 |
Default: no |
| 339 |
|
| 340 |
-- max_date_header_age ------------------------------------------------ |
| 341 |
The sender MUST also send a SIP Date header in their request. If we |
| 342 |
receive one that is older than the current time by the number of seconds |
| 343 |
set here, the request will be considered "failed". |
| 344 |
|
| 345 |
Default: 15 |
| 346 |
|
| 347 |
-- failure_action ----------------------------------------------------- |
| 348 |
Indicates what will happen to requests that have failed verification. |
| 349 |
Must be one of: |
| 350 |
- continue - |
| 351 |
Continue processing the request. You can use the STIR_SHAKEN |
| 352 |
dialplan function to determine whether the request passed or failed |
| 353 |
verification and take the action you deem appropriate. |
| 354 |
|
| 355 |
- reject_request - |
| 356 |
Reject the request immediately using the SIP response codes |
| 357 |
defined by RFC8224. |
| 358 |
|
| 359 |
- continue_return_reason - |
| 360 |
Continue processing the request but, per RFC8224, send a SIP Reason |
| 361 |
header back to the originator in the next provisional response |
| 362 |
indicating the issue according to RFC8224. You can use the |
| 363 |
STIR_SHAKEN dialplan function to determine whether the request |
| 364 |
passed or failed verification and take the action you deem |
| 365 |
appropriate. |
| 366 |
|
| 367 |
Default: continue |
| 368 |
|
| 369 |
NOTE: If you select "continue" or "continue_return_reason", and, |
| 370 |
based on the results from the STIR_SHAKEN function, you determine you |
| 371 |
want to terminate the call, you can use the PJSIPHangup() dialplan |
| 372 |
application to reject the call using a STIR/SHAKEN-specific SIP |
| 373 |
response code. |
| 374 |
|
| 375 |
-- use_rfc9410_responses ---------------------------------------------- |
| 376 |
If set, when sending Reason headers back to originators, the protocol |
| 377 |
header parameter will be set to "STIR" rather than "SIP". This is a |
| 378 |
new protocol defined in RFC9410 and may not be supported by all |
| 379 |
participants. |
| 380 |
|
| 381 |
Default: no |
| 382 |
|
| 383 |
-- relax_x5u_port_scheme_restrictions --------------------------------- |
| 384 |
If set, the port and scheme restrictions imposed by ATIS-1000074 |
| 385 |
section 5.3.1 that require the scheme to be "https" and the port to |
| 386 |
be 443 or 8443 are relaxed. This will allow schemes like "http" |
| 387 |
and ports other than the two mentioned to appear in x5u URLs received |
| 388 |
in Identity headers. |
| 389 |
|
| 390 |
Default: no |
| 391 |
|
| 392 |
CAUTION: Setting this parameter could have serious security |
| 393 |
implications and should only be use for testing. |
| 394 |
|
| 395 |
-- relax_x5u_path_restrictions ---------------------------------------- |
| 396 |
If set, the path restrictions imposed by ATIS-1000074 section 5.3.1 |
| 397 |
that require the x5u URL to be rejected if it contains a query string, |
| 398 |
path parameters, fragment identifier or user/password are relaxed. |
| 399 |
|
| 400 |
Default: no |
| 401 |
|
| 402 |
CAUTION: Setting this parameter could have serious security |
| 403 |
implications and should only be use for testing. |
| 404 |
|
| 405 |
-- x5u_permit/x5u_deny ------------------------------------------------ |
| 406 |
When set, the IP address of the host in a received Identity header x5u |
| 407 |
URL is checked against the acl created by this list of permit/deny |
| 408 |
parameters. If the check fails, the x5u URL will be considered invalid |
| 409 |
and verification will fail. This can prevent an attacker from sending |
| 410 |
you a request pretending to be a known originator with a mailcious |
| 411 |
certificate URL. (Server-side request forgery (SSRF)). |
| 412 |
See acl.conf.sample to see examples of how to specify the permit/deny |
| 413 |
parameters. |
| 414 |
|
| 415 |
Default: Deny all "Special-Purpose" IP addresses described in RFC 6890. |
| 416 |
This includes the loopback addresses 127.0.0.0/8, private use networks such |
| 417 |
as 10.0.0/8, 172.16.0.0/12 and 192.168.0.0/16, and the link local network |
| 418 |
169.254.0.0/16 among others. |
| 419 |
|
| 420 |
CAUTION: Setting this parameter could have serious security |
| 421 |
implications and should only be use for testing. |
| 422 |
|
| 423 |
-- x5u_acl ------------------------------------------------------------ |
| 424 |
Rather than providing individual permit/deny parameters, you can set |
| 425 |
the acllist parameter to an acl list predefined in acl.conf. |
| 426 |
|
| 427 |
Default: none |
| 428 |
|
| 429 |
CAUTION: Setting this parameter could have serious security |
| 430 |
implications and should only be use for testing. |
| 431 |
|
| 432 |
----------------------------------------------------------------------- |
| 433 |
Example "verification" object: |
| 434 |
--; |
| 435 |
|
| 436 |
;[verification] |
| 437 |
;global_disable = yes |
| 438 |
;load_system_certs = no |
| 439 |
;ca_path = /var/lib/asterisk/keys/stir_shaken/verification_ca |
| 440 |
;cert_cache_dir = /var/lib/asterisk/keys/stir_shaken/verification_cache |
| 441 |
;failure_action = reject_request |
| 442 |
;curl_timeout=5 |
| 443 |
;max_iat_age=60 |
| 444 |
;max_date_header_age=60 |
| 445 |
;max_cache_entry_age = 300 |
| 446 |
; For internal testing |
| 447 |
;x5u_deny=0.0.0.0/0.0.0.0 |
| 448 |
;x5u_permit=127.0.0.0/8 |
| 449 |
;x5u_permit=192.168.100.0/24 |
| 450 |
;relax_x5u_port_scheme_restrictions = yes |
| 451 |
;relax_x5u_path_restrictions = yes |
| 452 |
|
| 453 |
;-- |
| 454 |
======================================================================= |
| 455 |
Profile Object Description |
| 456 |
======================================================================= |
| 457 |
A "profile" object can be associated to channel driver endpoint |
| 458 |
(currently only chan_pjsip) and can set verification and attestation |
| 459 |
parameters specific to endpoints using this profile. If you have |
| 460 |
multiple upstream providers, this is the place to set parameters |
| 461 |
specific to them. |
| 462 |
|
| 463 |
The "id" of this object is arbitrary and you'd specify it in the |
| 464 |
"stir_shaken_profile" parameter of the endpoint. |
| 465 |
|
| 466 |
Parameters: |
| 467 |
|
| 468 |
-- type (required) ---------------------------------------------------- |
| 469 |
Must be set to "profile" |
| 470 |
|
| 471 |
Default: none |
| 472 |
|
| 473 |
-- endpoint_behavior-------------------------------------------------- |
| 474 |
Actions to be performed for endpoints referencing this profile. |
| 475 |
Must be one of: |
| 476 |
- off - |
| 477 |
Don't do any STIR/SHAKEN processing. |
| 478 |
- attest - |
| 479 |
Attest on outgoing calls. |
| 480 |
- verify |
| 481 |
Verify incoming calls. |
| 482 |
- on - |
| 483 |
Attest outgoing calls and verify incoming calls. |
| 484 |
Default: off |
| 485 |
|
| 486 |
All of the "verification" parameters defined above can be set on a profile |
| 487 |
with the exception of 'global_disable'. |
| 488 |
|
| 489 |
All of the "attestation" parameters defined above can be set on a profile |
| 490 |
with the exception of 'global_disable'. |
| 491 |
|
| 492 |
When Asterisk loads the configs, it creates "effective profiles" or |
| 493 |
"eprofiles" on the fly that are the amalgamation of the attestation, |
| 494 |
verification and profile. You can see them in the CLI with |
| 495 |
"stir_shaken show eprofiles". |
| 496 |
|
| 497 |
----------------------------------------------------------------------- |
| 498 |
Example "profile" object: |
| 499 |
--; |
| 500 |
|
| 501 |
;[myprofile] |
| 502 |
;type = profile |
| 503 |
;endpoint_behavior = verify |
| 504 |
;failure_action = continue_return_reason |
| 505 |
;x5u_acl = myacllist |
| 506 |
|
| 507 |
;In pjsip.conf... |
| 508 |
;[myendpoint] |
| 509 |
;type = endpoint |
| 510 |
;stir_shaken_profile = myprofile |
| 511 |
|
| 512 |
;In acl.conf... |
| 513 |
;[myacllist] |
| 514 |
;permit=0.0.0.0/0.0.0.0 |
| 515 |
;deny=10.24.20.171 |
| 516 |
|