koha integration: ldap

39
LDAP Joe Atzberger, LibLime KohaCon 2009: Plano, TX

Upload: ohiocore

Post on 13-May-2015

4.832 views

Category:

Technology


1 download

DESCRIPTION

Do you want to keep your certain user information (like passwords!) automatically in sync with an external authentication server? LDAP is the answer here. - Joe Atzberger

TRANSCRIPT

Page 1: Koha Integration: LDAP

LDAPJoe Atzberger, LibLime

KohaCon 2009: Plano, TX

Page 2: Koha Integration: LDAP

Need LDAP Tools?• Apache Directory Server & Studio (client)

http://directory.apache.org/

• Open Source (Apache license)

• Newer than openldap and more stable.

• Runs on OSX, Win32 and linux.“We strive to increase LDAP awareness, comfort and adoption to bring

forth what we call the Modern LDAP Renaissance.”

Page 3: Koha Integration: LDAP

Need LDAP Tools?

• OpenLDAP - http://www.openldap.org/

• includes command line tools: ldapsearch, ldapadd, etc.

• Net::LDAP - CPAN perl module

Page 4: Koha Integration: LDAP

LDAP Timing

• Koha LDAP does not go grab all your users as a “dump”. That is what IMPORT is for. Instead it updates when they try to login.

• Implications: lightweight, happening in realtime. Somewhat literal, no XSL or other conditional processing.

Page 5: Koha Integration: LDAP

<ldapserver> bind<hostname>ldap://auth.example.com:389</hostname><base>dc=example,dc=com</base><user>cn=Admin,dc=example,dc=com</user> <!-- DN, if not anonymous --><pass>s3cur1T</pass> <!-- password, if not anonymous -->

• So you can anonymous bind (not recommended)• Otherwise, specify user for bind• bind-as-auth: others have hacked Koha to do it, but not cleanly enough to get into HEAD. So I’m not presenting it.

Page 6: Koha Integration: LDAP

<ldapserver> options

Page 7: Koha Integration: LDAP

<ldapserver> options

<replicate>1</replicate><!-- add new users from LDAP to Koha database --><update>1</update> <!-- update existing users in Koha database -->

Page 8: Koha Integration: LDAP

<ldapserver> options

<replicate>1</replicate><!-- add new users from LDAP to Koha database --><update>1</update> <!-- update existing users in Koha database -->

Default is ON for both.

Page 9: Koha Integration: LDAP

Know your own Schema• For example,

inetOrgPerson, RFC#2798:http://www.ietf.org/rfc/rfc2798.txt

version: 1 dn: cn=Barbara Jensen,ou=Product Development,dc=siroe,dc=com objectClass: top objectClass: person objectClass: organizationalPerson objectClass: inetOrgPerson cn: Barbara Jensen cn: Babs Jensen displayName: Babs Jensen sn: Jensen givenName: Barbara initials: BJJ title: manager, product development uid: bjensen mail: [email protected] telephoneNumber: +1 408 555 1862 facsimileTelephoneNumber: +1 408 555 1992 mobile: +1 408 555 1941 roomNumber: 0209 carLicense: 6ABC246 o: Siroe ou: Product Development departmentNumber: 2604 employeeNumber: 42 employeeType: full time preferredLanguage: fr, en-gb;q=0.8, en;q=0.7 labeledURI: http://www.siroe.com/users/bjensen My Home Page

Page 10: Koha Integration: LDAP

version: 1 dn: cn=Barbara Jensen,ou=Product Development,dc=siroe,dc=com objectClass: top objectClass: person objectClass: organizationalPerson objectClass: inetOrgPerson cn: Barbara Jensen cn: Babs Jensen displayName: Babs Jensen sn: Jensen givenName: Barbara initials: BJJ title: manager, product development uid: bjensen mail: [email protected] telephoneNumber: +1 408 555 1862 facsimileTelephoneNumber: +1 408 555 1992 mobile: +1 408 555 1941 roomNumber: 0209 carLicense: 6ABC246 o: Siroe ou: Product Development departmentNumber: 2604 employeeNumber: 42 employeeType: full time preferredLanguage: fr, en-gb;q=0.8, en;q=0.7 labeledURI: http://www.siroe.com/users/bjensen My Home Page

Page 11: Koha Integration: LDAP

