Installing a test server

  1. Installing the machine

    We have unattended installs that create a Debian Lenny with accounts, firewalling, logging, yada yada yada. We run such an install on a virtual machine.

  2. Creating a filesystem for Samba to export

    We use XFS under Samba, and on this test machine, we steal /srv, and convert it to XFS...

  3. Adding the backports repository

    Since our new Samba will have to come from the backports repository, we'll add that:

    At this point, no packages should be listed for upgrade, as the default version is still lenny, not lenny-backports

  4. Installing Samba

  5. Configuring Samba for use with the LDAP server

    1. Copying Samba settings

      We copy the smb.conf of to /etc/samba/smb.conf, and run testparm on it for good measure. Then we restart the Samba server:

    2. Making getent work on the server

      In order for the Samba server to work, the account the Samba clients use to log in with must be known as system users on the server. So getent must resolve them. We install the packages:

      ... configure /etc/nsswitch.conf:

        <snip>
      passwd:         files db
      group:          files db
      shadow:         files ldap
        <snip>
      	      

      ... configure /etc/ldap/ldap.conf:

      SIZELIMIT   0
      TIMELIMIT   0
      URI         ldaps://ldapserver.mydomain.com
      BASE        ou=my,o=domain,c=nl
      TLS_CACERT  /etc/ssl/certs/ca-certificates.crt
      TLS_REQCERT allow
      	      

      ... configure /etc/libnss-ldap.conf:

      debug 10
      uri ldaps://ldapserver.mydomain.com
      ldap_version 3
      bind_policy soft
      timelimit 10
      bind_timelimit 6
      ssl on
      tls_checkpeer no
      tls_cacertfile /etc/ssl/certs/ca-certificates.crt
      base ou=my,o=domain,c=nl
      scope sub
      binddn cn=accounter,ou=my,o=domain,c=nl
      bindpw verysecretofcourse
      pam_login_attribute uid
      pam_password md5
      pam_min_uid 70000
      pam_max_uid 9999999999
      	      

      ... update the credentials cache:

      ... and test whether it works (it does):

  6. Enabling LDAP lookup of Samba accounts

    In /etc/samba/smb.conf, set ldap ssl to no:

    <snip>
    ldap ssl = no
    passdb backend = ldapsam:ldaps://ldapserver.mydomain.com
    <snip>
    	  

    This is necessary because the LDAP URI already specifies ldaps://, and with ldap ssl set to yes the Samba daemon will try to start the TLS layer twice, resulting in an error that would be harmless to the communication, but the Samba daemon drops the connection because of it anyway.

    ... now create /var/lib/samba/secrets.tdb by using:

  7. Verify that your setup works