Hi, I am trying to figure out all the various passwords and access controls. I seem unable to get my previously documented systems/configurations to work. I understand that slaptest is supposed to convert my slapd.conf to a new configuration and everything should be fine going forward. However, I'm having various password and access issues. Basically, I use my ldap.conf file and everything seems good. I start slapd and it works fine. I perform an ldap search and everything seems fine as it returns my domain. After that, I try to import my memberof.ldif file and it gives me an access issue. ldapadd -f /etc/openldap/memberof.ldif -v -D "cn=config" -H ldap://192.168.2.113 -W -c
dn: cn=module,cn=config cn: module objectClass: olcModuleList objectclass: top olcModuleLoad: memberof.la olcModulePath: /usr/lib64/openldap
dn: olcOverlay=memberof,olcDatabase={0}config,cn=config objectclass: olcconfig objectclass: olcMemberOf objectclass: olcoverlayconfig objectclass: top olcoverlay: memberof
ldap_initialize( ldap://192.168.2.113:389/??base ) Enter LDAP Password: ldap_bind: Invalid credentials (49)
Obviously, that's a password problem. My question is why? What step did I miss in my documentation? Thank you! P.
--On Monday, September 9, 2019 3:38 PM +0000 Paul Pathiakis pathiaki2@yahoo.com wrote:
Hi,
I am trying to figure out all the various passwords and access controls.
I seem unable to get my previously documented systems/configurations to work.
I understand that slaptest is supposed to convert my slapd.conf to a new configuration and everything should be fine going forward.
However, I'm having various password and access issues.
DNs and Passwords are whatever you configured them to be. We can not psychically intuit your configuration. I.e., there is no set of default DNs or passwords in play, they depend entirely on your specific configuration. In this specific case, you're attempting to bind with a DN of "cn=config" and some password. We have no way of knowing if this is valid in your setup.
Regards, Quanah
--
Quanah Gibson-Mount Product Architect Symas Corporation Packaged, certified, and supported LDAP solutions powered by OpenLDAP: http://www.symas.com
Are you sure you don't have psychic powers? :) I guess my question could be interpreted that way.... However, I'm interested in how the various passwords are setup. Ever since OpenLDAP went to the .ldif format with cn=config, I'm always kind of looking at this issue that there's the process password and the database password. I'd like have a simple reference guide as to how to set each with with an editor (bad) or with ldapmodify (good). An example of each one would be good. More often than I care to admit, I'm getting "Invalid Credentials" and realize I'm using the wrong password.
It then makes me want to set any and all passwords to the same value (bad). TY! P. PS - I'm CC'ing you this with my telepathy... :)
On Monday, September 9, 2019, 12:27:11 PM EDT, Quanah Gibson-Mount quanah@symas.com wrote:
--On Monday, September 9, 2019 3:38 PM +0000 Paul Pathiakis pathiaki2@yahoo.com wrote:
Hi,
I am trying to figure out all the various passwords and access controls.
I seem unable to get my previously documented systems/configurations to work.
I understand that slaptest is supposed to convert my slapd.conf to a new configuration and everything should be fine going forward.
However, I'm having various password and access issues.
DNs and Passwords are whatever you configured them to be. We can not psychically intuit your configuration. I.e., there is no set of default DNs or passwords in play, they depend entirely on your specific configuration. In this specific case, you're attempting to bind with a DN of "cn=config" and some password. We have no way of knowing if this is valid in your setup.
Regards, Quanah
--
Quanah Gibson-Mount Product Architect Symas Corporation Packaged, certified, and supported LDAP solutions powered by OpenLDAP: http://www.symas.com
Paul Pathiakis pathiaki2@yahoo.com schrieb am 09.09.2019 um 16:38 in
Nachricht 337690294.4382558.1568039882472@mail.yahoo.com:
Hi, I am trying to figure out all the various passwords and access controls. I seem unable to get my previously documented systems/configurations to work. I understand that slaptest is supposed to convert my slapd.conf to a new configuration and everything should be fine going forward. However, I'm having various password and access issues. Basically, I use my ldap.conf file and everything seems good. I start slapd and it works fine. I perform an ldap search and everything seems fine as it returns my domain. After that, I try to import my memberof.ldif file and it gives me an access issue. ldapadd -f /etc/openldap/memberof.ldif -v -D "cn=config" -H ldap://192.168.2.113 -W -c
dn: cn=module,cn=config cn: module objectClass: olcModuleList objectclass: top olcModuleLoad: memberof.la olcModulePath: /usr/lib64/openldap
dn: olcOverlay=memberof,olcDatabase={0}config,cn=config objectclass: olcconfig objectclass: olcMemberOf objectclass: olcoverlayconfig objectclass: top olcoverlay: memberof
ldap_initialize( ldap://192.168.2.113:389/??base ) Enter LDAP Password: ldap_bind: Invalid credentials (49)
Obviously, that's a password problem. My question is why? What step did I miss in my documentation?
Hard to say without knowing your ACL rules.
Thank you! P.
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. TY! P.
Ldap.conf:
BASE dc=example,dc=com Slapd.conf:
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
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"
On Tuesday, September 10, 2019, 2:13:01 AM EDT, Ulrich Windl Ulrich.Windl@rz.uni-regensburg.de wrote:
Paul Pathiakis pathiaki2@yahoo.com schrieb am 09.09.2019 um 16:38 in
Nachricht 337690294.4382558.1568039882472@mail.yahoo.com:
Hi, I am trying to figure out all the various passwords and access controls. I seem unable to get my previously documented systems/configurations to work. I understand that slaptest is supposed to convert my slapd.conf to a new configuration and everything should be fine going forward. However, I'm having various password and access issues. Basically, I use my ldap.conf file and everything seems good. I start slapd and it works fine. I perform an ldap search and everything seems fine as it returns my domain. After that, I try to import my memberof.ldif file and it gives me an access issue. ldapadd -f /etc/openldap/memberof.ldif -v -D "cn=config" -H ldap://192.168.2.113 -W -c
dn: cn=module,cn=config cn: module objectClass: olcModuleList objectclass: top olcModuleLoad: memberof.la olcModulePath: /usr/lib64/openldap
dn: olcOverlay=memberof,olcDatabase={0}config,cn=config objectclass: olcconfig objectclass: olcMemberOf objectclass: olcoverlayconfig objectclass: top olcoverlay: memberof
ldap_initialize( ldap://192.168.2.113:389/??base ) Enter LDAP Password: ldap_bind: Invalid credentials (49)
Obviously, that's a password problem. My question is why? What step did I miss in my documentation?
Hard to say without knowing your ACL rules.
Thank you! P.
--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
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
--On Tuesday, September 10, 2019 5:19 PM +0000 Paul Pathiakis pathiaki2@yahoo.com wrote:
authz-regexp "gidNumber=0\+uidNumber=0,cn=peercred,cn=external,cn=auth"
"cn=root,dc=hq,dc=example,dc=com"
rootdn "cn=root,dc=hq,dc=example,dc=com" rootpw {SSHA}7gMfpdvYlzgd4EmH3VbBCUsMHugjozU+
So you have two methods of accessing the rootdn for this database. Either using SASL/EXTERNAL as root, or via -D/-W combination, with whatever password you hashed to create the above SSHA hash. Only you would know what that password is.
loglevel -1
-1 is a debug level, not a log level. See the slapd.conf(5) man page for valid log levels.
I copied /usr/share/doc/openldap/DB_CONFIG.EXAMPLE /var/lib/ldap/DB_CONFIG
DB_CONFIG only applies to back-bdb and back-hdb databases. You are using back-mdb, so it does nothing.
ldapadd -f /etc/openldap/20160826-163635.ldif -v -D "cn=config" -H ldap://newldap.hq.example.com -W -c
cn=config doesn't have access to the binary database, so this is expected. Use the correct rootdn (cn=root,dc=hq,dc=example,dc=com).
--Quanah
--
Quanah Gibson-Mount Product Architect Symas Corporation Packaged, certified, and supported LDAP solutions powered by OpenLDAP: http://www.symas.com
Hi Quanah/all, Well, once I used the suggestions below, everything loaded and went fine. As part of my documentation and verification process: systemctl stop slapd rm -rf /etc/openldap/slapd.d/* /var/lib/ldap/* and redo the whole process...... I gives me an invalid credentials issue now when I try to load the memberof.ldif file. However, trying to re-load all the information via below and the correct cn=root works just fine. I went through my history, I haven't changed anything yet I'm getting invalid credentials. Now... here's some relevant information about this... and YES I KNOW IT SHOULD NOT MAKE A DIFFERENCE It's a VM. I'm logged in via SSH and I'm also on the console. I think this has something to do with the effective versus real UID, GID. I ssh via an unprivilege'd user and su to root with: su - (I'm old pre-sudo) I get invalid credentials.... I got thoroughly flustered. Without changing anything except the slapd running: slapd -d -1 (in the SSH window) I go to the root window on the VM console. I run the same command and it loads fine! Same password etc. Just wow... everything is running fine. *shrug* Just an fyi. P.
On Tuesday, September 10, 2019, 2:29:36 PM EDT, Quanah Gibson-Mount quanah@symas.com wrote:
--On Tuesday, September 10, 2019 5:19 PM +0000 Paul Pathiakis pathiaki2@yahoo.com wrote:
authz-regexp "gidNumber=0\+uidNumber=0,cn=peercred,cn=external,cn=auth"
"cn=root,dc=hq,dc=example,dc=com"
rootdn "cn=root,dc=hq,dc=example,dc=com" rootpw {SSHA}7gMfpdvYlzgd4EmH3VbBCUsMHugjozU+
So you have two methods of accessing the rootdn for this database. Either using SASL/EXTERNAL as root, or via -D/-W combination, with whatever password you hashed to create the above SSHA hash. Only you would know what that password is.
loglevel -1
-1 is a debug level, not a log level. See the slapd.conf(5) man page for valid log levels.
I copied /usr/share/doc/openldap/DB_CONFIG.EXAMPLE /var/lib/ldap/DB_CONFIG
DB_CONFIG only applies to back-bdb and back-hdb databases. You are using back-mdb, so it does nothing.
ldapadd -f /etc/openldap/20160826-163635.ldif -v -D "cn=config" -H ldap://newldap.hq.example.com -W -c
cn=config doesn't have access to the binary database, so this is expected. Use the correct rootdn (cn=root,dc=hq,dc=example,dc=com).
--Quanah
--
Quanah Gibson-Mount Product Architect Symas Corporation Packaged, certified, and supported LDAP solutions powered by OpenLDAP: http://www.symas.com
openldap-technical@openldap.org