http://localhost:3000/
http://localhost:3000/favicon.ico?1669909233
2020-02-24T08:26:14Z
ungleich redmine
Open Infrastructure - Task #7764: Dirty LDAP entries
http://localhost:3000/issues/7764?journal_id=31388
2020-02-24T08:26:14Z
Timothée Floure
<ul><li><strong>Assignee</strong> changed from <i>Timothée Floure</i> to <i>Mondi Ravi</i></li></ul>
Open Infrastructure - Task #7764: Dirty LDAP entries
http://localhost:3000/issues/7764?journal_id=31401
2020-02-24T13:29:21Z
Mondi Ravi
<ul></ul><p>Okay, here's the rough code that checks if a given uid has a bytestring type representation, and then modifies it to have the correct value.</p>
<pre>
# import class and constants
from ldap3 import Server, Connection
from django.conf import settings
import ldap3
# define the server
s = ldap3.Server(settings.AUTH_LDAP_SERVER)
# define the connection
c = ldap3.Connection(s, user=settings.LDAP_ADMIN_DN,
password=settings.LDAP_ADMIN_PASSWORD,
raise_exceptions=True)
c.bind()
# uid to search and modify
uid="coderpurple12gmailcom"
result = c.search(
search_base=settings.ENTIRE_SEARCH_BASE,
search_filter='(uid={uid})'.format(uid=uid)
)
entries = c.entries
if entries[0].entry_dn.startswith("uid=b'"):
dn = entries[0].entry_dn
new_superior = dn[dn.index(",")+1:]
c.modify_dn(entries[0].entry_dn, # dn
"uid={uid}".format(uid=uid), # relative_dn
True, # delete_old_dn
new_superior) # new_superior
print(c.result)
# close the connection
c.unbind()
</pre>
<p>Next step: need to loop through all entries and apply this change.</p>
Open Infrastructure - Task #7764: Dirty LDAP entries
http://localhost:3000/issues/7764?journal_id=31402
2020-02-24T13:29:35Z
Mondi Ravi
<ul><li><strong>Status</strong> changed from <i>New</i> to <i>In Progress</i></li></ul>
Open Infrastructure - Task #7764: Dirty LDAP entries
http://localhost:3000/issues/7764?journal_id=31436
2020-02-26T03:25:39Z
Mondi Ravi
<ul><li><strong>Status</strong> changed from <i>In Progress</i> to <i>Resolved</i></li></ul><p>This was resolved on 2.10.2b <a class="external" href="https://code.ungleich.ch/ungleich-public/dynamicweb/-/tags/2.10.2b">https://code.ungleich.ch/ungleich-public/dynamicweb/-/tags/2.10.2b</a> and deployed to production today.</p>
Open Infrastructure - Task #7764: Dirty LDAP entries
http://localhost:3000/issues/7764?journal_id=31438
2020-02-26T03:30:42Z
Mondi Ravi
<ul></ul><p>this is the final code that I used for modifying existing entries.</p>
<pre>
from ldap3 import Server, Connection
from django.conf import settings
import ldap3
import sys
# define the server
s = ldap3.Server(settings.AUTH_LDAP_SERVER)
# define the connection
c = ldap3.Connection(s, user=settings.LDAP_ADMIN_DN,
password=settings.LDAP_ADMIN_PASSWORD,
raise_exceptions=True)
c.bind()
# uid to search and modify
uid_number_start=10053
uid_number_end=10400
x = range(uid_number_start, uid_number_end, 1)
for uid_number in x:
print("%s" % uid_number)
result = c.search(
search_base=settings.LDAP_CUSTOMER_DN,
search_filter='(&(objectClass=inetOrgPerson)(objectClass=posixAccount)'
'(objectClass=top)(uidNumber={uidNumber}))'.format(uidNumber=uid_number),
attributes=['uid', 'mail']
)
entries = c.entries
if len(entries)>0:
print(str(entries[0].mail) + " --- " + str(entries[0].entry_dn))
if entries[0].entry_dn.startswith("uid=b'"):
uid = entries[0].uid[0]
dn = entries[0].entry_dn
new_superior = dn[dn.index(",")+1:]
print("dn=%s, new_superior=%s, uid=%s" % (dn, new_superior, uid))
c.modify_dn(entries[0].entry_dn, "uid={uid}".format(uid=uid),True, new_superior)
print(c.result)
else:
print("Entry DN %s does not start with b'" % entries[0].entry_dn)
else:
print("Could not find an entry for uid_number=%s" % uid_number)
print("*******")
# close the connection
c.unbind()
</pre>
Open Infrastructure - Task #7764: Dirty LDAP entries
http://localhost:3000/issues/7764?journal_id=31458
2020-02-26T13:46:00Z
Nico Schottelius
nico.schottelius@ungleich.ch
<ul></ul><p><a class="email" href="mailto:redmine@ungleich.ch">redmine@ungleich.ch</a> writes:</p>
Open Infrastructure - Task #7764: Dirty LDAP entries
http://localhost:3000/issues/7764?journal_id=31459
2020-02-26T13:46:09Z
Nico Schottelius
nico.schottelius@ungleich.ch
<ul><li><strong>Status</strong> changed from <i>Resolved</i> to <i>Closed</i></li></ul><p><a class="email" href="mailto:redmine@ungleich.ch">redmine@ungleich.ch</a> writes:</p>