Page MenuHomePhabricator

Drop ldapsupportlib.py
Closed, ResolvedPublic

Description

ldapsupportlib.py quite terrible and the wrong level of abstraction on so many things (enforces people use OptParse...) and also not python 3 compatible. We should entirely drop it.

Related Objects

Mentioned In
T313595: New Python base layer to manage users/groups in LDAP
T247364: Forward port Python2 files to Python3 in Puppet Repository
T122595: Restore ldaplist -l passwd
rOPUP842c300c8be7: ldap: Add warning to ldaplist
rOPUP84d9a6478bb1: ldap: Vastly simplify modify-ldap-group
rOPUP5132b8db6e5a: ldap: Replace change-ldap-password with reset-ldap-password
rOPUPf7759caf2d6a: ldap: Remove unused homedirectorymanager
rOPUP6f47ff295bba: ldap: Drastically simplify modify-ldap-user
rOPUP5f8a0599d3f1: ldap: Add warning to ldaplist
rOPUP2629d7faa769: ldap: Vastly simplify modify-ldap-group
rOPUPf42bad4fca7b: ldap: Add warning to ldaplist
rOPUPc369845a0348: ldap: Vastly simplify modify-ldap-group
rOPUP9f73981e4a67: ldap: Remove unused homedirectorymanager
rOPUP0d569b522b48: ldap: Drastically simplify modify-ldap-user
rOPUPd108a2480a48: ldap: Replace change-ldap-password with reset-ldap-password
rOPUP5e33e298bd2e: ldap: Add warning to ldaplist
rOPUPaba10d1b0e3d: ldap: Vastly simplify modify-ldap-group
rOPUP1b6bee3dd310: ldap: Remove unused homedirectorymanager
rOPUPa4da00008f96: ldap: Drastically simplify modify-ldap-user
rOPUP41ccec858b76: ldap: Replace change-ldap-password with reset-ldap-password
rOPUPc3457c9d6b69: ldap: Kill a bunch of unused scripts
rOPUPa19c13d67dce: Get rid of the LDAP+YAML ENC
rOPUP697a5e3ddff9: Get rid of the LDAP+YAML ENC
rOPUP47c68aff42fb: ldap: Kill a bunch of unused scripts
rOPUP3f3b23e914d3: ldap: Kill a bunch of unused scripts
rOPUP395ead9b436d: ldap: Kill a bunch of unused scripts
rOPUP783523de5ee3: ldap: Kill a bunch of unused scripts
rOPUP2a838eb9ff76: ldap: Kill a bunch of unused scripts
rOPUPbcef76edcc90: ldap: Rewrite ssh lookup script
rOPUP7706639b63ce: ldap: Provide ldap credentials and servernames in YAML format
rOPUP0cdcc79576d0: ldap: Remove add-labs-user & scriptconfig.py

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

Change 242039 merged by Yuvipanda:
ldap: Rewrite ssh lookup script

https://gerrit.wikimedia.org/r/242039

chasemp subscribed.

Change 242044 merged by Yuvipanda:
tools: Remove ldapspportlib use from toolschecker

https://gerrit.wikimedia.org/r/242044

Change 301040 had a related patch set uploaded (by Yuvipanda):
ldap: Kill a bunch of unused scripts

https://gerrit.wikimedia.org/r/301040

Change 301036 had a related patch set uploaded (by Yuvipanda):
Get rid of the LDAP YAML ENC

https://gerrit.wikimedia.org/r/301036

Change 301036 merged by Yuvipanda:
Get rid of the LDAP YAML ENC

https://gerrit.wikimedia.org/r/301036

Change 301040 merged by Yuvipanda:
ldap: Kill a bunch of unused scripts

https://gerrit.wikimedia.org/r/301040

Change 301052 had a related patch set uploaded (by Yuvipanda):
ldap: Drastically simplify modify-ldap-user

https://gerrit.wikimedia.org/r/301052

Change 301048 had a related patch set uploaded (by Yuvipanda):
ldap: Replace change-ldap-password with reset-ldap-password

https://gerrit.wikimedia.org/r/301048

Change 301053 had a related patch set uploaded (by Yuvipanda):
ldap: Remove unused homedirectorymanager

https://gerrit.wikimedia.org/r/301053

Change 301059 had a related patch set uploaded (by Yuvipanda):
ldap: Vastly simplify modify-ldap-group

https://gerrit.wikimedia.org/r/301059

Change 301061 had a related patch set uploaded (by Yuvipanda):
ldap: Add warning to ldaplist

https://gerrit.wikimedia.org/r/301061

Change 301048 merged by Yuvipanda:
ldap: Replace change-ldap-password with reset-ldap-password

https://gerrit.wikimedia.org/r/301048

Change 301061 merged by Yuvipanda:
ldap: Add warning to ldaplist

https://gerrit.wikimedia.org/r/301061

Change 301059 merged by Yuvipanda:
ldap: Vastly simplify modify-ldap-group

https://gerrit.wikimedia.org/r/301059

Change 301053 merged by Yuvipanda:
ldap: Remove unused homedirectorymanager

https://gerrit.wikimedia.org/r/301053

Change 301052 merged by Yuvipanda:
ldap: Drastically simplify modify-ldap-user

https://gerrit.wikimedia.org/r/301052

I just used ldaplist on terbium and saw the warning:

If you are still relying on ldaplist and not using ldapsearch,
please comment on https://phabricator.wikimedia.org/T114063
before 30 August 2016. If nobody comments, ldaplist will be removed!

Maybe that message could contain an example how do use ldapsearch for the most common search, the equivalent of: ldaplist -l passwd someuser

currently i am getting:

SASL/DIGEST-MD5 authentication started
Please enter your password:

