mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Use new LDAPClient constructors
Replace get_ldap_uri() + LDAPClient() with new LDAPClient constructors like LDAPClient.from_realm(). Some places now use LDAPI with external bind instead of LDAP with simple bind. Although the FQDN *should* resolve to 127.0.0.1 / [::1], there is no hard guarantee. The draft https://tools.ietf.org/html/draft-west-let-localhost-be-localhost-04#section-5.1 specifies that applications must verify that the resulting IP is a loopback API. LDAPI is always local and a bit more efficient, too. The simple_bind() method also prevents the caller from sending a password over an insecure line. Signed-off-by: Christian Heimes <cheimes@redhat.com> Reviewed-By: Rob Crittenden <rcritten@redhat.com>
This commit is contained in:
committed by
Rob Crittenden
parent
5be9341fba
commit
a3934a211d
@@ -1637,8 +1637,7 @@ def cert_summary(msg, certs, indent=' '):
|
||||
|
||||
|
||||
def get_certs_from_ldap(server, base_dn, realm, ca_enabled):
|
||||
ldap_uri = ipaldap.get_ldap_uri(server)
|
||||
conn = ipaldap.LDAPClient(ldap_uri)
|
||||
conn = ipaldap.LDAPClient.from_hostname_plain(server)
|
||||
try:
|
||||
conn.gssapi_bind()
|
||||
certs = certstore.get_ca_certs(conn, base_dn, realm, ca_enabled)
|
||||
|
||||
@@ -70,8 +70,7 @@ def run_with_args(api):
|
||||
|
||||
"""
|
||||
server = urlsplit(api.env.jsonrpc_uri).hostname
|
||||
ldap_uri = ipaldap.get_ldap_uri(server)
|
||||
ldap = ipaldap.LDAPClient(ldap_uri)
|
||||
ldap = ipaldap.LDAPClient.from_hostname_secure(server)
|
||||
|
||||
tmpdir = tempfile.mkdtemp(prefix="tmp-")
|
||||
ccache_name = os.path.join(tmpdir, 'ccache')
|
||||
|
||||
Reference in New Issue
Block a user