Gerrit/Users
User storage
Gerrit's database is a bunch of git repos on the gerrit servers.
Users are stored in the All-Users
repo on the gerrit servers in /srv/gerrit/git/All-Users.git
The All-Users repo has a ref called refs/meta/external-ids
. Inside are a bunch of files that are stored by the sha1 of the file. They're all git config files used for different purposes.
Used for web login:
# XXYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY is the hex of the sha1 of this file
[externalId 'gerrit:<ldap cn>']
accountId = <id number>
email = <ldap email>
Used for SSH/REST API login:
# XXYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYZ is the hex of the sha1 of this file
[externalId 'username:<ldap uid>']
accountId = <same account id number>
(optional) Used for secondary email addresses:
# XXYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYF00 is the hex of the sha1 of this file
[externalId "mailto:<secondary email added through gerrit>"]
accountId = <same account id number>
email = <secondary email added through gerrit>
the "mailto:" record only exists in the case where someone adds a secondary email
Finding user records
The easiest way to find them is to use git grep
on a checkout of refs/meta/external-ids
.
Inside the checkout, git grep email@example.com
. You should get a result like:
XX/YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYF00: email = email@example.com
If you cat
XX/YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYF00
you should be able to find the accountId
of the user. From there you should be able to find all other information.
User preferences
user records are stored under refs/users/YY/XXYY where XXYY is the accountId from refs/meta/external-ids (that's all the user preferences)
Renaming users
This is difficult and requires some careful git surgery. For more information see: SRE/LDAP/Renaming_users/Gerrit