Member Login
Most Read Articles
- Making Ubuntu/Nvidia recognize your widescreen (1366x768) resolution
- OpenLDAP and Samba PDC
- Cisco Router: DS3/T3 Error Events Troubleshooting
- Cisco Router: How to Loop the NIU in a Channelized DS3
- Cisco Router: Enabling logging and Changing router's service timestamp
- Cisco Router: How to monitor IP traffic
- Cisco Router: Performing BER Test on a T1 Line in a Channelized DS3
| OpenLDAP and Samba PDC |
|
|
| Articles and Blogs - Linux Apache MySQL PHP | |||||||||||||||||||||||||||||||||
| Written by Joel Gacosta | |||||||||||||||||||||||||||||||||
| Tuesday, 16 June 2009 17:26 | |||||||||||||||||||||||||||||||||
|
This article describes how to set up a Windows domain using Samba with OpenLDAP as the primary domain controller that stores Windows account information in Ubuntu 8.04 Server LTS. This provides a central authentication point for Windows users on the network, thus avoiding the need to manage local user accounts on every Windows PC. It can also allow the use of roaming profiles, where a user can log onto any Windows PC on the network and have the same personal settings in each session. 1. Install OpenLDAP
Initially configure OpenLDAP:
2. Install SAMBA
3. Configure OpenLDAP for SAMBA use
Edit the '/etc/ldap/slapd.conf' and add the following lines where the other 'includes' line are
4. Configure SAMBA
Give SAMBA the admin password to the LDAP tree
5. Configure the SMBLDAP -TOOLS Package
Get the SID for SAMBA domain
Edit the file '/etc/smbldap-tools/smbldap_bind.conf' so that the ff information is correct
|
| smbldap-populate -u 30000 -g 30000 |
At the password propmpt, just type your root password.
Verify that the directory has an information in it by running the ff command
| ldapsearch -x -b dc=gacosta-net | less |
8. Index the LDAP Database for Speed
Although, the LDAP system will function without indexes defined in '/etc/ldap/slapd.conf', performance will decrease as the number of users increases and warnings will be reported to '/var/log/syslog' like shown below.
| Sep 9 19:34:24 Thich slapd[4929]: <= bdb_equality_candidates: (uidNumber) not indexed Sep 9 19:34:24 Thich slapd[4929]: <= bdb_equality_candidates: (uniqueMember) not indexed Sep 9 19:34:25 Thich slapd[4929]: <= bdb_equality_candidates: (gidNumber) not indexed Sep 9 19:34:25 Thich slapd[4929]: <= bdb_equality_candidates: (memberUid) not indexed Sep 9 19:34:25 Thich slapd[4929]: <= bdb_equality_candidates: (uid) not indexed Sep 9 17:39:12 Thich slapd[4929]: <= bdb_equality_candidates: (sambaGroupType) not indexed Sep 9 17:39:12 Thich slapd[4929]: <= bdb_equality_candidates: (sambaSIDList) not indexed Sep 9 17:39:12 Thich slapd[4929]: <= bdb_equality_candidates: (sambaSID) not indexed |
The following index definitions have been copied from '/usr/share/doc/smbldap-tools/examples/slapd.conf.gz', but I have removed indexes to attributes that don't exist in my database (eg. nisMapName). This text should be pasted into '/etc/ldap/slapd.conf' in the database definitions section (ie. after the first database directive).
| # Indices to maintain for this database index objectClass eq,pres index ou,cn,sn,mail,givenname eq,pres,sub index uidNumber,gidNumber,memberUid eq,pres index loginShell eq,pres # I also added this line to stop warning in syslog .. index uniqueMember eq,pres ## required to support pdb_getsampwnam index uid pres,sub,eq ## required to support pdb_getsambapwrid() index displayName pres,sub,eq # These attributes don't exist in this database .. #index nisMapName,nisMapEntry eq,pres,sub index sambaSID eq index sambaPrimaryGroupSID eq index sambaDomainName eq index default sub |
Following this, stop the LDAP server, run slapindex, and restart the LDAP server.
| /etc/init.d/slapd stop Stopping OpenLDAP: slapd. slapindex WARNING! Runnig as root! There's a fair chance slapd will fail to start. Check file permissions! /etc/ldap/slapd.conf: line 128: rootdn is always granted unlimited privileges. /etc/ldap/slapd.conf: line 145: rootdn is always granted unlimited privileges. # Correct the ownership of the index files .. chown openldap:openldap /var/lib/ldap/* /etc/init.d/slapd start Starting OpenLDAP: slapd |
9. Add an LDAP User to the System
Use the 'smbldap-useradd' tool to add a new Samba account in our LDAP. Example of adding user 'joel'
| smbldap-useradd -a -m -P joel |
Here is an explanation of the command switches that we used.
-a allows Windows as well as Linux login
-m makes a home directory, leave this off if you do not need local access
-P prompt for new password
You can also add root and our newly created user account to Windows Administrators group using the ff command
| /usr/sbin/smbldap-groupmod -m 'root' 'Administrators' /usr/sbin/smbldap-groupmod -m 'joel' 'Administrators' smbldap-groupshow Administrators |
10. Configure the Server to Use LDAP Authentication
Install the necessary packages
| apt-get install auth-client-config libpam-ldap libnss-ldap |
Edit '/etc/ldap.conf' and configure the ff according to your setup
| host 127.0.0.1 base dc=gacosta-net uri ldap://127.0.0.1/ rootbinddn cn=admin,dc=gacosta-net bind_policy soft |
Copy the 'etc/ldap.conf' to '/etc/ldap/ldap.conf'
|
cp /etc/ldap.conf /etc/ldap/ldap.conf |
Create a new file in '/etc/auth-client-config/profile.d/open_ldap:'
| nano /etc/auth-client-config/profile.d/open_ldap |
And insert the following contents
| [open_ldap] nss_passwd=passwd: compat ldap nss_group=group: compat ldap nss_shadow=shadow: compat ldap pam_auth=auth required pam_env.so auth sufficient pam_unix.so likeauth nullok auth sufficient pam_ldap.so use_first_pass auth required pam_deny.so pam_account=account sufficient pam_unix.so account sufficient pam_ldap.so account required pam_deny.so pam_password=password sufficient pam_unix.so nullok md5 shadow use_authtok password sufficient pam_ldap.so use_first_pass password required pam_deny.so pam_session=session required pam_limits.so session required pam_mkhomedir.so skel=/etc/skel/ session required pam_unix.so session optional pam_ldap.so |
Backup '/etc/nsswitch.conf' and '/etc/pam.d/' files
|
cp /etc/nsswitch.conf /etc/nsswitch.conf.original cd /etc/pam.d/ |
Enable the new LDAP Authentication Profile by executing the following command at /etc/auth-client-config/profile.d/:
| auth-client-config -a -p open_ldap |
Restart the server and try to add a Windows XP (Professional edition) computer to your new domain.






















