HomePhorge

Centos8 compatible ldap setup

Description

Centos8 compatible ldap setup

This include python3 fixes and adapts to 389 ldap setup changes.

Details

Provenance
mollekopfAuthored on Aug 4 2022, 3:24 PM
mollekopfPushed on Aug 15 2022, 8:53 AM
Parents
rPc9a62996169f: A more readable argparsing
Branches
Unknown
Tags
Unknown
Build Status
Buildable 39725

Event Timeline

Christian Mollekopf <mollekopf@apheleia-it.ch> committed rP4e530807dd98: Centos8 compatible ldap setup (authored by Christian Mollekopf <mollekopf@apheleia-it.ch>).Aug 15 2022, 8:50 AM
dscreate_found = os.path.isfile("/usr/sbin/dscreate")

dscreate depends on python3-lib389, you will run into error, if you start setup with Python 2.
I run into this on Debian 10
Ubuntu 22.04 LTS has dscreate only for install and cockpit module would be the new admin, .pl scripts are dropped.

I moved the "os.path" if else block, before "data ="
data doesn't need to be filled until setup scripts are available.

dscreate = False
if os.path.isfile("/usr/sbin/dscreate") and sys.version_info.major > 3:
    setup_ds_admin = "/usr/sbin/dscreate"
    dscreate = True
elif ...

...

if dscreate:
    data = """

[general]
config_version = 2
full_machine_name = %(fqdn)s
SuiteSpotUserID = %(userid)s
SuiteSpotGroup = %(group)s
AdminDomain = %(domain)s
ConfigDirectoryLdapURL = ldap://%(fqdn)s:389/o=NetscapeRoot
ConfigDirectoryAdminID = admin
ConfigDirectoryAdminPwd = %(admin_pass)s

[slapd]
instance_name = %(hostname)s
port = 389
root_password = %(dirmgr_pass)s
RootDN = cn=Directory Manager
RootDNPwd = %(dirmgr_pass)s
ds_bename = %(nodotdomain)s

[backend-userroot]
suffix = %(rootdn)s
sample_entries = 001003006
require_index = yes

""" % (_input)

sample_entries = 001003006
would install the old sample data, as expected from /usr/share/dirsrv/data/template.ldif
see /usr/lib/python3/dist-packages/lib389/configurations/

.. else: 
 data = ... (olddata for Perl Scripts)
 ...
  if dscreate:
      log.info(setup_ds_admin)
      command = [
          setup_ds_admin,
          '-v',
          'from-file',
          '%s' % filename
      ]

Display an example inf answer file, or provide a file name to write it to disk

dscreate create-template (--advanced)