1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395
|
Auth Module
Jan Janak
FhG Fokus
Juha Heinanen
Song Networks
Bogdan-Andrei Iancu
voice-system.ro
Edited by
Jan Janak
Copyright 2002, 2003 FhG FOKUS
Copyright 2005 voice-system.ro
_________________________________________________________
Table of Contents
1. User's Guide
1.1. Overview
1.2. Dependencies
1.2.1. OpenSER Modules
1.2.2. External Libraries or Applications
1.3. Exported Parameters
1.3.1. secret (string)
1.3.2. nonce_expire (integer)
1.3.3. rpid_prefix (string)
1.3.4. rpid_suffix (string)
1.3.5. realm_prefix (string)
1.3.6. rpid_avp (string)
1.4. Exported Functions
1.4.1. www_challenge(realm, qop)
1.4.2. proxy_challenge(realm, qop)
1.4.3. consume_credentials()
1.4.4. is_rpid_user_e164()
1.4.5. append_rpid_hf()
1.4.6. append_rpid_hf(prefix, suffix)
2. Developer's Guide
3. Frequently Asked Questions
List of Examples
1-1. secret parameter example
1-2. nonce_expire parameter example
1-3. rpid_prefix parameter example
1-4. rpid_suffix parameter example
1-5. realm_prefix parameter example
1-6. rpid_avp parameter example
1-7. www_challenge usage
1-8. proxy_challenge usage
1-9. consume_credentials example
1-10. is_rpid_user_e164 usage
1-11. append_rpid_hf usage
1-12. append_rpid_hf(prefix, suffix) usage
_________________________________________________________
Chapter 1. User's Guide
1.1. Overview
This is a generic module that itself doesn't provide all
functions necessary for authentication but provides functions
that are needed by all other authentication related modules
(so called authentication backends).
We decided to break the authentication code into several
modules because there are now more than one backends
(currently database authentication and radius are supported).
This allows us to create separate packages so uses can install
and load only required functionality. This also allows us to
avoid unnecessary dependencies in the binary packages.
_________________________________________________________
1.2. Dependencies
1.2.1. OpenSER Modules
The module depends on the following modules (in the other
words the listed modules must be loaded before this module):
* sl -- Stateless replies
_________________________________________________________
1.2.2. External Libraries or Applications
The following libraries or applications must be installed
before running OpenSER with this module loaded:
* none
_________________________________________________________
1.3. Exported Parameters
1.3.1. secret (string)
Secret phrase.
Default value is randomly generated string.
Example 1-1. secret parameter example
modparam("auth", "secret", "johndoessecretphrase")
_________________________________________________________
1.3.2. nonce_expire (integer)
Nonces have limited lifetime. After a given period of time
nonces will be considered invalid. This is to protect replay
attacks. Credentials containing a stale nonce will be not
authorized, but the user agent will be challenged again. This
time the challenge will contain stale parameter which will
indicate to the client that it doesn't have to disturb user by
asking for username and password, it can recalculate
credentials using existing username and password.
The value is in seconds and default value is 300 seconds.
Example 1-2. nonce_expire parameter example
modparam("auth", "nonce_expire", 600) # Set nonce_expire to 600s
_________________________________________________________
1.3.3. rpid_prefix (string)
Prefix to be added to Remote-Party-ID header field just before
the URI returned from either radius or database.
Default value is "".
Example 1-3. rpid_prefix parameter example
modparam("auth", "rpid_prefix", "Whatever <")
_________________________________________________________
1.3.4. rpid_suffix (string)
Suffix to be added to Remote-Party-ID header field after the
URI returned from either radius or database.
Default value is
";party=calling;id-type=subscriber;screen=yes".
Example 1-4. rpid_suffix parameter example
modparam("auth", "rpid_suffix", "@1.2.3.4>")
_________________________________________________________
1.3.5. realm_prefix (string)
Prefix to be automatically strip from realm. As an alternative
to SRV records (not all SIP clients support SRV lookup), a
subdomain of the master domain can be defined for SIP purposes
(like sip.mydomain.net pointing to same IP address as the SRV
record for mydomain.net). By ignoring the realm_prefix "sip.",
at authentication, sip.mydomain.net will be equivalent to
mydomain.net .
Default value is empty string.
Example 1-5. realm_prefix parameter example
modparam("auth", "realm_prefix", "sip.")
_________________________________________________________
1.3.6. rpid_avp (string)
Full AVP specification (ID, Name, Alias) for the AVP which
stores the RPID value. It used to transport the RPID value
from authntication backend modules (auth_db or auth_radius) or
from script to the auth function append_rpid_hf and
is_rpid_user_e164.
If defined to NULL string, all RPID functions will fail at
runtime.
Default value is "rpid" (Name AVP - e.g, 'i:number',
's:string' or 'avp_alias_string').
Example 1-6. rpid_avp parameter example
modparam("auth", "rpid_avp", "i:13")
_________________________________________________________
1.4. Exported Functions
1.4.1. www_challenge(realm, qop)
The function challenges a user agent. It will generate a
WWW-Authorize header field containing a digest challenge, it
will put the header field into a response generated from the
request the server is processing and send the reply. Upon
reception of such a reply the user agent should compute
credentials and retry the request. For more information
regarding digest authentication see RFC2617.
Meaning of the parameters is as follows:
* realm - Realm is a opaque string that the user agent
should present to the user so he can decide what username
and password to use. Usually this is domain of the host
the server is running on.
If an empty string "" is used then the server will
generate it from the request. In case of REGISTER requests
To header field domain will be used (because this header
field represents a user being registered), for all other
messages From header field domain will be used.
The string may contain pseudo variables.
* qop - Value of this parameter can be either "1" or "0".
When set to 1 then the server will put qop parameter in
the challenge. When set to 0 then the server will not put
qop parameter in the challenge. It is strongly recommended
to use qop parameter, however there are still some user
agents that cannot handle qop parameter properly so we
made this optional. On the other hand there are still some
user agents that cannot handle request without qop
parameter too.
This function can be used from REQUEST_ROUTE.
Example 1-7. www_challenge usage
...
if (www_authorize("siphub.net", "subscriber")) {
www_challenge("siphub.net", "1");
};
...
_________________________________________________________
1.4.2. proxy_challenge(realm, qop)
The function challenges a user agent. It will generate a
Proxy-Authorize header field containing a digest challenge, it
will put the header field into a response generated from the
request the server is processing and send the reply. Upon
reception of such a reply the user agent should compute
credentials and retry the request. For more information
regarding digest authentication see RFC2617.
Meaning of the parameters is as follows:
* realm - Realm is a opaque string that the user agent
should present to the user so he can decide what username
and password to use. Usually this is domain of the host
the server is running on.
If an empty string "" is used then the server will
generate it from the request. From header field domain
will be used as realm.
The string may contain pseudo variables.
* qop - Value of this parameter can be either "1" or "0".
When set to 1 then the server will put qop parameter in
the challenge. When set to 0 then the server will not put
qop parameter in the challenge. It is strongly recommended
to use qop parameter, however there are still some user
agents that cannot handle qop parameter properly so we
made this optional. On the other hand there are still some
user agents that cannot handle request without qop
parameter too.
This function can be used from REQUEST_ROUTE.
Example 1-8. proxy_challenge usage
...
if (!proxy_authorize("", "subscriber)) {
proxy_challenge("", "1"); # Realm will be autogenerated
};
...
_________________________________________________________
1.4.3. consume_credentials()
This function removes previously authorized credentials from
the message being processed by the server. That means that the
downstream message will not contain credentials there were
used by this server. This ensures that the proxy will not
reveal information about credentials used to downstream
elements and also the message will be a little bit shorter.
The function must be called after www_authorize or
proxy_authorize.
This function can be used from REQUEST_ROUTE.
Example 1-9. consume_credentials example
...
if (www_authorize("", "subscriber)) {
consume_credentials();
};
...
_________________________________________________________
1.4.4. is_rpid_user_e164()
The function checks if the SIP URI received from the database
or radius server and will potentially be used in
Remote-Party-ID header field contains an E164 number
(+followed by up to 15 decimal digits) in its user part. Check
fails, if no such SIP URI exists (i.e. radius server or
database didn't provide this information).
This function can be used from REQUEST_ROUTE.
Example 1-10. is_rpid_user_e164 usage
...
if (is_rpid_user_e164()) {
# do something here
};
...
_________________________________________________________
1.4.5. append_rpid_hf()
Appends to the message a Remote-Party-ID header that contains
header 'Remote-Party-ID: ' followed by the saved value of the
SIP URI received from the database or radius server followed
by the value of module parameter radius_rpid_suffix. The
function does nothing if no saved SIP URI exists.
This function can be used from REQUEST_ROUTE, FAILURE_ROUTE,
BRANCH_ROUTE.
Example 1-11. append_rpid_hf usage
...
append_rpid_hf(); # Append Remote-Party-ID header field
...
_________________________________________________________
1.4.6. append_rpid_hf(prefix, suffix)
This function is the same as Section 1.4.5. The only
difference is that it accepts two parameters--prefix and
suffix to be added to Remote-Party-ID header field. This
function ignores rpid_prefix and rpid_suffix parameters,
instead of that allows to set them in every call.
Meaning of the parameters is as follows:
* prefix - Prefix of the Remote-Party-ID URI. The string
will be added at the begining of body of the header field,
just before the URI.
* suffix - Suffix of the Remote-Party-ID header field. The
string will be appended at the end of the header field. It
can be used to set various URI parameters, for example.
This function can be used from REQUEST_ROUTE, FAILURE_ROUTE,
BRANCH_ROUTE.
Example 1-12. append_rpid_hf(prefix, suffix) usage
...
append_rpid_hf("", ";party=calling;id-type=subscriber;screen=yes"); #
Append Remote-Party-ID header field
...
_________________________________________________________
Chapter 2. Developer's Guide
The module does not provide any API to use in other OpenSER
modules.
_________________________________________________________
Chapter 3. Frequently Asked Questions
3.1. Where can I find more about OpenSER?
3.2. Where can I post a question about this module?
3.3. How can I report a bug?
3.1. Where can I find more about OpenSER?
Take a look at http://openser.org/.
3.2. Where can I post a question about this module?
First at all check if your question was already answered on
one of our mailing lists:
* User Mailing List -
http://openser.org/cgi-bin/mailman/listinfo/users
* Developer Mailing List -
http://openser.org/cgi-bin/mailman/listinfo/devel
E-mails regarding any stable OpenSER release should be sent to
<users@openser.org> and e-mails regarding development versions
should be sent to <devel@openser.org>.
If you want to keep the mail private, send it to
<team@openser.org>.
3.3. How can I report a bug?
Please follow the guidelines provided at:
http://sourceforge.net/tracker/?group_id=139143.
|