Quanah (and all): This is how I did all this in near-full documented form: This is a build on CentOS 7 1805. yum install -y openldap-servers openldap-clients slapd is version 2.4.44 according to slapd -V
downloaded the latest version of FreeRADIUS and SAMBA Put the FreeRADIUS server and FreeRADIUS client .schema and .ldif files in /etc/openldap/schemaPut the SAMBA .schema and .ldif file in /etc/openldap/schema I moved the ldap.conf file to ldap.conf.orig. I copied the following from the existing server and put them in place. (only changing the dc for the company name to 'example' for privacy)
# LDAP Defaults #
# See ldap.conf(5) for details # This file should be world readable but not world writable.
#BASE dc=example,dc=com #URI ldap://ldap.example.com ldap://ldap-master.example.com:666
#SIZELIMIT 12 #TIMELIMIT 15 #DEREF never
# Turning this off breaks GSSAPI used with krb5 when rdns = false SASL_NOCANON on
TLS_CACERTDIR /etc/openldap/certs ssl start_tls TLS_REQCERT allow BASE dc=hq,dc=example,dc=com URI ldaps://newldap.hq.example.com HOST 192.168.2.60
As an example of the slapd.conf file: ####################################################################### # $Id: slapd.conf,v 1.5 2004/04/23 23:27:01 slothrop Exp $ ####################################################################### # # Application: OpenLDAP # Server: ldap1 # Filelocation: /etc/openldap/slapd.conf # Documentation: See slapd.conf(5) for details on configuration options # Notes: #######################################################################
# Default Hash password-hash {SSHA}
# Schema include /etc/openldap/schema/core.schema include /etc/openldap/schema/cosine.schema include /etc/openldap/schema/inetorgperson.schema include /etc/openldap/schema/nis.schema include /etc/openldap/schema/samba.schema
include /etc/openldap/schema/corba.schema include /etc/openldap/schema/duaconf.schema include /etc/openldap/schema/dyngroup.schema include /etc/openldap/schema/java.schema include /etc/openldap/schema/misc.schema include /etc/openldap/schema/openldap.schema include /etc/openldap/schema/collective.schema include /etc/openldap/schema/freeradius.schema include /etc/openldap/schema/freeradius-clients.schema include /etc/openldap/schema/ppolicy.schema
# Allow LDAPv2 client connections. This is NOT the default. #allow bind_v2
# Do not enable referrals until AFTER you have a working directory # service AND an understanding of referrals. #referral ldap://root.openldap.org
pidfile /var/run/openldap/slapd.pid argsfile /var/run/openldap/slapd.args
# Load dynamic backend modules: modulepath /usr/lib64/openldap # moduleload back_bdb.la # moduleload back_ldap.la # moduleload back_ldbm.la # moduleload back_passwd.la # moduleload back_shell.la moduleload memberof.la moduleload ppolicy.la <-------- I ADDED THIS LINE!!! *********************
# 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 slapd.pem", and fixing permissions on # slapd.pem so that the ldap user or group can read it. Your client software # may balk at self-signed certificates, however.
TLSCACertificateFile /etc/openldap/cacert.pem TLSCertificateFile /etc/openldap/server.crt TLSCertificateKeyFile /etc/openldap/private.key
# Sample security restrictions # Require integrity protection (prevent hijacking) # Require 112-bit (3DES or better) encryption for updates # Require 63-bit encryption for simple bind # security ssf=1 update_ssf=112 simple_bind=64
# Sample access control policy: # Root DSE: allow anyone to read it # Subschema (sub)entry DSE: allow anyone to read it # Other DSEs: # Allow self write access # Allow authenticated users read access # Allow anonymous users to authenticate # Directives needed to implement policy: # access to dn.base="" by * read # access to dn.base="cn=Subschema" by * read # access to * # by self write # by users read # by anonymous auth # # if no access controls are present, the default policy # allows anyone and everyone to read anything but restricts # updates to rootdn. (e.g., "access to * by * read") # # rootdn can always read and write EVERYTHING!
access to attrs=userPassword by self write by anonymous auth by dn="uid=syncuser,dc=hq,dc=example,dc=com" read by * compare access to attrs=sambaLMPassword,sambaNTPassword by dn="uid=syncuser,dc=hq,dc=example,dc=com" read by * none access to * by self write by * read
access to dn.subtree="dc=hq,dc=example,dc=com" by self write by set="[cn=itlevel1,ou=Groups,dc=hq,dc=example,dc=com]/member* & user" write by set="[cn=ntadmins,ou=Groups,dc=hq,dc=example,dc=com]/member* & user" write by * break
#idletimeout 30
####################################################################### # ldbm and/or bdb database definitions #######################################################################
authz-regexp "gidNumber=0\+uidNumber=0,cn=peercred,cn=external,cn=auth" "cn=root,dc=hq,dc=example,dc=com"
database mdb suffix "dc=hq,dc=example,dc=com" rootdn "cn=root,dc=hq,dc=example,dc=com" # Cleartext passwords, especially for the rootdn, should # be avoided. See slappasswd(8) and slapd.conf(5) for details. # Use of strong authentication encouraged. # rootpw secret # rootpw {crypt}ijFYNcSNctBYg rootpw {SSHA}7gMfpdvYlzgd4EmH3VbBCUsMHugjozU+ maxsize 85899345920 loglevel -1 sizelimit unlimited checkpoint 1024 15
# The database directory MUST exist prior to running slapd AND # should only be accessible by the slapd and slap tools. # Mode 700 recommended. directory /var/lib/ldap
# Indices to maintain for this database index objectClass eq,pres index ou,cn,mail,surname,givenname eq,pres,sub index uidNumber,gidNumber,loginShell eq,pres index uid,memberUid eq,pres,sub index nisMapName,nisMapEntry eq,pres,sub index sambaSID eq,sub index sambaPrimaryGroupSID eq index sambaDomainName eq
# ldapsync provider setup #sessionlog 100 100
THEN: I copied /usr/share/doc/openldap/DB_CONFIG.EXAMPLE /var/lib/ldap/DB_CONFIG I performed: chown -R ldap:ldap /etc/openldap /var/lib/ldap slaptest -f /etc/openldap/slapd.conf -F /etc/openldap/slapd.d It informs me it's a good configuration. I copy this into /etc/openldap/memberof.ldif dn: cn=module,cn=config cn: module objectClass: olcModuleList objectclass: top olcModuleLoad: memberof.la olcModulePath: /usr/lib64/openldap
dn: olcOverlay=memberof,olcDatabase={1}mdb,cn=config objectclass: olcconfig objectclass: olcMemberOf objectclass: olcoverlayconfig objectclass: top olcoverlay: memberof ldapadd -f /etc/openldap/memberof.ldif -v -D "cn=config" -H ldap://newldap.hq.example.com -W -c
systemctl enable slapd systemctl start slapd
I then checked all the sub-dirs under slapd.d and saw:
/etc/openldap/slapd.d:
cn=config cn=config.ldif
/etc/openldap/slapd.d/cn=config:
cn=module{0}.ldif olcDatabase={0}config.ldif olcDatabase={1}mdb.ldif
cn=schema olcDatabase={-1}frontend.ldif
cn=schema.ldif olcDatabase={1}mdb
/etc/openldap/slapd.d/cn=config/cn=schema:
cn={0}core.ldif cn={1}cosine.ldif cn={6}duaconf.ldif
cn={10}openldap.ldif cn={2}inetorgperson.ldif cn={7}dyngroup.ldif
cn={11}collective.ldif cn={3}nis.ldif cn={8}java.ldif
cn={12}freeradius.ldif cn={4}samba.ldif cn={9}misc.ldif
cn={13}freeradius-clients.ldif cn={5}corba.ldif
cn={14}ppolicy.ldif
/etc/openldap/slapd.d/cn=config/olcDatabase={1}mdb: olcOverlay={0}memberof.ldif
Under /var/lib/ldap I see: /var/lib/ldap/data.mdb /var/lib/ldap/DB_CONFIG /var/lib/ldap/lock.mdb
I then take my slapcat file from other instance and modify it inline with: sed -i -e "/entryUUID/d" 20160826-163635.ldifsed -i -e "/creatorsName/d" 20160826-163635.ldifsed -i -e "/createTimestamp/d" 20160826-163635.ldifsed -i -e "/entryCSN/d" 20160826-163635.ldifsed -i -e "/modifiersName/d" 20160826-163635.ldifsed -i -e "/modifyTimestamp/d" 20160826-163635.ldifsed -i -e "/structuralObjectClass/d" 20160826-163635.ldif I then reload it into the new server with: ldapadd -f /etc/openldap/20160826-163635.ldif -v -D "cn=config" -H ldap://newldap.hq.example.com -W -c Everything starts to load. However, now I get an initial error 50 about not having access to the parent or it's children and then error 32 from there on out. I can't provide any more information than this. I'm hoping it's sufficient.
P.
On Tuesday, September 10, 2019, 11:41:45 AM EDT, Quanah Gibson-Mount quanah@symas.com wrote:
--On Tuesday, September 10, 2019 3:56 PM +0000 Paul Pathiakis pathiaki2@yahoo.com wrote:
Good point. (I sent these in a follow on post that hasn't shown up yet I'm also having an issue with reloading a slapd .ldif file from the previous server to this one. It's giving me an 'insufficient privileges' access area and telling me I don't have permissions to the parent. So.... I really need to figure this out.... I've done this quite a few times and now I'm having an issue.)
I have to assume that I don't have access to example.com or it's children. I just don't understand what I'm missing.
You're making a lot of assumptions about configuration that may or may not be valid.
a) You're assuming there's a DN and a password required. This may or may not be the case depending on how the system is configured. In fact, in the very configuration you presented, the rootDN for the binary db does not take a password at all, but requires a connection as root over ldapi:/// using the SASL/EXTERNAL mechanism:
authz-regexp "gidNumber=0\+uidNumber=0,cn=peercred,cn=external,cn=auth" "cn=root,dc=hq,dc=example,dc=com"
In this case, there is neither a DN or a password necessary
b) Configurations may or may not re-use identities. So it's entirely possible there is no DN or password ever required in the case of SASL enabled systems, etc.
Really, the question is, how did you configure your system to behave? If you don't know the answer to that, we can't really help much.
--Quanah
--
Quanah Gibson-Mount Product Architect Symas Corporation Packaged, certified, and supported LDAP solutions powered by OpenLDAP: http://www.symas.com