Showing posts with label ldap. Show all posts
Showing posts with label ldap. Show all posts

Thursday, September 13, 2012

UBUNTU: OPENLDAP INSTALLATION on UBUNTU SERVER


LDAP INSTALLATION ON UBUNTU SERVER
----------------------------------

Login to ubuntu server as root

1. Run update
   # apt-get update

2. Install ldap
   # apt-get install slapd ldap-utils

3. Create Administrator password
   Password: XXXXXX
   Confirm Password: XXXXXX

4. Change/Edit ldap.conf
   # cd /etc/ldap/
   # nano ldap.conf

5. Add this 2 line:
   BASE    dc=staff,dc=domain,dc=com,dc=my
   URI     ldap://localhost


6. Copy ldap.sh dari existing ldap server student ke staff server
   # cd /root/
   # scp name@www.mediu.edu.my:ldap.sh  ./

7. #nano ldap.sh

   Change passwd and first dc for staff
    passwd=XXXXXX
    dc1=staff
    dc2=domain
    dc3=com
    dc4=my

   Save

8. Run script
    #sh ldap.sh

   **If ldap ON
   # ldapadd -x -D cn=admin,dc=staff,dc=domain,dc=com,dc=my -W -f /tmp/database.ldif

   ** This script can be found in last line inside ldap.sh file. It will add the new schema to the

   **If ldap STOP/OFF
   # slapadd -x -D cn=admin,dc=staff,dc=domain,dc=com,dc=my -W -f /tmp/database.ldif

9. Check Database
   # more /tmp/database.ldif

10.Run slapcat
   # slapcat

11.If tak jadi, run dpkg-reconfigure slapd
   # dpkg-reconfigure slapd

12. Restart ldap
   # /etc/init.d/slapd restart

13. #slapcat
    #more /tmp/database.ldif

14. Add User in ldap
    # pico t
    ** Copy add user section from ldap.sh paste here:

#Adding user
dn: uid=ldap1,ou=people,dc=staff,dc=domain,dc=com,dc=my
objectClass: inetOrgPerson
objectClass: posixAccount
objectClass: shadowAccount
uid: ldap1
sn: Asdasd
givenName: ldap1
cn: ldap1 Asdasd
displayName: ldap1 asdasd
uidNumber: 1002
gidNumber: 1000
userPassword: $hash_pw
gecos: ldap1 asdasd
loginShell: /bin/bash
homeDirectory: /home/ldap1
shadowExpire: -1
shadowFlag: 0
shadowWarning: 7
shadowMin: 8
shadowMax: 999999
shadowLastChange: 10877
mail: aw@$dc1.$dc2
postalCode: 31000
l: Mysity
o: $dc1
mobile: +33 (0)6 22 22 22 22 22
homePhone: +33 (0)5 33 22 33 22
title: System Administrator
postalAddress:
initials: LP

Save

15. Create $hash password
# slappasswd
New password; ####
Confirm new password: ####

{SSHA}zQgJa0DFgsUa2Myd3z8Z08SsWOaOgkAS

Copy SSHA password and copy in pico t
-------------------------------------------------------------
dn: uid=ldap1,ou=people,dc=staff,dc=domain,dc=com,dc=my
objectClass: inetOrgPerson
objectClass: posixAccount
objectClass: shadowAccount
uid: ldap1
sn: Asdasd
givenName: ldap1
cn: ldap1 Asdasd
displayName: ldap1 asdasd
uidNumber: 1002
gidNumber: 1000
userPassword: {SSHA}zQgJa0DFgsUa2Myd3z8Z08SsWOaOgkAS
gecos: ldap1 asdasd
loginShell: /bin/bash
homeDirectory: /home/ldap1
shadowExpire: -1
shadowFlag: 0
shadowWarning: 7
shadowMin: 8
shadowMax: 999999
shadowLastChange: 10877
mail: aw@$dc1.$dc2
postalCode: 31000
l: Mysity
o: $dc1
mobile: +33 (0)6 22 22 22 22 22
homePhone: +33 (0)5 33 22 33 22
title: System Administrator
postalAddress:
initials: LP
---------------------------------------------------------------

Save

16.Then run script:
   # slapadd -l t
   # more /tmp/database.ldif
   # slapcat

17.Command to start & stop ldap

   # /etc/init.d/slapd stop
   # /etc/init.d/slapd start

18.Search ldap info
   # ldapsearch -x

Reference site:
https://help.ubuntu.com/11.04/serverguide/openldap-server.html
http://www.zarafa.com/wiki/index.php/Zarafa_LDAP_cn_config_How_To



*** If you have existing ldap server running, you might be compared the configuration between two server, old and new one. Good luck!

Additional command:
------------------

Check current Ubuntu version

#cat /etc/issue
Ubuntu 12.04 LTS \n \l

.


Sunday, June 24, 2012

MOODLE: Authentication Issue- CAS Login

Case: After Setting CAS & LDAP in Moodle, Admin/ local user cannot login anymore to Moodle.

Solution Step:
---------------

1. Go to database server.
2. Check setting in table mdl_config_plugins. Compare with existing running moodle db.
    #  SELECT * FROM mdl_config_plugins WHERE PLUGIN LIKE '%auth/cas%'


3. Change manually, db setting for mdl_config.
    #  UPDATE mdl_config SET VALUE = 'manual'  WHERE id='3'; 


4. Try open the site again and click Login.
    The local user may login now. But CAS user cannot.
    Login as moodle admin.

5. Go to CAS Setting Location:
    Settings > Site administration > Plugins > Authentication > Manage authentication

    ** Compare the setting with running moodle site.
        Found problem: 
cn dn setting in distinguish field.
        CAS   -  Need to put 
cn dn setting in Context field.
        LDAP -  Put 
cn dn setting in distinguish field.



6. Fix cn dn setting in CAS and LDAP.
    
Settings > Site administration > Plugins > Authentication > Manage authentication

   * Save setting for both.



7. Test open the site again and click Login.
    Now the login page back to normal. User can choose either to login using CAS or other user.

   * Thanks to Sis. Azlinda for the fast investigation & solution has been taken. Caiyok!!



.