1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

Updates to the recent cn=config support for the OpenLDAP backend

- removed workaround for olcSyncprovConfig - creation (works perfect now
with 2.4.15, release was today)
- added 1 message-helpline, which is displayed when running
provision-backend with olc and/or mmr setup
- corrected 1 wrong slapcommand-helpline
- slapd.conf is removed now in case of olc-setup
- added 1 copyright-line to provision.py and provision-backend

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Oliver Liebel 2009-02-25 10:27:19 +11:00 committed by Andrew Bartlett
parent b3d53e2ce6
commit 503d15e8df
3 changed files with 9 additions and 31 deletions

View File

@ -4,6 +4,7 @@
# Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2007-2008 # Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2007-2008
# Copyright (C) Andrew Bartlett <abartlet@samba.org> 2008 # Copyright (C) Andrew Bartlett <abartlet@samba.org> 2008
# Copyright (C) Oliver Liebel <oliver@itc.li> 2008-2009
# #
# Based on the original in EJS: # Based on the original in EJS:
# Copyright (C) Andrew Tridgell <tridge@samba.org> 2005 # Copyright (C) Andrew Tridgell <tridge@samba.org> 2005
@ -100,8 +101,6 @@ class ProvisionPaths(object):
self.olcdir = None self.olcdir = None
self.olslaptest = None self.olslaptest = None
self.olcseedldif = None self.olcseedldif = None
self.olcsyncprovdir = None
self.olcsyncprovfile = None
class ProvisionNames(object): class ProvisionNames(object):
@ -278,10 +277,6 @@ def provision_paths_from_lp(lp, dnsdomain):
"slapd.d") "slapd.d")
paths.olcseedldif = os.path.join(paths.ldapdir, paths.olcseedldif = os.path.join(paths.ldapdir,
"olc_seed.ldif") "olc_seed.ldif")
paths.olcsyncprovdir = os.path.join(paths.olcdir,
"cn=config/olcDatabase={0}config")
paths.olcsyncprovfile = os.path.join(paths.olcsyncprovdir,
"olcOverlay={0}syncprov.ldif")
paths.hklm = "hklm.ldb" paths.hklm = "hklm.ldb"
paths.hkcr = "hkcr.ldb" paths.hkcr = "hkcr.ldb"
paths.hkcu = "hkcu.ldb" paths.hkcu = "hkcu.ldb"
@ -1479,7 +1474,7 @@ def provision_backend(setup_dir=None, message=None,
slapdcommand="Start slapd with: slapd -F " + paths.olcdir + " -h \"" + ldapi_uri + " ldap://<FQHN>:<PORT>\"" slapdcommand="Start slapd with: slapd -F " + paths.olcdir + " -h \"" + ldapi_uri + " ldap://<FQHN>:<PORT>\""
if ol_olc != "yes" and ol_mmr_urls is not None: if ol_olc != "yes" and ol_mmr_urls is not None:
slapdcommand="Start slapd with: slapd -F " + paths.ldapdir + "/slapd.conf -h \"" + ldapi_uri + " ldap://<FQHN>:<PORT>\"" slapdcommand="Start slapd with: slapd -f " + paths.ldapdir + "/slapd.conf -h \"" + ldapi_uri + " ldap://<FQHN>:<PORT>\""
if ol_olc == "yes" and ol_mmr_urls is not None: if ol_olc == "yes" and ol_mmr_urls is not None:
slapdcommand="Start slapd with: slapd -F " + paths.olcdir + " -h \"" + ldapi_uri + " ldap://<FQHN>:<PORT>\"" slapdcommand="Start slapd with: slapd -F " + paths.olcdir + " -h \"" + ldapi_uri + " ldap://<FQHN>:<PORT>\""
@ -1505,6 +1500,8 @@ def provision_backend(setup_dir=None, message=None,
message("LDAP admin password: %s" % adminpass) message("LDAP admin password: %s" % adminpass)
message(slapdcommand) message(slapdcommand)
if ol_olc == "yes" or ol_mmr_urls is not None:
message("Attention to slapd-Port: <PORT> must be different than 389!")
assert isinstance(ldap_backend_type, str) assert isinstance(ldap_backend_type, str)
assert isinstance(ldapuser, str) assert isinstance(ldapuser, str)
assert isinstance(adminpass, str) assert isinstance(adminpass, str)
@ -1528,19 +1525,10 @@ def provision_backend(setup_dir=None, message=None,
paths.olslaptest = str(ol_slaptest) paths.olslaptest = str(ol_slaptest)
olc_command = paths.olslaptest + " -f" + paths.slapdconf + " -F" + paths.olcdir + " >/dev/null 2>&1" olc_command = paths.olslaptest + " -f" + paths.slapdconf + " -F" + paths.olcdir + " >/dev/null 2>&1"
os.system(olc_command) os.system(olc_command)
#os.remove(paths.slapdconf) os.remove(paths.slapdconf)
# use line below for debugging during olc-conversion with slaptest # use line below for debugging during olc-conversion with slaptest, instead of olc_command above
#olc_command = paths.olslaptest + " -f" + paths.slapdconf + " -F" + paths.olcdir" #olc_command = paths.olslaptest + " -f" + paths.slapdconf + " -F" + paths.olcdir"
# workaround, if overlay syncprov is was not created properly during conversion to cn=config.
# otherwise, cn=config won't be replicated
if ol_olc == "yes" and ol_mmr_urls is not None:
if not os.path.exists(paths.olcsyncprovdir):
os.makedirs(paths.olcsyncprovdir, 0770)
setup_file(setup_path("olcOverlay={0}syncprov.ldif"),
os.path.join(paths.olcsyncprovdir, "olcOverlay={0}syncprov.ldif"), {})
def create_phpldapadmin_config(path, setup_path, ldapi_uri): def create_phpldapadmin_config(path, setup_path, ldapi_uri):
"""Create a PHP LDAP admin configuration file. """Create a PHP LDAP admin configuration file.

View File

@ -1,11 +0,0 @@
dn: olcOverlay={0}syncprov
objectClass: olcOverlayConfig
objectClass: olcSyncProvConfig
olcOverlay: {0}syncprov
structuralObjectClass: olcSyncProvConfig
entryUUID: 41df5aca-785a-102d-9077-999999999999
creatorsName: cn=config
createTimestamp: 20090116201111Z
entryCSN: 20090116201111.111111Z#000000#000#000000
modifiersName: cn=config
modifyTimestamp: 20090116201111Z

View File

@ -4,6 +4,7 @@
# provision a Samba4 server # provision a Samba4 server
# Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2007-2008 # Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2007-2008
# Copyright (C) Andrew Bartlett <abartlet@samba.org> 2008 # Copyright (C) Andrew Bartlett <abartlet@samba.org> 2008
# Copyright (C) Oliver Liebel <oliver@itc.li> 2008-2009
# #
# Based on the original in EJS: # Based on the original in EJS:
# Copyright (C) Andrew Tridgell 2005 # Copyright (C) Andrew Tridgell 2005
@ -65,9 +66,9 @@ parser.add_option("--server-role", type="choice", metavar="ROLE",
parser.add_option("--targetdir", type="string", metavar="DIR", parser.add_option("--targetdir", type="string", metavar="DIR",
help="Set target directory") help="Set target directory")
parser.add_option("--ol-mmr-urls", type="string", metavar="LDAPSERVER", parser.add_option("--ol-mmr-urls", type="string", metavar="LDAPSERVER",
help="List of LDAP-URLS [ ldap://<FQDN>:port/ (where port != 389) ] separated with whitespaces for use with OpenLDAP-MMR (Multi-Master-Replication)") help="List of LDAP-URLS [ ldap://<FQHN>:<PORT>/ (where <PORT> has to be different from 389!) ] separated with whitespaces for use with OpenLDAP-MMR (Multi-Master-Replication)")
parser.add_option("--ol-olc", type="choice", metavar="OPENLDAP-OLC", parser.add_option("--ol-olc", type="choice", metavar="OPENLDAP-OLC",
help="To setup OpenLDAP-Backend with Online-Configuration [slapd.d] choose 'yes'", help="To setup OpenLDAP-Backend with Online-Configuration [slapd.d] choose 'yes'. Note: Only OpenLDAP-Versions greater or equal 2.4.15 should be used!",
choices=["yes", "no"]) choices=["yes", "no"])
parser.add_option("--ol-slaptest", type="string", metavar="SLAPTEST-PATH", parser.add_option("--ol-slaptest", type="string", metavar="SLAPTEST-PATH",
help="Path to slaptest-binary [e.g.:'/usr/local/sbin']. Only for use with --ol-olc='yes'") help="Path to slaptest-binary [e.g.:'/usr/local/sbin']. Only for use with --ol-olc='yes'")