Page MenuHomePhabricator

Purge db creds for archived tools
Closed, ResolvedPublic

Description

maintain-dbusers.py creates and updates database accounts for toolforge tools. It creates them but doesn't currently have a way to remove them.

I see two ways to move forward with disabling:

  1. maintain-dbusers.py could check ldap for disable settings on a tool and remove creds
  2. maintain-dbusers.py could compare the set of creds with the set of tools and remove all creds for unfound tools

I prefer the latter but it's a bit riskier.

Event Timeline

It actually does have a way to remove them. We use it for recycling credentials because it will create them again if the user still exists in LDAP. The only issue is that it is manual. You have to run the command by hand right now (sudo -i /usr/local/sbin/maintain-dbusers delete tools.deletemeuser). We could teach it to check the LDAP user for disabled settings and run that function automatically for those that are archived instead of using the cli. It will re-create credentials any time they are re-enabled. I think that's the ideal.

optimistically reassigning

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

[operations/puppet@production] disable-tool: add a job to the sge-cron host that archives databases

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

Change 706769 merged by Andrew Bogott:

[operations/puppet@production] disable-tool: add a job to the sge-cron host that archives databases

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

nskaggs moved this task from Inbox to Soon! on the cloud-services-team (Kanban) board.

Change 711234 had a related patch set uploaded (by Bstorm; author: Bstorm):

[operations/puppet@production] maintain-dbusers: delete users that are removed from ldap

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

Change 711234 merged by Bstorm:

[operations/puppet@production] maintain-dbusers: delete users that are removed from ldap

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

Change 711642 had a related patch set uploaded (by Bstorm; author: Bstorm):

[operations/puppet@production] maintain-dbusers: delete LDAP-absent accounts for real

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

Change 711642 merged by Bstorm:

[operations/puppet@production] maintain-dbusers: delete LDAP-absent accounts for real

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

Change 711693 had a related patch set uploaded (by Bstorm; author: Bstorm):

[operations/puppet@production] maintain-dbusers: old tools are missing and causing crashes

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

Change 711693 merged by Bstorm:

[operations/puppet@production] maintain-dbusers: old tools are missing and causing crashes

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

At this point, if LDAP crashes, so does maintain-dbusers. So as long as LDAP doesn't suddenly learn to reply correctly with nothing, maintain-dbusers will delete accounts that do not exist in LDAP but do exist in it's own database. That's how it decides to create new accounts, so that seems reasonable. I observed it remove a small collection of accounts (user and tool) correctly.

If something somehow is missing from LDAP and then is back, it will come back later with a new password, but the password will be available to the user so that seems ok to me.

Brooke says: "You can check maintain-dbusers on labstore1004 by doing sudo journalctl -u maintain-dbusers since the logs are verbose for deletion"