mirror of
https://github.com/samba-team/samba.git
synced 2025-07-25 00:59:11 +03:00
Re-add support for the --ldap-backend-port option to provision-backend
This option allows Fedora DS multi-master replication to work. I've
tried to update the wiki and scripts to the largely consistant with
each other.
Andrew Bartlett
(This used to be commit 42393c8307
)
This commit is contained in:
@ -288,7 +288,7 @@ def guess_names(lp=None, hostname=None, domain=None, dnsdomain=None, serverrole=
|
||||
|
||||
if lp.get("realm").upper() != realm:
|
||||
raise Exception("realm '%s' in %s must match chosen realm '%s'" %
|
||||
(lp.get("realm"), smbconf, realm))
|
||||
(lp.get("realm"), lp.configfile(), realm))
|
||||
|
||||
dnsdomain = dnsdomain.lower()
|
||||
|
||||
@ -1045,8 +1045,8 @@ def provision(setup_dir, message, session_info,
|
||||
|
||||
message("Please install the phpLDAPadmin configuration located at %s into /etc/phpldapadmin/config.php" % paths.phpldapadminconfig)
|
||||
|
||||
message("Once the above files are installed, your server will be ready to use")
|
||||
message("Server Type: %s" % serverrole)
|
||||
message("Once the above files are installed, your Samba4 server will be ready to use")
|
||||
message("Server Role: %s" % serverrole)
|
||||
message("Hostname: %s" % names.hostname)
|
||||
message("NetBIOS Domain: %s" % names.domain)
|
||||
message("DNS Domain: %s" % names.dnsdomain)
|
||||
@ -1096,7 +1096,7 @@ def provision_backend(setup_dir=None, message=None,
|
||||
smbconf=None, targetdir=None, realm=None,
|
||||
rootdn=None, domaindn=None, schemadn=None, configdn=None,
|
||||
domain=None, hostname=None, adminpass=None, root=None, serverrole=None,
|
||||
ldap_backend_type=None):
|
||||
ldap_backend_type=None, ldap_backend_port=None):
|
||||
|
||||
def setup_path(file):
|
||||
return os.path.join(setup_dir, file)
|
||||
@ -1144,7 +1144,12 @@ def provision_backend(setup_dir=None, message=None,
|
||||
{"SCHEMADN": names.schemadn})
|
||||
|
||||
if ldap_backend_type == "fedora-ds":
|
||||
setup_file(setup_path("fedora-ds.inf"), paths.fedoradsinf,
|
||||
if ldap_backend_port is not None:
|
||||
serverport = "ServerPort=%d" % ldap_backend_port
|
||||
else:
|
||||
serverport = ""
|
||||
|
||||
setup_file(setup_path("fedorads.inf"), paths.fedoradsinf,
|
||||
{"ROOT": root,
|
||||
"HOSTNAME": hostname,
|
||||
"DNSDOMAIN": names.dnsdomain,
|
||||
@ -1152,19 +1157,18 @@ def provision_backend(setup_dir=None, message=None,
|
||||
"DOMAINDN": names.domaindn,
|
||||
"LDAPMANAGERDN": names.ldapmanagerdn,
|
||||
"LDAPMANAGERPASS": adminpass,
|
||||
"SERVERPORT": ""})
|
||||
"SERVERPORT": serverport})
|
||||
|
||||
setup_file(setup_path("fedora-partitions.ldif"), paths.fedoradspartitions,
|
||||
setup_file(setup_path("fedorads-partitions.ldif"), paths.fedoradspartitions,
|
||||
{"CONFIGDN": names.configdn,
|
||||
"SCHEMADN": names.schemadn,
|
||||
})
|
||||
|
||||
setup_file(setup_path("fedora-partitions.ldif"), paths.fedoradspartitions,
|
||||
{"CONFIGDN": names.configdn,
|
||||
"SCHEMADN": names.schemadn,
|
||||
})
|
||||
mapping = "schema-map-fedora-ds-1.0"
|
||||
backend_schema = "99_ad.ldif"
|
||||
|
||||
slapdcommand="Initailise Fedora DS with: setup-ds.pl --file=%s" % paths.fedoradsinf
|
||||
|
||||
elif ldap_backend_type == "openldap":
|
||||
attrs = ["linkID", "lDAPDisplayName"]
|
||||
res = schemadb.search(expression="(&(&(linkID=*)(!(linkID:1.2.840.113556.1.4.803:=1)))(objectclass=attributeSchema))", base=names.schemadn, scope=SCOPE_SUBTREE, attrs=attrs);
|
||||
@ -1215,14 +1219,26 @@ refint_attributes""" + refint_attributes + "\n";
|
||||
|
||||
|
||||
ldapi_uri = "ldapi://" + urllib.quote(os.path.join(paths.private_dir, "ldap", "ldapi"), safe="")
|
||||
message("Start slapd with: slapd -f " + paths.ldapdir + "/slapd.conf -h " + ldapi_uri)
|
||||
|
||||
if ldap_backend_port is not None:
|
||||
server_port_string = " -h ldap://0.0.0.0:%d" % ldap_backend_port
|
||||
else:
|
||||
server_port_string = ""
|
||||
slapdcommand="Start slapd with: slapd -f " + paths.ldapdir + "/slapd.conf -h " + ldapi_uri + server_port_string
|
||||
|
||||
schema_command = "bin/ad2oLschema --option=convert:target=" + ldap_backend_type + " -I " + setup_path(mapping) + " -H tdb://" + schemadb_path + " -O " + os.path.join(paths.ldapdir, backend_schema);
|
||||
|
||||
os.system(schema_command)
|
||||
|
||||
|
||||
message("Your %s Backend for Samba4 is now configured, and is ready to be started" % ( ldap_backend_type) )
|
||||
message("Server Role: %s" % serverrole)
|
||||
message("Hostname: %s" % names.hostname)
|
||||
message("DNS Domain: %s" % names.dnsdomain)
|
||||
message("Base DN: %s" % names.domaindn)
|
||||
message("LDAP admin DN: %s" % names.ldapmanagerdn)
|
||||
message("LDAP admin password: %s" % adminpass)
|
||||
message(slapdcommand)
|
||||
|
||||
|
||||
def create_phpldapadmin_config(path, setup_path, ldapi_uri):
|
||||
"""Create a PHP LDAP admin configuration file.
|
||||
|
Reference in New Issue
Block a user