1 <?xml version="1.0" encoding='ISO-8859-1'?>
2 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
3 "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
5 <!-- Include general documentation entities -->
6 <!ENTITY % docentities SYSTEM "../../../../doc/docbook/entities.xml">
10 <!-- Module User's Guide -->
14 <title>&adminguide;</title>
17 <title>Overview</title>
19 The module implements secure SIP identity specifications - STIR and SHAKEN
20 IETF extensions for SIP (RFC8224, RFC 8588).
23 It exports the functions to check and generate Identity header.
27 <title>Dependencies</title>
29 <title>&kamailio; Modules</title>
31 The following modules must be loaded before this module:
35 <emphasis>No dependencies on other &kamailio; modules</emphasis>.
42 <title>External Libraries or Applications</title>
44 The following libraries or applications must be installed before running
45 &kamailio; with this module loaded:
49 <emphasis>libsecsipid</emphasis> - https://github.com/asipto/secsipidx/.
57 <title>Parameters</title>
59 <title><varname>expire</varname> (int)</title>
61 The interval in seconds after which the Identity header JWT is considered
70 <title>Set <varname>expire</varname> parameter</title>
71 <programlisting format="linespecific">
73 modparam("secsipid", "expire", 600)
79 <title><varname>timeout</varname> (int)</title>
81 The interval in seconds after which the HTTP GET operation to download
82 the public key times out.
90 <title>Set <varname>timeout</varname> parameter</title>
91 <programlisting format="linespecific">
93 modparam("secsipid", "timeout", 2)
102 <title>Functions</title>
103 <section id="async.f.secsipid_check_identity">
105 <function moreinfo="none">secsipid_check_identity(keyPath)</function>
108 Check the validity of the Identity header using the keys stored
109 in the file specified by "keyPath". If the parameter is empty,
110 the function is downloading the key using the URL from "info"
111 parameter of the Identity header, using the value od "timeout"
112 parameter to limit the download time. The validity of the JWT
113 body in the Identity header is also checjed against the "expire"
117 The parameters can contain pseudo-variables.
120 This function can be used from ANY_ROUTE.
123 <title><function>secsipid_check_identity</function> usage</title>
124 <programlisting format="linespecific">
128 if(secsipid_check_identity("/secsipid/$si/cert.pem")) { ... }
130 if(secsipid_check_identity("")) { ... }
137 Further checks can be done with config operations, decoding the JWT header
138 and payload using {s.select} and {s.decode.base64t} transformations
139 together with jansson module.
142 <section id="async.f.secsipid_add_identity">
144 <function moreinfo="none">secsipid_add_identity(origTN, destTN, attest, origID, x5u, keyPath)</function>
147 Add Identity header using the key specified by "keyPath" to sign the JWT body.
148 If origID is empty, a UUID string is generated to fill the field. The origTN
149 represents the origination telephone number; destTN represents the destination
150 telephone number; x5u is the HTTP URL referencing to the public key that
151 should be used to verify the signature; attest represents the attestation
152 level (should be "A", "B" or "C").
155 The parameters can contain pseudo-variables.
158 This function can be used from ANY_ROUTE.
161 <title><function>secsipid_add_identity</function> usage</title>
162 <programlisting format="linespecific">
166 secsipid_add_identity("$fU", "$rU", "A", "",
167 "http://kamailio.org/stir/$rd/cert.pem", "/secsipid/$rd/key.pem");
176 <title>Installation</title>
178 The module depends on "libsecsipid", which is a component of "sipsecidx"
179 project from https://github.com/asipto/secsipidx/. The library is
180 implemented in Go language, with generated C API and library. Until the
181 libsecsipid is going to be packaged in OS distributions, the secsipid
182 module can be compiled by copying secsipid.h libsecsipid.h and libsecsipid.a
183 files in the folder of the module.
186 To generate the libsecsipid.a file, it requires to have Go language
187 installed and its environment configured, then run the following commands:
190 <title>Libsecsipid usage</title>
191 <programlisting format="linespecific">
193 go get https://github.com/asipto/secsipidx
194 cd $GOPATH/src/github.com/asipto/secsipidx/csecsipid/
196 cp secsipid.h libsecsipid.h libsecsipid.a \
197 /path/to/kamailio/src/modules/secsipid/
198 cd /path/to/kamailio/
199 make modules modules=src/modules/secsipid/