Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tutorials:openser-auth-ldap [2007/07/27 17:48] – 152.2.199.72 | tutorials:openser-auth-ldap [2008/09/23 22:31] (current) – 86.121.128.125 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== LDAP Authentication for OpenSER 1.3.x ====== | ||
+ | <hi # | ||
+ | |||
+ | |||
+ | |||
+ | ===== Prerequisites ===== | ||
+ | |||
+ | * install OpenLDAP library (libldap) v2.1 or greater, libldap header files (libldap-dev) are needed for compilation | ||
+ | * read the documentation of **auth** module: http:// | ||
+ | * read the documentation of **ldap** module: http:// | ||
+ | |||
+ | |||
+ | |||
+ | ===== Sample LDAP Tree ===== | ||
+ | |||
+ | < | ||
+ | - dc=example, | ||
+ | | | ||
+ | +- ou=users | ||
+ | | | | ||
+ | | +- cn=sip_proxy -- sn: sip_proxy | ||
+ | | -- userPassword: | ||
+ | | | ||
+ | +- ou=sip | ||
+ | | | ||
+ | +- cn=user1 -- SIPUserName: | ||
+ | | ||
+ | | | ||
+ | +- cn=user2 -- SIPUserName: | ||
+ | -- SIPPassword: | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ===== LDAP Module Configuration File ===== | ||
+ | |||
+ | / | ||
+ | < | ||
+ | [sipaccounts] | ||
+ | ldap_server_url = " | ||
+ | ldap_bind_dn = " | ||
+ | ldap_bind_password = " | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ===== OpenSER Configuration File ===== | ||
+ | |||
+ | < | ||
+ | ... | ||
+ | modparam(" | ||
+ | |||
+ | modparam(" | ||
+ | modparam(" | ||
+ | modparam(" | ||
+ | |||
+ | ... | ||
+ | |||
+ | route[11] { | ||
+ | if(is_method(" | ||
+ | { | ||
+ | if(is_present_hf(" | ||
+ | { | ||
+ | # ldap search | ||
+ | if (!ldap_search(" | ||
+ | { | ||
+ | switch ($retcode) | ||
+ | { | ||
+ | case -1: | ||
+ | # no LDAP entry found | ||
+ | | ||
+ | exit; | ||
+ | case -2: | ||
+ | # internal error | ||
+ | | ||
+ | exit; | ||
+ | default: | ||
+ | exit; | ||
+ | } | ||
+ | } | ||
+ | ldap_result(" | ||
+ | ldap_result(" | ||
+ | if(!pv_www_authorize("" | ||
+ | { | ||
+ | | ||
+ | exit; | ||
+ | } | ||
+ | sl_send_reply(" | ||
+ | exit; | ||
+ | } else { | ||
+ | www_challenge(""," | ||
+ | exit; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | ... | ||
+ | </ |