-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
After upgrading to 1.13.0, can no longer login #13832
Comments
Same for me. It only affects the local admin user. The LDAP users are working fine. |
Does it help if you upgrade the Gitea Helm Chart to the latest version, 2.1.0? (at https://git.ssene.ca/sseneca/k8s-server/src/branch/master/gitea/release.yaml#L23) I don't actually know Kubernetes, but I can see that there seems to be a version mismatch. |
Just tried it but unfortunately version 2.0.7+ of the Chart is broken on Kubernetes 1.18, which I'm stuck on for now. I'll follow that issue and once it's resolved try to upgrade the Chart version again. |
I use |
Same here for me (Going back to 1.12.4 solved my login problem) |
I am having the same issue! I just upgraded to 2.1.0 of the helm chart. Wish I saw this issue beforehand :( |
Hi there i will have a look at this issue tomorrow |
Thanks @luhahn you know where to reach me on Discord if you need any info :D It looks like it might be more of an issue with Gitea 1.13.0 than the chart. But I dunno. |
yeah, i dont know, the init container looks fine. But i can't spend any time today for looking at the chart |
This appears related specifically to the helm chart, could you open an issue in the helm chart https://gitea.com/gitea/helm-chart so we can track it there? |
@techknowlogick The problem also affects the downloaded gitea binary. Should we track that in a separate case? |
Hi all, please see https://gitea.com/gitea/helm-chart/issues/79 for more information on this issue. |
I'm confused. Both @birkb and @Antoine2tt are facing this same bug, and neither use the Helm chart. Why is this bug being tracked there? |
Well I'm sure I need to adjust some stuff on the init container for the helm chart. So I also created an issue there. However since this also affects the downloaded binary we should not close this issue here. If I find something useful I will also post it here. |
Well, I deleted the admin user via the gitea cli inside my container and created it again. Which seems to work even after reinstalling the Chart.
Edit: you can also create an additional admin, if you don't want to delete the old one |
For both the users on my instance,
even though one can login and the other can't. |
Yes I know, that's now for newly created admins. I did not find a way to recover the faulty admins. But I have a workaround, posted in the helm chart issue. |
I update the admin password from within the ${GITEA_BIN} ${GITEA_OPTS} admin change-password --username ${GITEA_ADMIN_USERNAME} --password ${GITEA_ADMIN_PASS} I will try the delete/create workaround. |
First of all so I've taken so long to look at or notice this - but let's go through this systematically.
I think the 2FA here is most likely the biggest hint as to what the issue is - and it would be good to know if you even get asked to provide a 2FA or if that doesn't occur. From your provided logs it looks like that doesn't happen - but it's helpful to know for definite.
It would be helpful to check what the difference is for these users in the user table as it might easily be something wrong with a default value. In the next reply I'll walk through the provided log. |
Yep, I don't get asked to provide the 2FA code. I get |
OK, let's go through and find the ultimate place that calls and causes this log and think about what we can do to get some more information - or understanding.
Comes from: gitea/routers/routes/routes.go Line 106 in e39ed0b
and matches: gitea/routers/routes/routes.go Line 366 in e39ed0b
Lines 151 to 232 in e39ed0b
Now let's check the SQL
are caused by: Line 155 in e39ed0b
So we get in to the meat of this function. Which is performed in: Line 173 in e39ed0b
Lines 734 to 819 in e39ed0b
The next SQL emitted :
is caused by: Line 758 in e39ed0b
So what is the result of this query? (You may need to change it slightly to match postgreSQL variant.) Then we get no logs but:
The first of which is: gitea/routers/routes/routes.go Line 112 in e39ed0b
and the counterpart of the first log. But the second bit comes from: Line 177 in e39ed0b
Now that implies that we have received a How do we get a
|
hasUser, err := x.Get(user) |
returned hasUser := true
- You can check this and should have checked the result of the query that this is associated with already. What is the result of that query?
To obtain a models.ErrUserNotExist
if hasUser == true
we have two options:
Lines 764 to 765 in e39ed0b
switch user.LoginType { | |
case LoginNoType, LoginPlain, LoginOAuth2: |
(this is the most likely path)
Line 766 in e39ed0b
if user.IsPasswordSet() && user.ValidatePassword(password) { |
The most likely problem is that this fails and interestingly if we look at the line below it we get a hint as to what might really be the problem:
Line 769 in e39ed0b
if user.PasswdHashAlgo != setting.PasswordHashAlgo { |
I recall on 1.13 we changed the default hashing algorithm to argon2
. Is it possible that hashing algorithm is detected incorrectly for postgres? The presumption was that the default would have been stored in the database at the time of insertion and was previously pbkdf2
.
I'm gonna stop here because I bet that that is the issue.
|
OK the other routes should definitely cause more SQL to be emitted so those are ruled out. The issue is definitely at: Line 766 in e39ed0b
|
Lines 431 to 434 in e39ed0b
just tests that the user's password is not empty - and although there are a few changes here I think it should make no difference. Lines 418 to 429 in e39ed0b
calls hashPassword to check the user's passwd: Lines 392 to 410 in e39ed0b
So the question is is I guess the only answer here is to add more debugging statements in to a locally built copy of gitea. I don't see how helm could be responsible for this - but neither do I understand how this could have become so broken. |
I'll reopen since it looks not solved to me |
@zeripath i don't know if it can helps you, but i have the same issue (only 1 user, local admin, can not login after 1.13 upgrade, error 500), and i'm not running Gitea with Helm (i don't even know what Helm is) i'm just running Gitea with Docker (database = SQLite) i've been back to 1.12.4 and it's working again. If you need anything, i'll be glad to help you. |
Yeah, both of these accounts were created before I upgraded Gitea to Like others have said I really doubt this is anything to do with Helm. |
I think we need one of you to build a gitea with a some added logging to the ValidatePassword function. |
So I can't replicate this on my testing system. I wonder is this possibly a schema issue? from 1.13 we're a lot more strict with the schema - is it possible that the user table is in a different schema? |
I don't have time to debug things but the workaround posted by @luhahn worked for me. Now I can login again after changing my password with the other admin account. I checked the DB and the password hash algorithm has also been updated:
|
@sseneca did the passwd and/or salt change? Is it possible that the stored passwd hash is in the incorrect hash_algo? |
I have a similar issue. Users that tried to reset their password using account recovery were unable to login using the new password. Setting the password from command line had the same effect. Only when setting the password using the web interface, they could finally log in again. I checked the user table in the database and noticed, that passwd_hash_also was only updated when the password was set using the webui, so I have the feeling that the password is hashed using the new algorithm but the passwd_hash_algo is not updated in some cases. |
Could the issue be, that passwd_hash_algo is not updated here when the password is changed? gitea/routers/user/setting/account.go Line 71 in f8e9a3d
|
That could very well be it. |
`user.HashPassword` may potentially - and in fact now likely does - change the `passwd_hash_algo` therefore whenever the `passwd` is updated, this also needs to be updated. Fix go-gitea#13832 Thanks @fblaese for the hint Signed-off-by: Andrew Thornton <art27@cantab.net>
go-gitea#13966) Backport go-gitea#13966 `user.HashPassword` may potentially - and in fact now likely does - change the `passwd_hash_algo` therefore whenever the `passwd` is updated, this also needs to be updated. Fix go-gitea#13832 Thanks @fblaese for the hint Signed-off-by: Andrew Thornton <art27@cantab.net>
[x]
):Description
After updating to v1.13.0, I can no longer login to to my account on my two-account Gitea instance. The account is the only admin account and also has 2FA enabled. The other account logs in fine, is not an admin, and does not have 2FA enabled.
Whilst it didn't appear in the above logs, other times when I've tried I've also seen this line:
Not sure if it's relevant though because like I said it didn't appear when I tried in the above logs.
Also note that I've read this thread but after checking the account in the database
is_active
ist
. Forum post here.The text was updated successfully, but these errors were encountered: