UserPreferences

ApplicationNotes/SambaLdapIntegration


  1. Samba Primary and Backup Domain-Controller LDAP Integration
    1. Install Software
    2. Configure OpenLDAP master server
      1. Configure basic ''slapd.conf''
      2. Create skeleton directory tree
    3. Configure Samba primary domain controller
      1. Configure basic ''smb.conf''
      2. Add samba admin entry to ''secrets.tdb''
    4. Configure smbldap-tools
    5. Add Basic Data to LDAP
      1. Create a test entry
      2. Create well-known domain groups
    6. Test with client workstation
    7. Set up OpenLDAP slave server
    8. Set up Samba backup domain controller
    9. Install Webmin
      1. Add users with ''LDAP users and groups'' module

1. Samba Primary and Backup Domain-Controller LDAP Integration

I was recently given the opportunity to setup Samba 3 with LDAP to provide domain controller service to an organization. The organization has two offices connected by a VPN, which gets pretty slow at times. They were using Samba 2.2 at the headquarters as a Primary Domain Controller and using WINS to connect their remote office with headquarters over the VPN. They wanted to incorporate a new server at the remote office... more to come

1.1. Install Software

You'll need:

1.2. Configure OpenLDAP master server

1.2.1. Configure basic ''slapd.conf''

1.2.2. Create skeleton directory tree

Save the following example to a file called samba-skel.ldif, and substitute your domain name for dc=example,dc=com.
dn: dc=example,dc=com
objectClass: top
objectClass: domain
dc: example
                                                                                                                            
dn: ou=People,dc=example,dc=com
objectClass: top
objectClass: organizationalUnit
ou: People
                                                                                                                            
dn: ou=Group,dc=example,dc=com
objectClass: top
objectClass: organizationalUnit
ou: Group
                                                                                                                            
dn: ou=Computers,dc=example,dc=com
objectClass: top
objectClass: organizationalUnit
ou: Machines
                                                                                                                            
dn: cn=SambaAdministrator,dc=example,dc=com
userPassword: test
objectClass: top
objectClass: simpleSecurityObject
Now use the slapadd command to add inital structures to your directory:
# slapadd -l samba-skel.ldif
# chown ldap:ldap /var/lib/ldap/*

1.3. Configure Samba primary domain controller

1.3.1. Configure basic ''smb.conf''

Create an smb.conf based on this example:
[global]
   workgroup = EXAMPLE
   server string = Samba Server
                                                                                                                                                                      
   ; Domain Controller Requirements
   security = user
   domain master = yes
   domain logons = yes
   local master = yes
   preferred master = yes
   os level = 33
                                                                                                                                                                      
   ; LDAP Settings
   passdb backend = ldapsam:ldap://localhost
   ldap suffix = dc=example,dc=com
   ldap machine suffix = ou=Computers
   ldap user suffix = ou=People
   ldap group suffix = ou=Group
   ldap admin dn = cn=SambaAdministrator,dc=example,dc=com
   ldap passwd sync = yes
   ldap delete dn = yes
   passwd program = /usr/local/sbin/smbldap-passwd %u
   passwd chat = *New*password* %n\n *Retype*new*password* %n\n *all*authentication*tokens*updated*
   add user script = /usr/local/sbin/smbldap-useradd -m "%u"
   delete user script = /usr/local/sbin/smbldap-userdel "%u"
   add group script = /usr/local/sbin/smbldap-groupadd -p "%g"
   delete group script = /usr/local/sbin/smbldap-groupdel "%g"
   add user to group script = /usr/local/sbin/smbldap-groupmod -m "%u" "%g"
   delete user from group script = /usr/local/sbin/smbldap-groupmod -x "%u" "%g"
   set primary group script = /usr/local/sbin/smbldap-usermod -g "%g" "%u"
   add machine script = /usr/local/sbin/smbldap-useradd -w "%u"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  

1.3.2. Add samba admin entry to ''secrets.tdb''

Use the smbpasswd command to set the password for the Samba LDAP Administrator.
# smbpasswd -w abc123
Setting stored password for "cn=SambaAdministrator,dc=example,dc=com" in secrets.tdb

1.4. Configure smbldap-tools

1.5. Add Basic Data to LDAP

1.5.1. Create a test entry

1.5.2. Create well-known domain groups

1.6. Test with client workstation

1.7. Set up OpenLDAP slave server

1.8. Set up Samba backup domain controller

1.9. Install Webmin

1.9.1. Add users with ''LDAP users and groups'' module


Note that there's an obvious error above. Can you find it? [MAILTO]E-mail me if you find it