What is STIR/SHAKEN
STIR/SHAKEN is a set of protocols and procedures intended to counteract caller ID spoofing on public telephone networks. Caller ID spoofing involves masking the caller's identity or making it appear that the call is coming from a legitimate source, such as a local phone number or a well-known organization. This type of spoofing is often used by robocallers and is common for calls made through voice-over-IP (VoIP) systems, which can be located anywhere in the world. STIR, or Secure Telephony Identity Revisited, is a protocol for providing calling party information with a digital signature that can be produced and verified at various locations. SHAKEN, or Secure Handling of Asserted information using Tokens, focuses on how STIR can be implemented within carrier networks and addresses deployability. While STIR focuses on end devices, SHAKEN focuses on the carrier network.
The following guide applies for VoipNow version 5.6.0 M1 or higher.
How STIR/SHAKEN works
STIR/SHAKEN uses digital certificates based on public key cryptography to ensure that the calling number of a telephone call is secure. In essence, each telephony service provider obtains a digital certificate from a trusted certificate authority, which allows the called party to verify that the calling number is legitimate and has not been faked. In simpler terms, the certificate technology enables the called party to confirm that the calling number is accurate and not a spoof.
The following call flow diagram illustrates how STIR/SHAKEN works.
1. The originating service provider receives a SIP Invite and determines how to certify the call:
- Full Attestation (A) - The service provider authenticates the calling party AND confirms they are authorized to use this number.
- Partial Attestation (B) - The service provider verifies the call origination but cannot confirm that the call source is authorized to use the calling number. An example would be a calling number from behind an enterprise PBX.
- Gateway Attestation (C) - The service provider authenticates the call’s origin but cannot verify the source. An example would be a call received from an international gateway.
2. The service provider creates a SIP identity header and adds it to the Invite that it sends on the egress side.
3. The terminating service provider verifies the identity header and decides what to do with the call. It can also add a verstat string in the PAI header, which means that the call was already verified.
How STIR/SHAKEN works with VoipNow
For VoipNow, the authentication functionality is developed in Kamailio and the verification functionality is developed in Asterisk.
To be able to sign calls with an Identify Header you will need a private key and a certificate from an authorized STI-CA (Secure Telephone Identity Certification Authority). The list with approved certification authorities is published here. The process of obtaining the certificate may differ from one company from another, but all of them will require that the service provider has been assigned an OCN. Further details about the paper work that needs to be completed is available here.
You can verify if a private key matches the certificate with the following command.
1. Copy the private key, which you generated with the help of your Certificate Administrator and make sure it has the correct permissions:
2.Edit the following lines in /etc/kamailio/kamailio.cfg to enable STIR/SHAKEN. The result should look like this.
3.Make sure that the following lines in the kamailio.cfg include the correct path for the private key /etc/voipnow/certs/sip/priv-key.pem.
4. Edit the kamailio.cfg to add the URL from the Certificate Repository where your certificate is hosted. You will need to replace "url_to_be_added" with the URL provide by the CA.
5.Restart the Kamailio service.
You should be able to see the identity header in an Invite if you make a test call:
VoipNow will process all calls by default without taking into account if the Identity header is missing, present or fails the identity_check. The default action is set to PASS.
When a call arrives on the system, there are three possible identity_check outcomes:
- identity_missing - The Identity header is completely missing
- identity_check_ok - The Identity header contains a valid identity.
- identity_check_failed -The Identity header exists, but the identity is incomplete or invalid.
There are three actions the server can take :
- PASS - Just pass the call forward regardless of the identity check.
- STOP - Drop the call. In the call history, such a call will have the status NOT ALLOWED.
- ALERT - Alert the user by altering the callerid name. You can set values in [alert] section for every identity check outcome: missing_prefix, missing_suffix, check_ok_prefix, check_ok_suffix, check_failed_prefix, check_failed_suffix.
To change the default setup, you will need to follow these steps:
1.Go to file /etc/asterisk/stir_shaken.conf, section identity_check to specify behavior and setup PASS, STOP or ALERT according to your needs.
2.Restart the asterisk service:
3.Install chain root certificate from CA by copying the CA certificates that are found here in /etc/pki/ca-trust/source/anchors/.
A new certificate file needs to be created for every company name from the pdf file to make sure that calls signed with all the STI-CAs can be verified. Below is an example for a root certificate named comcast.pem belonging to the Comcast company that has the correct format.
4.Refresh the CA certificate used by the server:
5.Reload the asterisk stir shaken config:
In the asterisk console, you should be able to see something like this if the verification works:
Except where otherwise noted, content in this space is licensed under a Creative Commons Attribution 4.0 International.