version: 1 dn: cn=Barbara Jensen,ou=Product Development,dc=siroe,dc=com objectClass: top objectClass: person objectClass: organizationalPerson objectClass: inetOrgPerson cn: Barbara Jensen cn: Babs Jensen displayName: Babs Jensen sn: Jensen givenName: Barbara initials: BJJ title: manager, product development uid: bjensen mail: [email protected] telephoneNumber: +1 408 555 1862 facsimileTelephoneNumber: +1 408 555 1992 mobile: +1 408 555 1941 roomNumber: 0209 carLicense: 6ABC246 o: Siroe ou: Product Development departmentNumber: 2604 employeeNumber: 42 employeeType: full time preferredLanguage: fr, en-gb;q=0.8, en;q=0.7 labeledURI: http://www.siroe.com/users/bjensen My Home Page

Page 12: Koha Integration: LDAP

version: 1 dn: cn=Barbara Jensen,ou=Product Development,dc=siroe,dc=com objectClass: top objectClass: person objectClass: organizationalPerson objectClass: inetOrgPerson cn: Barbara Jensen cn: Babs Jensen displayName: Babs Jensen sn: Jensen givenName: Barbara initials: BJJ title: manager, product development uid: bjensen mail: [email protected] telephoneNumber: +1 408 555 1862 facsimileTelephoneNumber: +1 408 555 1992 mobile: +1 408 555 1941 roomNumber: 0209 carLicense: 6ABC246 o: Siroe ou: Product Development departmentNumber: 2604 employeeNumber: 42 employeeType: full time preferredLanguage: fr, en-gb;q=0.8, en;q=0.7 labeledURI: http://www.siroe.com/users/bjensen My Home Page

Page 13: Koha Integration: LDAP

version: 1 dn: cn=Barbara Jensen,ou=Product Development,dc=siroe,dc=com objectClass: top objectClass: person objectClass: organizationalPerson objectClass: inetOrgPerson cn: Barbara Jensen cn: Babs Jensen displayName: Babs Jensen sn: Jensen givenName: Barbara initials: BJJ title: manager, product development uid: bjensen mail: [email protected] telephoneNumber: +1 408 555 1862 facsimileTelephoneNumber: +1 408 555 1992 mobile: +1 408 555 1941 roomNumber: 0209 carLicense: 6ABC246 o: Siroe ou: Product Development departmentNumber: 2604 employeeNumber: 42 employeeType: full time preferredLanguage: fr, en-gb;q=0.8, en;q=0.7 labeledURI: http://www.siroe.com/users/bjensen My Home Page

Page 14: Koha Integration: LDAP

version: 1 dn: cn=Barbara Jensen,ou=Product Development,dc=siroe,dc=com objectClass: top objectClass: person objectClass: organizationalPerson objectClass: inetOrgPerson cn: Barbara Jensen cn: Babs Jensen displayName: Babs Jensen sn: Jensen givenName: Barbara initials: BJJ title: manager, product development uid: bjensen mail: [email protected] telephoneNumber: +1 408 555 1862 facsimileTelephoneNumber: +1 408 555 1992 mobile: +1 408 555 1941 roomNumber: 0209 carLicense: 6ABC246 o: Siroe ou: Product Development departmentNumber: 2604 employeeNumber: 42 employeeType: full time preferredLanguage: fr, en-gb;q=0.8, en;q=0.7 labeledURI: http://www.siroe.com/users/bjensen My Home Page

Pick data Koha cares about

Page 15: Koha Integration: LDAP

version: 1 dn: cn=Barbara Jensen,ou=Product Development,dc=siroe,dc=com objectClass: top objectClass: person objectClass: organizationalPerson objectClass: inetOrgPerson cn: Barbara Jensen cn: Babs Jensen displayName: Babs Jensen sn: Jensen givenName: Barbara initials: BJJ title: manager, product development uid: bjensen mail: [email protected] telephoneNumber: +1 408 555 1862 facsimileTelephoneNumber: +1 408 555 1992 mobile: +1 408 555 1941 roomNumber: 0209 carLicense: 6ABC246 o: Siroe ou: Product Development departmentNumber: 2604 employeeNumber: 42 employeeType: full time preferredLanguage: fr, en-gb;q=0.8, en;q=0.7 labeledURI: http://www.siroe.com/users/bjensen My Home Page

Pick data Koha cares about

Page 16: Koha Integration: LDAP

sn: Jensen givenName: Barbara initials: BJJ uid: bjensen mail: [email protected] telephoneNumber: +1 408 555 1862 facsimileTelephoneNumber: +1 408 555 1992 mobile: +1 408 555 1941 roomNumber: 0209 o: Siroe departmentNumber: 2604 employeeNumber: 42 employeeType: full time

Pick data Koha cares about

Page 17: Koha Integration: LDAP

