Linux-Microsoft Samba LDAP Setup Guide
Linux-Microsoft Samba LDAP Setup Guide
htm#summary
AFPAMEUDON CENTER
Centre Yves Bodiguel - 12/14 Avenue du Maréchal Juin
Vélizy Industrial Zone
MINIPROJECT:
Linux-Microsoft Interoperability
File sharing and authentication
SAMBA 3 / LDAP
Created by:
AlexFALZON
[Link]@[Link]
Michaël VILLAR
villar.m@[Link]
Press edit
to access
the publisher
of the interface
°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
Return to the cover page
°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
SUMMARY
INTRODUCTION:
SPECIFICATIONS:
TEST PLATFORM STRUCTURE:
ADOPTED METHOD:
INSTALLATION OF OPENLDAP :
OPENLDAP CONFIGURATION:
Customize the configuration of the [Link] file:
STARTING LDAP SERVER:
Verification of active processes:
Identification of the listening port:
SAMBACONFIGURATION:
- Editing the file /etc/samba/[Link] :
Initialization of the LDAP password:
Starting Samba:
MANAGE ACCOUNTS:
Add a machine account to connect:
Addition of an administrator account to our domain:
Adding user groups:
Adding users to these groups:
-Modification of its properties (Samba):
Verification of users present in the database:
The POSTELDAP machine can now be joined to the MICALEX domain with the users smbadmin, userdir1, usercom1, and usertec1.
CONCLUSION:
ANNEX 7: BIBLIOGRAPHY
°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
Introduction:
This project is carried out as part of a training program at the AFPA center Yves Bodiguel in Meudon la forêt.
The tools and techniques used are those found in March 2005.
Specifications:
A company with a heterogeneous IT infrastructure (Linux and Windows clients) wants to centralize the user database, both for the
search for information on users only for authentications.
This database (directory) will need to be quickly accessible, and that Windows/Linux clients can authenticate on any
network station, and that client/server authentication communications are secured and encrypted.
The chosen products are free for the Fedora Linux OS, and for the LDAP server, OpenLDAP.
For the installation of this platform, we will use three identical machines connected to an Ethernet network:
er
Logical structure: .......... on 1:
Samba PDC and LDAP server under Fedora core3
on the 2 and:
- WindowsXP pro sp2 + VMware
in virtual Samba PDC and LDAP server on Fedora Core 3
Method adopted:
The er
1 server allows for post-search testing.
The 2ndallows for the 'clean' setup of the final system and captures for the report.
The ème
3 test the Microsoft and Linux station.
LDAP (Lightweight Directory Access Protocol) is the TCP/IP version of the DAP protocol, the latter being the protocol for accessing the
OSI protocol of the X500 directory service.
Dans un premier tempsLDAPs'est contenté d'être l'interface à des annuaires X500, mais maintenantLDAPpeut gérer complètement les
bases (standaloneLDAP).
setting up a Samba LDAP server [Link]
- For Linux:
- For Windows:
setting up a Samba LDAP server [Link]
The standalone LDAP uses the LDBM database format. Each entry is uniquely known in the tree thanks to
to Sondn (Distinguished Name).
Indicate the path to follow to reach the corresponding entrance starting from the top (example: dn = Isabelle
Bourdais technique Boulogne [Link]
The attributes
Each DSE entry can be considered as an object, therefore possessing certain attributes, for example if a person is an entry, the
Attributes can include first name, last name, age, .... It is also possible to define mandatory attributes (MUST) and others that are optional (MAY).
Object classes
We group objects that are in the same domain into a class of objects, which is characterized by mandatory or attributes.
optional and untyped.
typestructurel
classes of concrete objects from the directory (people, groups of people, ...)
auxiliary type
classes of objects that can be created to add additional attributes to already existing structural object classes.
In C++, it will be said that the auxiliary class derives from a structural class.
abstract type
default object classes that have no concrete meaning
for example, the top class is the generic object class.
All other classes derive from this class.
All other object classes derive from the class top (the root). Each class inherits the properties of a parent class and has
additional attributes compared to the latter.
setting up a Samba LDAP server [Link]
The diagrams
A schema describes all the rules used by the LDAP server to define object classes (attributes, syntax, ...).
Select 'delete all Linux partitions from the system' and confirm.
Select 'advanced options configuration of the boot loader' on the 'boot loader configuration' page.
Select 'force the use of LBA32' on the 'advanced bootloader configuration' page.
Select French on the 'other language' page and your time zone (Europe/Paris) in the
Installation of OpenLDAP:
We installed OpenLDAP using the packages available during the installation of Linux Fedora Core 3:
· [Link]
Note:
If the distribution used does not contain the original package, it must then be downloaded from the site:[Link]
Once downloaded, the package must be installed:
root#rpm -i [Link]
Retrieve the [Link] file by downloading it from the following address ([Link] lesmbldap-installer
from Matt Oquist (Software Engineering Consultant).
Put this schema in /etc/openldap/schema/
OpenLDAP configuration:
#SIZELIMIT 12
#TIMELIMIT 15
#DEREF never
HOST [Link]
BASE dc=micalex,dc=fr
Note:
The most important file of openldap is the [Link] (see appendix 1).
This file defines the basic configuration of the ldap directory.
°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
Introduction:
Specifications:
Machine container
dn: ou=Computers,dc=micalex,dc=fr
objectclass: top
objectclass: organizationalUnit
you: Computers
Administrator
dn: cn=admin,ou=Users,dc=micalex,dc=fr
admin
objectclass: top
objectclass: organizationalRole
objectclass: simpleSecurityObject
userPassword: {SSHA}aVF+ESI/rloVCQsmLqYinLlkh/v1krej
-Confirmation of insertions:
adding new entry "dc=micalex,dc=fr"
adding new entry "cn=Manager,dc=micalex,dc=fr"
adding new entry "ou=Users,dc=micalex,dc=fr"
adding new entry "ou=Machines,dc=micalex,dc=fr"
adding new entry "cn=admin,ou=Users,dc=micalex,dc=fr"
Index generation:
[root@srvldapv]#slapindex -f /etc/openldap/[Link]
[Link]
dc=micalex,dc=fr
objectClass: dcObject
objectClass: organization
dc: micalex
Samba 3
description: Samba 3
Manager, [Link]
dn: cn=Manager,dc=micalex,dc=fr
objectClass: organizationalRole
Manager
description: LDAP Manager
# Users, [Link]
dn: ou=Users,dc=micalex,dc=fr
objectClass: top
objectClass: organizationalUnit
you: Users
Machines, [Link]
dn: ou=Machines,dc=micalex,dc=fr
objectClass: top
objectClass: organizationalUnit
You: Machines
# search result
search: 2
setting up a Samba LDAP server [Link]
result: 0 Success
# numResponses: 6
# numEntries: 5
[Link]
[root@srvldapv]#rpm -i
Verify with:
[root@srvldapv]#ls /var/www/html/
Check its proper functioning, you should land on the Apache test page with:
[Link]
___________________________________________________
Rename it with:
[root@srvldapv]#cp /var/www/html/phpldapadmin-0.9.5/[Link] /var/www/html/phpldapadmin-0.9.5/[Link]
1) Open Webmin, click on Servers, then Apache, and finally Per-Directory Options Files.
/var/www/html/php
[Link] .
Samba Configuration:
[tmp]
comment = Partage des fichiers temporaires
path = /tmp
read only = no
writable = yes
guest ok = yes
[root@srvldapv]#smbpasswd -w micalex
Setting stored password for "cn=Manager,dc=micalex,dc=fr" in [Link]
Starting Samba:
Manage accounts:
Note:
This account will be used for all operations performed with the net command and for joining the Windows machine to the domain.
[root@srvldapv]#groupadd direction(Unix)
[root@srvldapv]#groupadd commercial(Unix)
[root@srvldapv]#groupadd technique(Unix)
Definition of profile directories and home directories as well as the setup of scripts and a network drive letter for the user:
userdir1
[root@srvldapv]#pdbedit -r --profile=\\ SRVLDAPV \profiles\userdir1 --homedir =\\SRVLDAPV\userdir1--script=[Link]
--drive=U: userdir1
usercom1
[root@srvldapv]#pdbedit -r --profile=\\ SRVLDAPV \profiles\usercom1 --homedir =\\SRVLDAPV\usercom1--script=[Link]
--drive=U: usercom1
usertec1
[root@srvldapv]#pdbedit -r --profile=\\ SRVLDAPV \profiles\usertec1 --homedir =\\SRVLDAPV\usertec1--script=[Link]
--drive=U: usertec1
[root@srvldapv]#pdbedit -vL
Or via phpldapadmin:
[root@srvldapv]#mkdir -p /export/samba-test/homes/userdir1
[root@srvldapv]#chown userdir1:direction /export/samba-test/homes/userdir1
[root@srvldapv]#chmod 700 /export/samba-test/homes/userdir1
[root@srvldapv]#mkdir -p /export/samba-test/homes/usercom1
[root@srvldapv]#chown userdir1:direction /export/samba-test/homes/usercom1
[root@srvldapv]#chmod 700 /export/samba-test/homes/usercom1
[root@srvldapv]#mkdir -p /export/samba-test/homes/usertec1
[root@srvldapv]#chown userdir1:direction /export/samba-test/homes/usertec1
[root@srvldapv]#chmod 700 /export/samba-test/homes/usertec1
-Management of rights and creation of the directories userdir1, usercom1, usertec1 in /export/samba-test/profiles/:
[root@srvldapv]#mkdir -p /export/samba-test/profiles/userdir1
[root@srvldapv]#chown userdir1:direction /export/samba-test/profiles/userdir1
[root@srvldapv]#chmod 700 /export/samba-test/profiles/userdir1
[root@srvldapv]#mkdir -p /export/samba-test/profiles/usercom1
[root@srvldapv]#chown usercom1:commercial /export/samba-test/profiles/usercom1
[root@srvldapv]#chmod 700 /export/samba-test/profiles/usercom1
[root@srvldapv]#mkdir -p /export/samba-test/profiles/usertec1
[root@srvldapv]#chown usertec1:technique /export/samba-test/profiles/usertec1
[root@srvldapv]#chmod 700 /export/samba-test/profiles/usertec1
The POSTELDAP machine can now be joined to the MICALEX domain with the users smbadmin, userdir1, usercom1 and
usertec1.
setting up an LDAP Samba server [Link]
setting up a Samba LDAP server [Link]
· Windows Posts:
Note:
In order for the Windows machines to be authenticated, they need to belong to the NT Domain (MICALEX) that we have created.
[root@srvldapv]#useradd POSTE07$
[root@srvldapv]#smbpasswd -a -m POSTE07
2) Select properties
4) SelectEdit...
Select 'Domain' in 'member of:' and enter the name of the NT Domain you want
7) Restart the workstation and then use an existing account under Samba (userdir1, usercom1,…) to log in to the workstation.
· Linux Posts:
Note:
In order for Linux stations to authenticate on the LDAP directory, we use PAM (Pluggable Authentication Modules) which will allow us to
define the levels and methods of authentication.
PAM is an authentication service that requires the accounts that need to authenticate on the LDAP directory to exist locally.
For the configuration of the PAM service on client workstations, we use the GUI: Webmin.
-Procedure:
1) Connecting to Webmin in secure mode (https). The root account of the client machine is used.
To use this tool, type in Firefox: [Link]
Indeed, the password is well encrypted.(even encrypted, they are precious... Many tools can be found to 'break' them...), but not theSID,
the GID and the UID are transmitted in clear on the network. To meet the specifications we have chosen the solution of encrypted authentication with
TLS.
setting up a Samba LDAP server [Link]
A simple way to secure our transactions is to use TLS (Transport Layer Security, formerly SSLv3.0, renamed and
normalized by the IETF, see RFC2246), which will ensure the encryption of data
Note:
For the authentication to be encrypted, it is necessary to use the secure communication protocol TLS. It uses a certificate for authentication.
between the client station and the LDAP server.
1) In the directory /etc/openldap, create a directory 'cert' that will contain the keys and the certificate:
[root@srvldapv]#mkdir /etc/openldap/cert
3) Then the public key and the certificate request (in [Link]):
Correctly complete the information that is requested from you. Remember to properly enter the CN (Common Name) as the FQDN.
The (full DNS name) of your server will be used when clients query the LDAP database.
Note:
To enable TLS communications, the [Link] file must be modified. There are two types of directives:
· the pure OpenLDAP directives (see Annex 6)
· the directives added by libpam_ldap and libnss_ldap.
4) On the LDAP server ([Link]), modify /etc/openldap/[Link] and add the paths to the different keys and the certificate:
TLS
Path to the LDAP server certificate
TLSCertificateFile /etc/openldap/cert/[Link]
Path to the private key of the LDAP server
TLSCertificateKeyFile /etc/openldap/cert/[Link]
Path to the CA certificate
TLSCACertificateFile /etc/openldap/cert/[Link]
6) The 'cacert' file (This is the certificate) must be present on the station's disk. It should be copied to the correct location (here /etc/openldap/cert/)
from our LDAP server.
Thanks to this method, the sniffing of the message no longer brings any critical information:
Conclusion:
This Windows and Linux interoperability project made us realize the authentication difficulties for
heterogeneous systems. It was necessary to implement a strategy that allows us to unify user account management while ensuring a level of
acceptable security for authentication.
We have therefore chosen two different authentication strategies based on a single account base:
- For Windows, we opted for an NT domain with a Samba 3 controller using an LDAP directory as the account base.
- For Linux, we have chosen direct authentication of user accounts on an LDAP directory.
It was necessary to ensure a secure dialogue for authentication, initially between Windows and Samba 3 and an encrypted dialogue by TLS for Linux.
and LDAP.
We have noticed a security vulnerability when using roaming profiles because the transfer of files from the server to the workstation occurs in
clear.
For graphical administration, we chose interfaces that allow remote administration. This administration is
secured by the use of secure connections: HTTPS protocol.
OpenLDAP : PhpLDAPadmin
Samba 3 : Webmin
The Webmin interface also allows for system administration from any Linux machine, we can manage the level
authentication of any process via PAM.
Certain software offers us the possibility to further refine security. For example, the NuFW firewall is capable of managing rules of
filters based on users. For each connection request packet, it can use the LDAP directory to authenticate the user. The
setting up a Samba LDAP server [Link]
Performance tests demonstrate the effectiveness and speed of this method. Many other software solutions are based on this.
stable and free technique.
Thanks to this project, we were able to see that interoperability in a heterogeneous environment is possible but remains a cumbersome solution to implement.
It requires extreme finesse in configuration to provide an acceptable level of security.
#
See [Link](5) for details on configuration options.
This file should NOT be world readable.
#
include /etc/openldap/schema/[Link]
include /etc/openldap/schema/[Link]
include /etc/openldap/schema/[Link]
include /etc/openldap/schema/[Link]
pidfile /var/run/[Link]
argsfile /var/run/[Link]
The next three lines allow use of TLS for encrypting connections using a
# dummy test certificate which you can generate by changing to
/usr/share/ssl/certs, running "make [Link]", and fixing permissions on
[Link] so that the ldap user or group can read it. Your client software
may balk at self-signed certificates, however.
# TLSCACertificateFile /usr/share/ssl/certs/[Link]
# TLSCertificateFile /usr/share/ssl/certs/[Link]
# TLSCertificateKeyFile /usr/share/ssl/certs/[Link]
#######################################################################
ldb and/or bdb database definitions
#######################################################################
database bdb
suffix dc=my-domain,dc=com
rootdn cn=Manager,dc=my-domain,dc=com
Cleartext passwords, especially for the rootdn, should
# be avoided. See slappasswd(8) and [Link](5) for details.
Use of strong authentication encouraged.
root password secret
root password {crypt}ijFYNcSNctBYg
#
See [Link](5) for details on configuration options.
This file should NOT be world readable.
#
include /etc/openldap/schema/[Link]
include /etc/openldap/schema/[Link]
include /etc/openldap/schema/[Link]
include /etc/openldap/schema/[Link]
#include /etc/openldap/schema/[Link]
#include /etc/openldap/schema/[Link]
#include /etc/openldap/schema/[Link]
#include /etc/openldap/schema/[Link]
#include /etc/openldap/schema/[Link]
pidfile /var/run/[Link]
argsfile /var/run/[Link]
The next three lines allow use of TLS for encrypting connections using a
# dummy test certificate which you can generate by changing to
/usr/share/ssl/certs, executing "make [Link]", and correcting permissions on
[Link] so that the ldap user or group can read it. Your client software
may balk at self-signed certificates, however.
# TLSCACertificateFile /usr/share/ssl/certs/[Link]
# TLSCertificateFile /usr/share/ssl/certs/[Link]
# TLSCertificateKeyFile /usr/share/ssl/certs/[Link]
#######################################################################
ldb and/or bdb database definitions
#######################################################################
database bdb
setting up an LDAP Samba server [Link]
suffix dc=micalex,dc=fr
rootdn cn=Manager,dc=micalex,dc=fr
Cleartext passwords, especially for the rootdn, should
# be avoided. See slappasswd(8) and [Link](5) for details.
Use of strong authentication encouraged.
root password {CRYPT}avMFiNMraPfxQ
root password ijFYNcSNctBYg
Then on the LDAP server modify /etc/openldap/[Link] and add the paths to the various keys and the certificate for
authentication via TLS:
TLS
Path to the LDAP server certificate
TLSCertificateFile /etc/openldap/cert/[Link]
Path to the private key of the LDAP server
TLSCertificateKeyFile /etc/openldap/cert/[Link]
Path to the CA certificate
TLS CACertificate File /etc/openldap/cert/[Link]
<?php
/*
* The phpLDAPadmin config file
*
* This is where you customize phpLDAPadmin. The most important
* part is immediately below: The 'LDAP Servers' section.
* You must specify at least one LDAP server there. You may add
* as many as you like. You can also specify your language, and
* many other options.
*
*/
/**
phpLDAPadmin can encrypt the content of sensitive cookies if you set this
* to a big random string.
*/
$blowfish_secret = '';
$servers[$i]['unique_attrs_dn'] = '';
If you set this, then phpldapadmin will bind to LDAP with this user
when testing for unique attributes (as set in unique_attrs array). If you
want to enforce unique attributes, then this id should have full (readonly)
access to the attributes in question (the logged in user may not have
enough access)
$servers[$i]['unique_attrs_dn_pass'] = '';
The password for the dn above
The [Link] file is quite substantial. But since the rest does not require modification, we have not presented it in its entirety.
[global]
passdb backend = ldapsam:ldap://[Link], guest
ldap admin dn = cn=Manager,dc=micalex,dc=fr
ldap ssl = off
ldap delete dn = no
ldap user suffix = ou=Users
ldap machine suffix = ou=Computers
ldap group suffix = ou=Groups
ldap suffix = dc=micalex,dc=fr
workgroup = MICALEX
netbios name = SRVLDAPV
server string = SRVLDAPV
encrypt passwords = yes
os level = 65
domain master = Yes
local master = Yes
security = user
[tmp]
comment = Partage des fichiers temporaires
path = /tmp
read only = no
writable = yes
guest ok = yes
Annex 5: glossary
ACL (Access Control List): List specifying the rights assigned to one or more actors (e.g., a user) over a resource (e.g., a file).
BDC (Backup Domain Controller): Secondary domain controller, takes over from the PDC in case of failure. A term specific to an NT domain.
Class: allows you to define the characteristics of a family of objects by specifying mandatory attributes and/or possible optional attributes. There
the possibility of inheritance between classes, multiple or not, for LDAP objects (For a subclass, automatic retrieval of attributes defined in the
upper classes from which it inherits). All classes inherit from the Top class, which is the top class of the class hierarchy (only one
attribute: objectClass.
DC (Domain Controller): Generic term used to refer to a domain controller, whether it is a PDC, BDC (NT), or has no level.
of particular importance (Active Directory).
DIB (Directory Information Base): A LDAP/X.500 directory is a collection of information of all categories. This information is stored
in the 'Directory Information Base' or DIB. The DIB is made up of entries, the content of which is governed by the concepts of object and classes.
DIT (Directory Information Tree): An LDAP/X.500 tree is organized in a hierarchical manner, starting from a single root named 'root'. This
root can be seen as a null entry (empty object).
DN(Distinguish Name) : Au sein d'un annuaire LDAP, représente le nom et le chemin d'un objet.
Example: "cn=Users,ou=Groups,dc=martymac,dc=com".
LDAP Entries: LDAP entries are a collection of attributes. Each attribute describes a specific type of information and can contain a
or several values (It is said that an attribute can be multi-valued). Each type of attribute is associated with a specific syntax that provides the possible format of
its values.
GID (Group Identifier): A numeric identifier representing a group of users under Unix.
LDAP (Lightweight Directory Access Protocol): Lightweight adaptation of the X500 protocol. Protocol for managing network directories.
NetBios (Network Basic Input/Output System): is not a protocol. Method of communication over an existing protocol; is actually a layer.
intermediary between SMB and an underlying protocol such as TCP (cf. NBT) or IPX. It operates at layer 5 (session) of the OSI model. Provides a
name and service resolution method for upper layers. Uses a 15 character machine name model + 1 character of
control specifying the services offered by the machines. NetBios was developed in 1983 by Sytec Inc. for IBM.
setting up an LDAP Samba server [Link]
NSS (NSSwitch, Name Service Switch): Mechanism that intercepts name requests made by the machine (concerning the names of
machines, users: see getent, ...) and redirects them to different sources of information (LDAP, MySQL...). Works with different modules.
LDAP Objects: The concept of an object allows for the abstract representation of any type of existing information or entity. An object class is a family
of objects having certain common characteristics.
OIDs (Object Identifiers): Object Identifiers are unique sequences of numbers that are used to reliably identify a type of data.
OIDs are used to designate the identity of classes, attribute types, and possible syntaxes of these attributes. OIDs are formed from
the hierarchy specified by the OSI, globally (in the same way as the objects described in the MIBs...)
PAM (Pluggable Authentication Modules): Module-based authentication mechanism. It is thus possible to use all kinds of sources of
data (passwd file, LDAP, biometrics...) to validate a user.
PDC (Primary Domain Controller): Primary Domain Controller. A term specific to an NT domain.
SAM (Security Account Manager): Database containing security information on a Windows NT server, including accounts and
user passwords.
Schema: The schema of a directory is a set of rules that must be used by the tree manager (DIB and DIT) to restrict the
possibilities for creating and structuring entries.
SID (Security Identifier): A SID is a unique identifier assigned to each entity in a Windows domain. It is composed of a part called 'SID
local", which identifies the domain, and a second one called "RID" (Relative Identifier), which identifies the actor (user/group/machine) within
of the domain: an example of a SID could be: S-1-5-21-3493456274-4211610059-1786859526-512 which identifies the Administrators group of
domain (512) within the domain S-1-5-21-3493456274-4211610059.
TLS (Transport Layer Security): Formerly SSLv3.0, renamed and standardized by the IETF, see RFC2246. Secure conversation protocol for
attack an LDAP server.
UNC (Universal Naming Convention): Universal naming convention (under Windows) used to designate the path of a directory.
shared. E.g.: \Server
older.
X500: Standard designed by telecom operators to interconnect their telephone directories.
Ldapcompare opens a connection to the LDAP server and compares according to the specified parameters.
ldapdelete Open a connection to the LDAP server and delete one or more entries.
open a connection
ldap modify relative distinguished nameto the LDAP server and modify the RDN of the entries.
ldapsearch Open a connection to the LDAP server and perform a search according to the specified parameters.
ldapwhoami Open a connection to the LDAP server and perform a whoami operation.
slapadd is used to add specified entries in LDAP Directory Interchange Format (LDIF) into
a slapd database.
slapcat is used to generate an LDAP LDIF output based on the content of a slapd database.
slap index is used to regenerate the slapd indexes according to the current content of a database.
liblber and libldap These libraries support LDAP programs and provide functionality for others.
programs interacting with LDAP.
Annex 7: Bibliography
General:
[Link]
[Link]
[Link]
[Link]
[Link]
Howtos :
[Link]
[Link]
[Link]
Administration :
[Link]
MIB :
[Link]