Samba 4 Provision Command Attribute
Samba 4 Provision Command Attribute
Samba can be configured to use an LDAP server (389 DS or OpenLDAP) as its backend
database. Currently the provisioning tool always creates a new (internal) LDAP server, it cannot
use an existing (external) LDAP server.
Simplicity. The provisioning tool creates and configures the LDAP server, no manual
configuration needed.
Automation. Samba test can create and destroy LDAP servers automatically.
Security. All LDAP server files can be stored in a private directory.
Exclusivity. The LDAP server will not be shared so there will be no interference or
conflicts with other applications.
Efficiency. The communication will be done via Unix domain socket (LDAPI).
On the other hand, external LDAP server has the following advantages:
Configurability. The LDAP administrator has full control of the configuration and
management.
Troubleshooting. It's easier to isolate a problem by running the LDAP server separately
from Samba tests.
Distribution. Samba and the LDAP server can run on different machines. The
communication will not be as efficient as LDAPI, but it can still be as secure as other
LDAP client-server communication done via network.
Integration. Some applications may want to use the same LDAP server. The current IPA
design doesn't require this, but in the future the design could change.
There are some changes that need to be make in order to support external LDAP server.
Current Code
The provisioning tool is located in these files:
source4/setup/provision.
source4/scripting/python/samba/provision.py
source4/scripting/python/samba/provisionbackend.py
source4/scripting/python/samba/provisionexceptions.py
Proposed Solution
The provisioning tool should be split into 2 different actions:
A new optional parameter (--ldap-action) will be added to the provisioning tool to determine
which action will be executed. By default the tool will create an internal LDAP server and setup
Samba to use this LDAP server. This is the same as the original behavior.
If you need to use an external LDAP server, you can either configure the LDAP server manually,
or use the provisioning tool to create an initial LDAP server which you can customize later on.
Then you need to run the provisioning tool again to setup Samba using the LDAP server that you
have created earlier.
Creating LDAP Server
Creating LDAP server will execute the following operations:
On OpenLDAP each partition has its own root user. Only the root user can remove the base entry
in each partition. This is necessary for setting up Samba on an existing LDAP server. To enable
root user, the root password must be specified in the slapd.conf.
A new optional parameter (--ldap-dir) will be added to the provisioning tool to specify the LDAP
server directory. The default value is SAMBA_HOME/private/ldap.
Setting up Samba
Setting up Samba will execute the following operations:
A new optional parameter (--ldap-uri) will be added to the provisioning tool to specify the URI
of the external LDAP server. By default the value is ldapi://<path to socket>. The default path to
socket is <SAMBA_HOME>/private/ldap/ldapi. Note that the file separator "/" should be
encoded as %2F.
The LDAP admin password (--ldapadminpass) must be specified explicitly, so the tool can
access the LDAP server. Otherwise it will generate a random password.
Examples
Configuring Samba with Internal LDAP Server
% setup/provision --realm=EXAMPLE.COM --domain=EXAMPLE \
--host-name=samba --host-ip=127.0.0.1 \
--adminpass=Secret123 --root=root --server-role="domain controller" \
--ldapadminpass=Secret123 --ldap-backend-type=fedora-ds \
--slapd-path=/usr/sbin/ns-slapd --setup-ds-path=/usr/sbin/setup-ds.pl
Make sure the LDAP server is running. Then setup Samba using the new LDAP server by
specifying the LDAP URI: