Bug 1903350
| Summary: | LDAPS replication and dsconf replication status fails with error "certificate verify failed" | ||
|---|---|---|---|
| Product: | Red Hat Directory Server | Reporter: | Marc Sauton <msauton> |
| Component: | 389-ds-base | Assignee: | Simon Pichugin <spichugi> |
| Status: | CLOSED ERRATA | QA Contact: | RHDS QE <ds-qe-bugs> |
| Severity: | high | Docs Contact: | Marc Muehlfeld <mmuehlfe> |
| Priority: | unspecified | ||
| Version: | 11.4 | CC: | arajendr, cobrown, ldap-maint, mreynolds, sgouvern, spichugi, tmihinto, wrydberg |
| Target Milestone: | DS11.3 | Keywords: | Triaged |
| Target Release: | dirsrv-11.4 | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | redhat-ds-11-8050020210803164248.d3df4063 | Doc Type: | If docs needed, set a value |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2021-10-25 06:36:13 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
|
Description
Marc Sauton
2020-12-01 21:05:17 UTC
Regarding this:
DEBUG: Cannot connect to 'ldaps://192.168.122.112:636/'
DEBUG: Connection to consumer (192.168.122.112:389) failed, error: {'desc': "Can't contact LDAP server", 'info': 'TLS: hostname does not match peer certificate'}
You can not use an IP address over LDAPS, you must always use the FQDN or else you will get errors like this.
They should update the .dsrc file to use a FQDN instead of the IP address in the "uri", and the tls_cacertdir
example for: /root/.dsrc
[localhost]
tls_cacertdir = /etc/dirsrv/slapd-localhost
uri = ldaps://localhost.localdomain:636
But they probably need this fix as well:
https://github.com/389ds/389-ds-base/pull/4463
ok for the IP @ in the SSL connections...fixed my test, replaced the nsDS5ReplicaHost with the corresponding hostnames, had some virtual guests and host weirderness with dnsmasq, so the workaround with the slapd-template nss db works:
dsconf -v m1 replication status --suffix dc=example,dc=test --bind-dn "cn=Directory Manager" --bind-passwd password
...snip...
DEBUG: Allocate <class 'lib389.DirSrv'> with m2.example.test:636
DEBUG: open(): Connecting to uri ldaps://m2.example.test:636/
DEBUG: Using dirsrv ca certificate /etc/dirsrv/slapd-template
DEBUG: Using external ca certificate /etc/dirsrv/slapd-template
DEBUG: Using external ca certificate /etc/dirsrv/slapd-template
DEBUG: Using certificate policy 1
DEBUG: ldap.OPT_X_TLS_REQUIRE_CERT = 1
DEBUG: open(): bound as cn=Directory Manager
INFO: {'agmt-name': ['m1tom2exampleSSL'], 'replica': ['m2.example.test:636'], 'replica-enabled': ['on'], 'update-in-progress': ['FALSE'], 'last-update-start': ['20201203020121Z'], 'last-update-end': ['20201203020121Z'], 'number-changes-sent': ['1:143/0 '], 'number-changes-skipped': ['unavailable'], 'last-update-status': ['Error (0) Replica acquired successfully: Incremental update succeeded'], 'last-init-start': ['20201203020019Z'], 'last-init-end': ['20201203020027Z'], 'last-init-status': ['Error (0) Total update succeeded'], 'reap-active': ['0'], 'replication-status': ['In Synchronization'], 'replication-lag-time': ['00:00:00']}
INFO: Command successful.
[root@m1 ~]#
now, if I remove the workaround, there is the LDAPS connection failure "certificate verify failed" :
mv /etc/dirsrv/slapd-template /etc/dirsrv/slapd-template-1
dsconf -v m1 replication status --suffix dc=example,dc=test --bind-dn "cn=Directory Manager" --bind-passwd password
...snip...
DEBUG: Allocate <class 'lib389.DirSrv'> with m2.example.test:636
DEBUG: open(): Connecting to uri ldaps://m2.example.test:636/
DEBUG: Using dirsrv ca certificate /etc/dirsrv/slapd-template
DEBUG: Using external ca certificate /etc/dirsrv/slapd-template
DEBUG: Using external ca certificate /etc/dirsrv/slapd-template
DEBUG: Using certificate policy 1
DEBUG: ldap.OPT_X_TLS_REQUIRE_CERT = 1
DEBUG: Cannot connect to 'ldaps://m2.example.test:636/'
DEBUG: Connection to consumer (m2.example.test:636) failed, error: {'desc': "Can't contact LDAP server", 'info': 'error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed (self signed certificate in certificate chain)'}
INFO: {'agmt-name': ['m1tom2exampleSSL'], 'replica': ['m2.example.test:636'], 'replica-enabled': ['on'], 'update-in-progress': ['FALSE'], 'last-update-start': ['20201203020121Z'], 'last-update-end': ['20201203020121Z'], 'number-changes-sent': ['1:143/0 '], 'number-changes-skipped': ['unavailable'], 'last-update-status': ['Error (0) Replica acquired successfully: Incremental update succeeded'], 'last-init-start': ['20201203020019Z'], 'last-init-end': ['20201203020027Z'], 'last-init-status': ['Error (0) Total update succeeded'], 'reap-active': ['0'], 'replication-status': ['Not in Synchronization: supplier (5fc846ea000e00010000) consumer (Unavailable) State (green) Reason (error (0) replica acquired successfully: incremental update succeeded)'], 'replication-lag-time': ['Unavailable']}
INFO: Command successful.
same error with the .dsrc:
cat /root/.dsrc
[localhost]
tls_cacertdir = /etc/dirsrv/slapd-m1
uri = ldaps://m1.example.test:636
so I need the fix from
https://github.com/389ds/389-ds-base/pull/4463
but it seem now it is outdated, so in the issue
https://github.com/389ds/389-ds-base/issues/4460
is it now
https://github.com/389ds/389-ds-base/commit/ce7beae4d698880f45c09de17c487c1fefbc3410
or
https://github.com/389ds/389-ds-base/pull/4463/commits/79996ff59dc38bf23e99d8f219fcc90557721524
?
and there is something going on with SER_SERVERID_PROP left to the default value of "template" > > so I need the fix from > https://github.com/389ds/389-ds-base/pull/4463 > but it seem now it is outdated, so in the issue > https://github.com/389ds/389-ds-base/issues/4460 > is it now > https://github.com/389ds/389-ds-base/commit/ce7beae4d698880f45c09de17c487c1fefbc3410 > ? or > https://github.com/389ds/389-ds-base/pull/4463/commits/79996ff59dc38bf23e99d8f219fcc90557721524 > ? These are all the same. So you need the fix for https://github.com/389ds/389-ds-base/pull/4463 and maybe https://github.com/389ds/389-ds-base/pull/4472 As for the "template" issue, I'm not seeing that problem. Maybe it will be resolved with the two fixes above? Having 2 instances configured as 2 MMR, security on
# cat /root/.dsrc
[inst1]
tls_cacertdir = /etc/dirsrv/slapd-inst1
uri = ldaps://localhost.localdomain:1636
binddn = cn=directory manager
basedn = dc=example,dc=com
[inst2]
tls_cacertdir = /etc/dirsrv/slapd-inst2
uri = ldaps://localhost.localdomain:2636
binddn = cn=directory manager
basedn = dc=example,dc=com
# cat /etc/openldap/ldap.conf
#
# LDAP Defaults
#
# See ldap.conf(5) for details
# This file should be world readable but not world writable.
BASE dc=example,dc=com
URI ldaps://localhost.localdomain:1636 ldaps://localhost.localdomain:2636
TLS_CACERTDIR /etc/dirsrv/ssca
]# dsconf -v -D "cn=Directory Manager" -w password ldaps://localhost.localdomain:2636 replication status --suffix dc=example,dc=com
DEBUG: The 389 Directory Server Configuration Tool
DEBUG: Inspired by works of: ITS, The University of Adelaide
DEBUG: dsrc path: /root/.dsrc
DEBUG: dsrc container path: /data/config/container.inf
DEBUG: dsrc instances: ['inst1', 'inst2']
DEBUG: dsrc no such section: slapd-ldaps://localhost.localdomain:2636
DEBUG: Called with: Namespace(basedn=None, bind_dn=None, bind_passwd=None, binddn='cn=Directory Manager', bindpw='secret12', func=<function get_repl_status at 0x7faffe623840>, instance='ldaps://localhost.localdomain:2636', json=False, prompt=False, pwdfile=None, starttls=False, suffix='dc=example,dc=com', verbose=True)
DEBUG: Instance details: {'uri': 'ldaps://localhost.localdomain:2636', 'basedn': None, 'binddn': 'cn=Directory Manager', 'bindpw': None, 'saslmech': None, 'tls_cacertdir': None, 'tls_cert': None, 'tls_key': None, 'tls_reqcert': None, 'starttls': False, 'prompt': False, 'pwdfile': None, 'args': {'ldapurl': 'ldaps://localhost.localdomain:2636', 'root-dn': 'cn=Directory Manager'}}
DEBUG: Allocate <class 'lib389.DirSrv'> with ldaps://localhost.localdomain:2636
DEBUG: Allocate <class 'lib389.DirSrv'> with localhost.localdomain:2636
DEBUG: Allocate <class 'lib389.DirSrv'> with localhost.localdomain:2636
DEBUG: Allocate <class 'lib389.DirSrv'> with ldaps://localhost.localdomain:2636
DEBUG: Allocate <class 'lib389.DirSrv'> with localhost.localdomain:2636
DEBUG: Allocate <class 'lib389.DirSrv'> with localhost.localdomain:2636
DEBUG: open(): Connecting to uri ldaps://localhost.localdomain:2636
DEBUG: Using /etc/openldap/ldap.conf certificate policy
DEBUG: ldap.OPT_X_TLS_REQUIRE_CERT = 2
DEBUG: open(): bound as cn=Directory Manager
DEBUG: Retrieving entry with [('',)]
DEBUG: Retrieved entry [dn:
vendorVersion: 389-Directory/1.4.3.27 B2021.263.1550
]
DEBUG: _gen_selector filter = (&(&(objectclass=nsds5Replica))(|(nsDS5ReplicaRoot=dc=example,dc=com)))
DEBUG: cn=replica,cn=dc\3Dexample\2Cdc\3Dcom,cn=mapping tree,cn=config getVal('nsDS5ReplicaRoot')
DEBUG: list filter = (&(objectclass=nsds5replicationagreement))
DEBUG: cn=inst2toinst1,cn=replica,cn=dc\3Dexample\2Cdc\3Dcom,cn=mapping tree,cn=config get_all_attrs
DEBUG: cn=inst2toinst1,cn=replica,cn=dc\3Dexample\2Cdc\3Dcom,cn=mapping tree,cn=config getVal('nsDS5ReplicaRoot')
DEBUG: cn=inst2toinst1,cn=replica,cn=dc\3Dexample\2Cdc\3Dcom,cn=mapping tree,cn=config getVal('cn')
DEBUG: _gen_selector filter = (&(&(objectclass=nsds5Replica))(|(nsDS5ReplicaRoot=dc=example,dc=com)))
DEBUG: cn=replica,cn=dc\3Dexample\2Cdc\3Dcom,cn=mapping tree,cn=config getVal('nsDS5ReplicaRoot')
DEBUG: cn=inst2toinst1,cn=replica,cn=dc\3Dexample\2Cdc\3Dcom,cn=mapping tree,cn=config getVal('nsds5replicaLastUpdateStatusJSON')
DEBUG: cn=inst2toinst1,cn=replica,cn=dc\3Dexample\2Cdc\3Dcom,cn=mapping tree,cn=config getVal('nsDS5ReplicaHost')
DEBUG: cn=inst2toinst1,cn=replica,cn=dc\3Dexample\2Cdc\3Dcom,cn=mapping tree,cn=config getVal('nsDS5ReplicaPort')
DEBUG: cn=inst2toinst1,cn=replica,cn=dc\3Dexample\2Cdc\3Dcom,cn=mapping tree,cn=config getVal('nsDS5ReplicaRoot')
DEBUG: cn=inst2toinst1,cn=replica,cn=dc\3Dexample\2Cdc\3Dcom,cn=mapping tree,cn=config getVal('nsds5replicatransportinfo')
DEBUG: _gen_selector filter = (&(&(objectclass=nsds5Replica))(|(nsDS5ReplicaRoot=dc=example,dc=com)))
DEBUG: cn=replica,cn=dc\3Dexample\2Cdc\3Dcom,cn=mapping tree,cn=config getVal('nsDS5ReplicaRoot')
DEBUG: cn=replica,cn=dc\3Dexample\2Cdc\3Dcom,cn=mapping tree,cn=config getVal('nsDS5ReplicaId')
DEBUG: Allocate <class 'lib389.DirSrv'> with None
DEBUG: Allocate <class 'lib389.DirSrv'> with localhost.localdomain:1636
DEBUG: Allocate <class 'lib389.DirSrv'> with localhost.localdomain:1636
DEBUG: open(): Connecting to uri ldaps://localhost.localdomain:1636/
DEBUG: Using /etc/openldap/ldap.conf certificate policy
DEBUG: ldap.OPT_X_TLS_REQUIRE_CERT = 2
DEBUG: open(): bound as cn=Directory Manager
DEBUG: Retrieving entry with [('',)]
DEBUG: Retrieved entry [dn:
vendorVersion: 389-Directory/1.4.3.27 B2021.263.1550
]
DEBUG: cn=inst2toinst1,cn=replica,cn=dc\3Dexample\2Cdc\3Dcom,cn=mapping tree,cn=config getVal('nsds5replicaUpdateInProgress')
DEBUG: cn=inst2toinst1,cn=replica,cn=dc\3Dexample\2Cdc\3Dcom,cn=mapping tree,cn=config getVal('nsDS5ReplicaRoot')
DEBUG: cn=inst2toinst1,cn=replica,cn=dc\3Dexample\2Cdc\3Dcom,cn=mapping tree,cn=config getVal('cn')
DEBUG: _gen_selector filter = (&(&(objectclass=nsds5Replica))(|(nsDS5ReplicaRoot=dc=example,dc=com)))
DEBUG: cn=replica,cn=dc\3Dexample\2Cdc\3Dcom,cn=mapping tree,cn=config getVal('nsDS5ReplicaRoot')
DEBUG: cn=inst2toinst1,cn=replica,cn=dc\3Dexample\2Cdc\3Dcom,cn=mapping tree,cn=config getVal('nsDS5ReplicaHost')
DEBUG: cn=inst2toinst1,cn=replica,cn=dc\3Dexample\2Cdc\3Dcom,cn=mapping tree,cn=config getVal('nsDS5ReplicaPort')
DEBUG: cn=inst2toinst1,cn=replica,cn=dc\3Dexample\2Cdc\3Dcom,cn=mapping tree,cn=config getVal('nsDS5ReplicaRoot')
DEBUG: cn=inst2toinst1,cn=replica,cn=dc\3Dexample\2Cdc\3Dcom,cn=mapping tree,cn=config getVal('nsds5replicatransportinfo')
DEBUG: _gen_selector filter = (&(&(objectclass=nsds5Replica))(|(nsDS5ReplicaRoot=dc=example,dc=com)))
DEBUG: cn=replica,cn=dc\3Dexample\2Cdc\3Dcom,cn=mapping tree,cn=config getVal('nsDS5ReplicaRoot')
DEBUG: cn=replica,cn=dc\3Dexample\2Cdc\3Dcom,cn=mapping tree,cn=config getVal('nsDS5ReplicaId')
DEBUG: Allocate <class 'lib389.DirSrv'> with None
DEBUG: Allocate <class 'lib389.DirSrv'> with localhost.localdomain:1636
DEBUG: Allocate <class 'lib389.DirSrv'> with localhost.localdomain:1636
DEBUG: open(): Connecting to uri ldaps://localhost.localdomain:1636/
DEBUG: Using /etc/openldap/ldap.conf certificate policy
DEBUG: ldap.OPT_X_TLS_REQUIRE_CERT = 2
DEBUG: open(): bound as cn=Directory Manager
DEBUG: Retrieving entry with [('',)]
DEBUG: Retrieved entry [dn:
vendorVersion: 389-Directory/1.4.3.27 B2021.263.1550
]
INFO: {'agmt-name': ['inst2toinst1'], 'replica': ['localhost.localdomain:1636'], 'replica-enabled': ['on'], 'update-in-progress': ['FALSE'], 'last-update-start': ['20211012134524Z'], 'last-update-end': ['20211012134524Z'], 'number-changes-sent': ['2:2/0 '], 'number-changes-skipped': ['unavailable'], 'last-update-status': ['Error (0) Replica acquired successfully: Incremental update succeeded'], 'last-init-start': ['20211012125518Z'], 'last-init-end': ['20211012125521Z'], 'last-init-status': ['Error (0) Total update succeeded'], 'reap-active': ['0'], 'replication-status': ['Not in Synchronization: supplier (616585b7000000020000) consumer (Unavailable) State (green) Reason (error (0) replica acquired successfully: incremental update succeeded)'], 'replication-lag-time': ['unavailable']}
INFO: Command successful.
No 'certificate verify failed' error
The behavior is compliant with the fix :
dsconf called with instance name get information from ~/.dsrc
dsconf called with url is considered as remote connection and get info from /etc/openldap/ldap.conf
marking as verified
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (Low: redhat-ds:11 security, bug fix, and enhancement update), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHSA-2021:3955 |