| 1 |
Peering Module |
| 2 |
|
| 3 |
Juha Heinanen |
| 4 |
|
| 5 |
<[email protected]> |
| 6 |
|
| 7 |
Edited by |
| 8 |
|
| 9 |
Juha Heinanen |
| 10 |
|
| 11 |
<[email protected]> |
| 12 |
|
| 13 |
Copyright © 2008 Juha Heinanen |
| 14 |
__________________________________________________________________ |
| 15 |
|
| 16 |
Table of Contents |
| 17 |
|
| 18 |
1. Admin Guide |
| 19 |
|
| 20 |
1. Overview |
| 21 |
2. Dependencies |
| 22 |
|
| 23 |
2.1. Kamailio Modules |
| 24 |
2.2. External Libraries or Applications |
| 25 |
|
| 26 |
3. Parameters |
| 27 |
|
| 28 |
3.1. radius_config (string) |
| 29 |
3.2. verify_destination_service_type (integer) |
| 30 |
3.3. verify_source_service_type (integer) |
| 31 |
|
| 32 |
4. Functions |
| 33 |
|
| 34 |
4.1. verify_destination() |
| 35 |
4.2. verify_source() |
| 36 |
|
| 37 |
List of Examples |
| 38 |
|
| 39 |
1.1. radius_config parameter usage |
| 40 |
1.2. verify_destination_service_type parameter usage |
| 41 |
1.3. verify_source_service_type parameter usage |
| 42 |
1.4. verify_destination() usage |
| 43 |
1.5. verify_source() usage |
| 44 |
|
| 45 |
Chapter 1. Admin Guide |
| 46 |
|
| 47 |
Table of Contents |
| 48 |
|
| 49 |
1. Overview |
| 50 |
2. Dependencies |
| 51 |
|
| 52 |
2.1. Kamailio Modules |
| 53 |
2.2. External Libraries or Applications |
| 54 |
|
| 55 |
3. Parameters |
| 56 |
|
| 57 |
3.1. radius_config (string) |
| 58 |
3.2. verify_destination_service_type (integer) |
| 59 |
3.3. verify_source_service_type (integer) |
| 60 |
|
| 61 |
4. Functions |
| 62 |
|
| 63 |
4.1. verify_destination() |
| 64 |
4.2. verify_source() |
| 65 |
|
| 66 |
1. Overview |
| 67 |
|
| 68 |
The peering module allows SIP providers (operators or organizations) to |
| 69 |
verify from a broker if source or destination of a SIP request is a |
| 70 |
trusted peer. |
| 71 |
|
| 72 |
This module is obsolete and will be removed in the next release. |
| 73 |
|
| 74 |
In order to participate in the trust community provided by a broker, |
| 75 |
each SIP provider registers the domains (host parts of SIP URIs) that |
| 76 |
they serve with the broker. When a SIP proxy of a provider needs to |
| 77 |
send a SIP request to a non-local domain, it can find out from the |
| 78 |
broker using verify_destination() function if the non-local domain is |
| 79 |
served by a trusted peer. If so, the provider receives from the broker |
| 80 |
a hash of the SIP request and a timestamp that it includes in the |
| 81 |
request to the non-local domain. When a SIP proxy of the non-local |
| 82 |
domain receives the SIP request, it, in turn, can verify from the |
| 83 |
broker using verify_source() function if the request came from a |
| 84 |
trusted peer. |
| 85 |
|
| 86 |
Verification functions communicate with the broker using Radius |
| 87 |
protocol. Sample FreeRADIUS configuration files for broker's Radius |
| 88 |
server are available from http://www.wirlab.net/tsi/. |
| 89 |
|
| 90 |
Comments and suggestions for improvements are welcome. |
| 91 |
|
| 92 |
2. Dependencies |
| 93 |
|
| 94 |
2.1. Kamailio Modules |
| 95 |
2.2. External Libraries or Applications |
| 96 |
|
| 97 |
2.1. Kamailio Modules |
| 98 |
|
| 99 |
The module depends on the following modules (in other words the listed |
| 100 |
modules must be loaded before this module): |
| 101 |
* none |
| 102 |
|
| 103 |
2.2. External Libraries or Applications |
| 104 |
|
| 105 |
The following libraries or applications must be installed before |
| 106 |
compiling Kamailio with this module loaded: |
| 107 |
* radiusclient-ng 0.5.0 or higher -- library and development files. |
| 108 |
See http://developer.berlios.de/projects/radiusclient-ng/. |
| 109 |
|
| 110 |
3. Parameters |
| 111 |
|
| 112 |
3.1. radius_config (string) |
| 113 |
3.2. verify_destination_service_type (integer) |
| 114 |
3.3. verify_source_service_type (integer) |
| 115 |
|
| 116 |
3.1. radius_config (string) |
| 117 |
|
| 118 |
This is the location of the configuration file of Radius client |
| 119 |
libraries. |
| 120 |
|
| 121 |
Default value is “/usr/local/etc/radiusclient-ng/radiusclient.conf”. |
| 122 |
|
| 123 |
Example 1.1. radius_config parameter usage |
| 124 |
modparam("peering", "radius_config", "/etc/broker/radiusclient.conf") |
| 125 |
|
| 126 |
3.2. verify_destination_service_type (integer) |
| 127 |
|
| 128 |
This is the value of the Service-Type Radius attribute to be used, when |
| 129 |
sender of SIP Request verifies the request's destination using |
| 130 |
verify_destination() function. |
| 131 |
|
| 132 |
Default value is the dictionary value of “Sip-Verify-Destination” |
| 133 |
Service-Type. |
| 134 |
|
| 135 |
Example 1.2. verify_destination_service_type parameter usage |
| 136 |
modparam("peering", "verify_destination_service_type", 21) |
| 137 |
|
| 138 |
3.3. verify_source_service_type (integer) |
| 139 |
|
| 140 |
This is the value of the Service-Type Radius attribute to be used, when |
| 141 |
receiver of SIP Request verifies the request's source using |
| 142 |
verify_source() function. |
| 143 |
|
| 144 |
Default value is the dictionary value of “Sip-Verify-Source” |
| 145 |
Service-Type. |
| 146 |
|
| 147 |
Example 1.3. verify_source_service_type parameter usage |
| 148 |
modparam("peering", "verify_source_service_type", 22) |
| 149 |
|
| 150 |
4. Functions |
| 151 |
|
| 152 |
4.1. verify_destination() |
| 153 |
4.2. verify_source() |
| 154 |
|
| 155 |
4.1. verify_destination() |
| 156 |
|
| 157 |
Function verify_destination() queries from broker's Radius server if |
| 158 |
domain (host part) of Request URI is served by a trusted peer. Radius |
| 159 |
request contains the following attributes/values: |
| 160 |
* User-Name - Request-URI host |
| 161 |
* SIP-URI-User - Request-URI user |
| 162 |
* SIP-From-Tag - From tag |
| 163 |
* SIP-Call-Id - Call id |
| 164 |
* Service-Type - verify_destination_service_type |
| 165 |
|
| 166 |
Function returns value 1 if domain of Request URI is served by a |
| 167 |
trusted peer and -1 otherwise. In case of positive result, the Radius |
| 168 |
server returns a set of SIP-AVP reply attributes. The value of each |
| 169 |
SIP-AVP is of form: |
| 170 |
|
| 171 |
[#]name(:|#)value |
| 172 |
|
| 173 |
Value of each SIP-AVP reply attribute is mapped to a Kamailio AVP. |
| 174 |
Prefix # in front of name or value indicates a string name or string |
| 175 |
value, respectively. |
| 176 |
|
| 177 |
One of the SIP-AVP reply attributes contains a string that the source |
| 178 |
peer must include "as is" in a P-Request-Hash: header when it sends the |
| 179 |
SIP request to the destination peer. The string value may, for example, |
| 180 |
be of form hash@timestamp, where hash contains a hash calculated by the |
| 181 |
broker based on the attributes of the query and some local information |
| 182 |
and timestamp is the time when the calculation was done. |
| 183 |
|
| 184 |
AVP names used in reply attributes are assigned by the broker. |
| 185 |
|
| 186 |
This function can be used from REQUEST_ROUTE and FAILURE_ROUTE. |
| 187 |
|
| 188 |
Example 1.4. verify_destination() usage |
| 189 |
... |
| 190 |
if (verify_destination()) { |
| 191 |
append_hf("P-Request-Hash: $avp(i:200)\r\n"); |
| 192 |
} |
| 193 |
... |
| 194 |
|
| 195 |
4.2. verify_source() |
| 196 |
|
| 197 |
Function verify_source() queries the broker's Radius server whether the |
| 198 |
SIP request was received from a trusted peer. The Radius request |
| 199 |
contains the following attributes/values: |
| 200 |
* User-Name - Request-URI host |
| 201 |
* SIP-URI-User - Request-URI user |
| 202 |
* SIP-From-Tag - From tag |
| 203 |
* SIP-Call-Id - Call id |
| 204 |
* SIP-Request-Hash - body of P-Request-Hash header |
| 205 |
* Service-Type - verify_source_service_type |
| 206 |
|
| 207 |
Function returns value 1 if SIP request was received from a trusted |
| 208 |
peer and -1 otherwise. In case of positive result, Radius server may |
| 209 |
return a set of SIP-AVP reply attributes. Value of each SIP-AVP is of |
| 210 |
form: |
| 211 |
|
| 212 |
[#]name(:|#)value |
| 213 |
|
| 214 |
Value of each SIP-AVP reply attribute is mapped to a Kamailio AVP. |
| 215 |
Prefix # in front of name or value indicates a string name or string |
| 216 |
value, respectively. |
| 217 |
|
| 218 |
AVP names used in reply attributes are assigned by the broker. |
| 219 |
|
| 220 |
This function can be used from REQUEST_ROUTE and FAILURE_ROUTE. |
| 221 |
|
| 222 |
Example 1.5. verify_source() usage |
| 223 |
... |
| 224 |
if (is_present_hf("P-Request-Hash")) { |
| 225 |
if (verify_source()) { |
| 226 |
xlog("L_INFO", "Request came from trusted peer\n") |
| 227 |
} |
| 228 |
} |
| 229 |
... |