@Dzahn ah, can you tell me what you were trying to do with ldaplist?

ah, I see you included it, nvm.

Yes, you need ldapsearch -x followed by your LDAP query. The -x is important, it specifies basic authentication instead of SASL.

Could you paste the entire command that replaces "ldaplist -l passwd?

ldapsearch -x objectClass=posixaccount should give you the same thing as ldaplist -l passwd
ldapsearch -x uid=krenair should give you the same thing as ldaplist -l passwd krenair

Thank you very much. That works. No concerns removing ldaplist then.

ldapsearch -x objectClass=posixaccount should give you the same thing as ldaplist -l passwd
ldapsearch -x uid=krenair should give you the same thing as ldaplist -l passwd krenair

Can we replace ldaplist with a simple script that echos those? It might take a while before my muscles unlearn ldaplist -l passwd ;-)

Just found that ldaplist is scheduled for deletion. I am still relying on it because its syntax is quite trivial. If I want to lookup my LDAP informations I just:

ldaplist -l passwd hashar

Way easier than the very cumbersome ldapsearch command that requires you to remember the -x and the LDAP properties..

I arrived here by looking at outdated documentation found on wikitech. I found the new one, too. But please before killing it, make sure you redirect on all places to the right command (for casual users like me that do not want to think).

E.g: https://wikitech.wikimedia.org/wiki/Ops_Clinic_Duty#LDAP_group_changes

hashar renamed this task from Kill ldapsupportlib.py to Drop ldapsupportlib.py.Sep 1 2016, 10:50 AM
hashar updated the task description. (Show Details)
hashar set Security to None.

Apparently the admin tool in Toolforge uses ldaplist -l servicegroups to maintain a local to Toolforge(?!) git repo containing servicegroups.ldif which is a dump of the servicegroup tree.

I believe this was added at some point as a backup in case someone accidentally removes themselves from the service group. @coren may remember the background story :-)

I am back here because a comment on ldaplist on mwmaint1002:

If you are still relying on ldaplist and not using ldapsearch,
please comment on https://phabricator.wikimedia.org/T114063
before 30 August 2016. If nobody comments, ldaplist will be removed!

https://wikitech.wikimedia.org/wiki/SRE_Clinic_Duty#LDAP_group_changes still needs to be updated with the alternative commands, do not close before that.

I am here because of the same comment – https://wikitech.wikimedia.org/wiki/LDAP#Common_LDAP_administrative_actions also still recommends ldaplist (and mwmaint1001, which no longer exists).

@Lucas_Werkmeister_WMDE ldaplist still exists and works. Just the maintenance server has changed to mwmaint1002.

[mwmaint1002:~] $ which ldaplist
/usr/local/bin/ldaplist

[mwmaint1002:~] $ ldaplist -l passwd dzahn | grep cn:
	cn: Dzahn

@Dzahn I’m aware, the command told me to leave a comment here so I did :)

Fixed section to use ldapsearch and new admin hostname

Ok, let's just fix the docs regarding the host name. I can as soon as i got my phone to charge again so i can use 2fa, heh.

About this task in general: I don't think anyone is working on this since Yuvi started it but isn't with WMF anymore.

Edit: Thanks Krenair!

Dzahn changed the task status from Open to Stalled.May 29 2020, 9:18 AM

Hmm, who or what (task?) is this task is stalled on ("If a report is waiting for further input (e.g. from its reporter or a third party) and can currently not be acted on")?

And different question: What still needs to be done here?
Admin tool in Toolforge?
/operations/puppet/modules/ldap/files/scripts/add-ldap-group.py , /operations/puppet/modules/ldap/files/scripts/modify-mfa.py ?
Something else / more?
Thanks for clarifying.

Aklapper changed the task status from Stalled to Open.Jan 17 2021, 8:21 AM

No reply, boldly reopening...

@Aklapper It was stalled because the person who created it isn't active anymore and nobody else is working on it or expected to work on it anytime soon. Furthermore nobody else seems to have answers to the questions you are raising. So yes, "waiting for further input from reporter" seemed accurate.

Aklapper lowered the priority of this task from Medium to Low.Jan 18 2021, 10:27 PM

I think that is for cloud-services-team

One of the last use I remember was for ldaplist a custom wrapper using ldapsupportlib.py to ease search. The wrapper was helpful but nowadays I just use getent or ldapsearch using https://wikitech.wikimedia.org/wiki/Ldapsearch as reference.

I don't know whether ldapsupportlib.py was used anywhere else beside ldaplist.

Change 691959 had a related patch set uploaded (by Andrew Bogott; author: Andrew Bogott):

[operations/puppet@production] cloud-vps: don't install ldapsupportlib on Bullseye

https://gerrit.wikimedia.org/r/691959

Change 691959 merged by Andrew Bogott:

[operations/puppet@production] cloud-vps: don't install ldapsupportlib on Bullseye

https://gerrit.wikimedia.org/r/691959

Change 862833 had a related patch set uploaded (by Slyngshede; author: Slyngshede):

[operations/puppet@production] ldap:client:utils remove outdated ldaplist util.

https://gerrit.wikimedia.org/r/862833

Change 862833 merged by Slyngshede:

[operations/puppet@production] ldap:client:utils remove outdated ldaplist util.

https://gerrit.wikimedia.org/r/862833

Change 877957 had a related patch set uploaded (by Muehlenhoff; author: Muehlenhoff):

[operations/puppet@production] Fix up package list after ldapsupportlib removal

https://gerrit.wikimedia.org/r/877957

Change 877957 merged by Muehlenhoff:

[operations/puppet@production] Fix up package list after ldapsupportlib removal

https://gerrit.wikimedia.org/r/877957