sn: Jensen givenName: Barbara initials: BJJ uid: bjensen mail: [email protected] telephoneNumber: +1 408 555 1862 facsimileTelephoneNumber: +1 408 555 1992 mobile: +1 408 555 1941 roomNumber: 0209 o: Siroe departmentNumber: 2604 employeeNumber: 42 employeeType: full time

Pick data Koha cares about

Page 18: Koha Integration: LDAP

Data Koha Cares About

• You define it with <ldapserver> <mapping> element in koha-conf.xml

• But some fields are required.

• And some of those are *really* required.

• See perldoc C4::Auth_with_ldap

Page 19: Koha Integration: LDAP

The <mapping> <mapping> <firstname is="givenname" ></firstname> <surname is="sn" ></surname> <address is="postaladdress" ></address> <city is="l" >Athens, OH</city> <zipcode is="postalcode" ></zipcode> <branchcode is="branch" >MAIN</branchcode> <userid is="uid" ></userid> <password is="userpassword" ></password> <email is="mail" ></email> <categorycode is="employeetype" >PT</categorycode> <phone is="telephonenumber"></phone> </mapping>

Page 20: Koha Integration: LDAP

The <mapping> <mapping> <firstname is="givenname" ></firstname> <surname is="sn" ></surname> <address is="postaladdress" ></address> <city is="l" >Athens, OH</city> <zipcode is="postalcode" ></zipcode> <branchcode is="branch" >MAIN</branchcode> <userid is="uid" ></userid> <password is="userpassword" ></password> <email is="mail" ></email> <categorycode is="employeetype" >PT</categorycode> <phone is="telephonenumber"></phone> </mapping>

<mapping> <firstname is="givenname" ></firstname> <surname is="sn" ></surname> <address is="postaladdress" ></address> <city is="l" >Athens, OH</city> <zipcode is="postalcode" ></zipcode> <branchcode is="branch" >MAIN</branchcode> <userid is="uid" ></userid> <password is="userpassword" ></password> <email is="mail" ></email> <categorycode is="employeetype" >PT</categorycode> <phone is="telephonenumber"></phone> </mapping>

Page 21: Koha Integration: LDAP

The <mapping> <mapping> <firstname is="givenname" ></firstname> <surname is="sn" ></surname> <address is="postaladdress" ></address> <city is="l" >Athens, OH</city> <zipcode is="postalcode" ></zipcode> <branchcode is="branch" >MAIN</branchcode> <userid is="uid" ></userid> <password is="userpassword" ></password> <email is="mail" ></email> <categorycode is="employeetype" >PT</categorycode> <phone is="telephonenumber"></phone> </mapping>

<mapping> <firstname is="givenname" ></firstname> <surname is="sn" ></surname> <address is="postaladdress" ></address> <city is="l" >Athens, OH</city> <zipcode is="postalcode" ></zipcode> <branchcode is="branch" >MAIN</branchcode> <userid is="uid" ></userid> <password is="userpassword" ></password> <email is="mail" ></email> <categorycode is="employeetype" >PT</categorycode> <phone is="telephonenumber"></phone> </mapping>

Page 22: Koha Integration: LDAP

The <mapping> <mapping> <firstname is="givenname" ></firstname> <surname is="sn" ></surname> <address is="postaladdress" ></address> <city is="l" >Athens, OH</city> <zipcode is="postalcode" ></zipcode> <branchcode is="branch" >MAIN</branchcode> <userid is="uid" ></userid> <password is="userpassword" ></password> <email is="mail" ></email> <categorycode is="employeetype" >PT</categorycode> <phone is="telephonenumber"></phone> </mapping>

Page 23: Koha Integration: LDAP

The <mapping> <mapping> <firstname is="givenname" ></firstname> <surname is="sn" ></surname> <address is="postaladdress" ></address> <city is="l" >Athens, OH</city> <zipcode is="postalcode" ></zipcode> <branchcode is="branch" >MAIN</branchcode> <userid is="uid" ></userid> <password is="userpassword" ></password> <email is="mail" ></email> <categorycode is="employeetype" >PT</categorycode> <phone is="telephonenumber"></phone> </mapping>

Koha fieldsin borrowers.*

Page 24: Koha Integration: LDAP

The <mapping> <mapping> <firstname is="givenname" ></firstname> <surname is="sn" ></surname> <address is="postaladdress" ></address> <city is="l" >Athens, OH</city> <zipcode is="postalcode" ></zipcode> <branchcode is="branch" >MAIN</branchcode> <userid is="uid" ></userid> <password is="userpassword" ></password> <email is="mail" ></email> <categorycode is="employeetype" >PT</categorycode> <phone is="telephonenumber"></phone> </mapping>

