Bug 50638 - Provide a getSambaConnection() function
Provide a getSambaConnection() function
Status: NEW
Product: UCS
Classification: Unclassified
Component: Samba4
UCS 4.4
Other Linux
: P5 normal (vote)
: ---
Assigned To: Samba maintainers
Samba maintainers
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2019-12-13 15:48 CET by Florian Best
Modified: 2020-07-15 19:12 CEST (History)
2 users (show)

See Also:
What kind of report is it?: Development Internal
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Best univentionstaff 2019-12-13 15:48:41 CET
We have a lot of code redundancy regarding creating a univention.uldap.access() connection which connects to Samba 4.

We should add something similar to getMachineConnection():
For example getSambaConnection().
Comment 1 Florian Best univentionstaff 2020-07-15 17:51:52 CEST
I often use this snippet:

import univention.uldap

x = {'binddn': None, 'start_tls': 0, 'uri': 'ldapi://%2Fvar%2Flib%2Fsamba%2Fprivate%2Fldap_priv%2Fldapi', 'base': 'DC=school,DC=dev', 'bindpw': None, 'host': 'localhost', 'ca_certfile': None, 'port': 389}
lo = univention.uldap.access(**x)
Comment 2 Arvid Requate univentionstaff 2020-07-15 19:12:53 CEST
The connection via ldapi doesn't use machine credentials, which may result in
different (less) ACLs taking effect. So that may be comparable to
uldap.getAdminConnection(). I guess in AD terms you would be 'System'.
Also, ldapi only works on the local system, unlike uldap.getMachineConnection()

If we want/need(?) something like this in uldap, then something like
getADConnection() would be a better abstraction IMHO, since we probably also
would want to use that in the AD-Connector.
It would use python-ldap and could default to machine credentials over LDAP+TLS,
but would allow other options (LDAPS, LDAPI, GSSAPI).

A complementary/separate approach would be to use samba.Ldb (or
samba.samdb.SamDB) instead of python-ldap, but I would not want to inject
a dependency on python-samba into uldap.