On 18 Aug 2020, at 10:42, Boyen <Boy...@gmail.com> wrote:The gerrit's auth type is LDAP. And gerrit version is 3.1.3.
After delete account's preferred-email by "[1] cmd-set-account", the account cannot login anymore.
ssh -p 29418 gerrit.company.com gerrit set-account --delete-email "ACC...@company.com'" ACCOUNT
According to the error_log & external.ids, it seems that the LDAP account's external.ids have both of ["identity": "username:ACCOUNT"] and ["identity": "gerrit:ACCOUNT"]. When delete account's preferred-email, the external.ids:["identity": "gerrit:ACCOUNT"] is deleted, too. Therefore the ACCOUNT is decided as NEW account due to there is no ["identity": "gerrit:ACCOUNT"] in external.ids. And then gerrit try to create new account, but create fail due to there is ["identity": "username:ACCOUNT"] in external.ids.
error_log as below:com.google.gerrit.httpd.auth.ldap.LdapLoginServlet : 'ACCOUNT' failed to sign in
com.google.gerrit.server.account.AccountException: Cannot assign external ID "username:ACCOUNT" to account 1000017; external ID already in use.
at com.google.gerrit.server.account.AccountManager.create(AccountManager.java:306)
at com.google.gerrit.server.account.AccountManager.authenticate(AccountManager.java:141)
at com.google.gerrit.httpd.auth.ldap.LdapLoginServlet.doPost(LdapLoginServlet.java:123)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:661)
...snip...
I already do some try, but the LDAP account still cannot login.
Can you please advise, how to solve this issue?
--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en
---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/repo-discuss/a529cc1c-8df7-409e-905d-2678620c54b2o%40googlegroups.com.
On 18 Aug 2020, at 10:42, Boyen <Boy...@gmail.com> wrote:The gerrit's auth type is LDAP. And gerrit version is 3.1.3.
After delete account's preferred-email by "[1] cmd-set-account", the account cannot login anymore.
ssh -p 29418 gerrit.company.com gerrit set-account --delete-email "ACC...@company.com'" ACCOUNT
According to the error_log & external.ids, it seems that the LDAP account's external.ids have both of ["identity": "username:ACCOUNT"] and ["identity": "gerrit:ACCOUNT"]. When delete account's preferred-email, the external.ids:["identity": "gerrit:ACCOUNT"] is deleted, too. Therefore the ACCOUNT is decided as NEW account due to there is no ["identity": "gerrit:ACCOUNT"] in external.ids. And then gerrit try to create new account, but create fail due to there is ["identity": "username:ACCOUNT"] in external.ids.You have hit exactly the bug I raised and fixed a couple of months ago:If you upgrade to v3.1.5, the problem is resolved.P.S. As a rule of thumb, always keep the latest patch-level on Gerrit, as we typically fix lots of issues in stable branches.error_log as below:com.google.gerrit.httpd.auth.ldap.LdapLoginServlet : 'ACCOUNT' failed to sign in
com.google.gerrit.server.account.AccountException: Cannot assign external ID "username:ACCOUNT" to account 1000017; external ID already in use.
at com.google.gerrit.server.account.AccountManager.create(AccountManager.java:306)
at com.google.gerrit.server.account.AccountManager.authenticate(AccountManager.java:141)
at com.google.gerrit.httpd.auth.ldap.LdapLoginServlet.doPost(LdapLoginServlet.java:123)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:661)
...snip...
I already do some try, but the LDAP account still cannot login.
Can you please advise, how to solve this issue?Because the removal of the external-id has been done with a commit on the All-Users.git repository, refs/meta/external-ids refs, you can just revert the commit and the problem will be resolved.For preventing that problem to happen again, *upgrade* please :-)HTHLuca.
Try1: inactive/active the target account by [1] & [2]
ssh -p 29418 gerrit.company.com gerrit set-account --inactive ACCOUNT
curl --request PUT http://gerrit.company.com:8080/a/accounts/1000003/active
Try2: Add deleted mail back and set it as preferred email
ssh -p 29418 gerrit.company.com gerrit set-account --add-email ...@company.com ACCOUNT
ssh -p 29418 gerrit.company.com gerrit set-account --preferred-email ...@company.com ACCOUNT
Try3: Rename "mailto:...@company.com" to "gerrit:ACCOUNT" in refs/meta/external-ids
<Download refs/meta/external-ids>
git clone "http://gerrit.company.com:8080/All-Users
cd All-Users
git fetch origin refs/meta/external-ids
git checkout -b refs/meta/external-ids FETCH_HEAD
<Rename "mailto:...@company.com" to "gerrit:ACCOUNT">
echo -n 'gerrit:ACCOUNT' |sha1sum
6e5e3b47ad6a8731dc7d05eebfcc7723af7d3976 -
echo -n 'mailto:...@company.com' |sha1sum
ce74967b7174fa686f39a77faf6fd7820bcf8560 -
mv ce74967b7174fa686f39a77faf6fd7820bcf8560 6e5e3b47ad6a8731dc7d05eebfcc7723af7d3976
Modify 6e5e3b47ad6a8731dc7d05eebfcc7723af7d3976 from '[externalId "mailto:...@company.com"]' to '[externalId "gerrit:ACCOUNT"]'
<push change files>
git add --all
git commit -m "update external-ids"
git push origin refs/meta/external-ids
Try4: Delete account or delete ["identity": "username:ACCOUNT"]. But gerrit v3.1.3 Not Allowed
Refer:
[1] https://gerrit-review.googlesource.com/Documentation/cmd-set-account.html
[2] https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html
Thanks
Boyen
More info at http://groups.google.com/group/repo-discuss?hl=en
---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-d...@googlegroups.com.
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en
---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/repo-discuss/b319f04d-cb2c-4b6f-b072-e6452e7a64afo%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/repo-discuss/b319f04d-cb2c-4b6f-b072-e6452e7a64afo%40googlegroups.com.
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en
---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/repo-discuss/84943c81-eba8-40f9-a2bb-08c24b920877o%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/repo-discuss/74ad3305-89f8-466b-850d-43a26e4b26a7n%40googlegroups.com.
On 1 Sep 2020, at 08:09, BoYen <boy...@gmail.com> wrote:Hi Luca,I try to do "index" by REST API[5], but the account still cannot login.And I try to delete the account external IDs[6], but fail then show "External id username:ACCOUNT cannot be deleted"
To view this discussion on the web visit https://groups.google.com/d/msgid/repo-discuss/CAKanNZjjVB28X%2BM%3DH7bHj%2BQe%2B5%3D7s_dHathTCXXVZERm8ngsFA%40mail.gmail.com.
On 28 Oct 2020, at 09:14, Boyen <boy...@gmail.com> wrote:Hi Luca,Can you please advise how to solve this issue?ThanksBoyen 在 2020年9月7日 星期一上午11:35:54 [UTC+8] 的信中寫道:Hi Luca,I try 3 test for this, but all fail.[Test1] I delete the external id on the All-Users.git bare repository, on the server. And then reindex the accounts. But the account still cannot login.[Test2] I do "flush-caches --all" before STEP1, but still cannot solve this issue.[Test3] I change STEP5 to do rename username:ACCOUNT, but still cannot solve this issue.I list my steps and log as below.Could you help to confirm the step are correct or not for "Test1"STEP:1. sudo /data-gerrit/data/tmp/gerrit03/bin/gerrit.sh stop2. git clone /data-gerrit/data/tmp/gerrit03/git/All-Users.git3. cd All-Users4. git fetch origin refs/meta/external-ids5. rm fcc13711af17c3718daec0e78a5bf04ad064ca26 (remove username:ACCOUNT external-ids)
6. git add .;git commit -m "remove external-ids"7. sudo git push origin refs/meta/external-ids
To view this discussion on the web visit https://groups.google.com/d/msgid/repo-discuss/d54d6a72-75d5-4eb6-994c-4bd2adda6231n%40googlegroups.com.