Koha fieldsin borrowers.*

Page 25: Koha Integration: LDAP

The <mapping> <mapping> <firstname is="givenname" ></firstname> <surname is="sn" ></surname> <address is="postaladdress" ></address> <city is="l" >Athens, OH</city> <zipcode is="postalcode" ></zipcode> <branchcode is="branch" >MAIN</branchcode> <userid is="uid" ></userid> <password is="userpassword" ></password> <email is="mail" ></email> <categorycode is="employeetype" >PT</categorycode> <phone is="telephonenumber"></phone> </mapping>

Koha fieldsin borrowers.*

Page 26: Koha Integration: LDAP

The <mapping> <mapping> <firstname is="givenname" ></firstname> <surname is="sn" ></surname> <address is="postaladdress" ></address> <city is="l" >Athens, OH</city> <zipcode is="postalcode" ></zipcode> <branchcode is="branch" >MAIN</branchcode> <userid is="uid" ></userid> <password is="userpassword" ></password> <email is="mail" ></email> <categorycode is="employeetype" >PT</categorycode> <phone is="telephonenumber"></phone> </mapping>

Koha fieldsin borrowers.*

LDAP fieldsin Schema

Page 27: Koha Integration: LDAP

The <mapping> <mapping> <firstname is="givenname" ></firstname> <surname is="sn" ></surname> <address is="postaladdress" ></address> <city is="l" >Athens, OH</city> <zipcode is="postalcode" ></zipcode> <branchcode is="branch" >MAIN</branchcode> <userid is="uid" ></userid> <password is="userpassword" ></password> <email is="mail" ></email> <categorycode is="employeetype" >PT</categorycode> <phone is="telephonenumber"></phone> </mapping>

Koha fieldsin borrowers.*

==>LDAP fieldsin Schema

Page 28: Koha Integration: LDAP

The <mapping> <mapping> <firstname is="givenname" ></firstname> <surname is="sn" ></surname> <address is="postaladdress" ></address> <city is="l" >Athens, OH</city> <zipcode is="postalcode" ></zipcode> <branchcode is="branch" >MAIN</branchcode> <userid is="uid" ></userid> <password is="userpassword" ></password> <email is="mail" ></email> <categorycode is="employeetype" >PT</categorycode> <phone is="telephonenumber"></phone> </mapping>

Koha fieldsin borrowers.*

==>LDAP fieldsin Schema

Page 29: Koha Integration: LDAP

The <mapping> <mapping> <firstname is="givenname" ></firstname> <surname is="sn" ></surname> <address is="postaladdress" ></address> <city is="l" >Athens, OH</city> <zipcode is="postalcode" ></zipcode> <branchcode is="branch" >MAIN</branchcode> <userid is="uid" ></userid> <password is="userpassword" ></password> <email is="mail" ></email> <categorycode is="employeetype" >PT</categorycode> <phone is="telephonenumber"></phone> </mapping>

Koha fieldsin borrowers.*

==>LDAP fieldsin Schema

Default Values

Page 30: Koha Integration: LDAP

Required Data: 3 Kinds

Page 31: Koha Integration: LDAP

Required Data: 3 Kinds

• Required by database

Page 32: Koha Integration: LDAP

Required Data: 3 Kinds

• Required by database

• Required for login

Page 33: Koha Integration: LDAP

Required Data: 3 Kinds

• Required by database

• Required for login

• Required by you

Page 34: Koha Integration: LDAP

Required by database

Easy:

• surname

• address

• city

mysql> show full columns from borrowers;-- field req`d where Null=NO

Page 35: Koha Integration: LDAP

Required by database

Easy:

• surname

• address

• city

Tricky:

• branchcode

• categorycode

mysql> show full columns from borrowers;-- field req`d where Null=NO

Page 36: Koha Integration: LDAP

Required by database

Easy:

• surname

• address

• city

Tricky:

• branchcode

• categorycode

mysql> show full columns from borrowers;-- field req`d where Null=NO

MUST MATCH VALIDKOHA VALUES

Page 37: Koha Integration: LDAP

Required by login

userid:

• can come fromfrom anything

• but it better beunique

Page 38: Koha Integration: LDAP

Required by login

userid:

• can come fromfrom anything

• but it better beunique

password:

• branchcode

• categorycode

Page 39: Koha Integration: LDAP

LDAPJoe Atzberger, LibLime

KohaCon 2009: Plano, TX

The End