-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
SMTP-Auth broken in gitea 1.18.0+rc0 #21744
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
Comments
Thank you for this report. Which SMTP server are you using? I suspect it's an issue with Gitea itself, but still would be helpful in case of replicating issue. |
I am using a selfhosted mailcow: https://mailcow.email If you need an account for testing, I can provide one. |
same issue with office365 SMTP auth. |
I will propose a fix for it. |
If you could build Gitea by yourselves, feel free to take a try for PRs:
|
Thanks for the fix. I will give it a try later today. And praise to backups ... |
Backport #21767 The purpose of #18982 is to improve the SMTP mailer, but there were some unrelated changes made to the SMTP auth in d60c438 This PR reverts these unrelated changes, fix #21744 Co-authored-by: Lunny Xiao <[email protected]>
The purpose of go-gitea#18982 is to improve the SMTP mailer, but there were some unrelated changes made to the SMTP auth in go-gitea@d60c438 This PR reverts these unrelated changes, fix go-gitea#21744
I still owe a feedback: The change works for me. Thank you |
Thanks for discovering and solving the issue. It would be great to try this fix. Will there be another 1.18.0 release candidate that I can install? |
You could use the HEAD build from the 1.18 branch. At this stage it should be more stable than r0 |
Thanks for the suggestion @eeyrjmr! I didn't know such builds were available but found them at https://dl.gitea.io/gitea/main now. |
Does the HEAD of 1.18 correspond to this image: `gitea/gitea:1.18-dev? Thanks |
Wait, that's a good question! Maybe https://dl.gitea.io/gitea/1.18 is better? I imagine this is built from release/v1.18. |
The merged PRs are in:
|
Installed the latest version 1.18.0+rc0-29-g16772ffde from https://dl.gitea.io/gitea/1.18. Sending a test email results in
Does that mean I haven't received the fix for this issue or is anything else wrong? |
UPDATE: I was able to resolve the issue by replacing |
@PaulBol Good you found the solution. These settings have been changed recently. Just as a not as others might stumble upon this ussue to: This issue does not relate to sending emails from gitea, but to authenticating users using an SMTP-Server as external authentication mechanism. |
I don't understand why you needed to do this. The configuration should fallback to HOST if SMTP_ADDR is absent. |
@zeripath - I had made some other changes while trying to get the configuration to work. However, I double-checked that it boils done to Old mailer configuration - not working ("failed to establish network connection to SMTP server...") [mailer]
ENABLED = true
HOST = mailout.provider.com:587
FROM = [email protected]
USER = <username>
PASSWD = <password> New mailer configuration - works [mailer]
ENABLED = true
SMTP_ADDR = mailout.provider.com
SMTP_PORT = 587
FROM = [email protected]
USER = <username>
PASSWD = <password> |
Ah! The fallbacks won't work due to a mistaken assumption by the author of the PR. |
Alright, I see. Thanks for checking. "startls" might be a typo, by the way. |
yup I've just spotted that! I'm just about to push up a PR fixing the deprecation fall backs. |
Unfortunately the fallback configuration code for [mailer] that were added in go-gitea#18982 are incorrect. When you read a value from an ini section that key is added. This leads to a failure of the fallback mechanism. Further there is also a spelling mistake in the startTLS configuration. This PR restructures the mailer code to first map the deprecated settings on to the new ones - and then use ini.MapTo to map those on to the struct with additional validation as necessary. Ref go-gitea#21744 Signed-off-by: Andrew Thornton <[email protected]>
Awesome how you identified and resolved the issue in 30 minutes or so. I hope to work on a Go project some day and learn how the language works. |
It helps that I really do know this codebase - but assuming that you know any imperative language then go is extremely easy to learn. |
Unfortunately the fallback configuration code for [mailer] that were added in #18982 are incorrect. When you read a value from an ini section that key is added. This leads to a failure of the fallback mechanism. Further there is also a spelling mistake in the startTLS configuration. This PR restructures the mailer code to first map the deprecated settings on to the new ones - and then use ini.MapTo to map those on to the struct with additional validation as necessary. Ref #21744 Signed-off-by: Andrew Thornton <[email protected]>
Backport go-gitea#21945 Unfortunately the fallback configuration code for [mailer] that were added in go-gitea#18982 are incorrect. When you read a value from an ini section that key is added. This leads to a failure of the fallback mechanism. Further there is also a spelling mistake in the startTLS configuration. This PR restructures the mailer code to first map the deprecated settings on to the new ones - and then use ini.MapTo to map those on to the struct with additional validation as necessary. Ref go-gitea#21744 Signed-off-by: Andrew Thornton <[email protected]>
Backport #21945 Unfortunately the fallback configuration code for [mailer] that were added in #18982 are incorrect. When you read a value from an ini section that key is added. This leads to a failure of the fallback mechanism. Further there is also a spelling mistake in the startTLS configuration. This PR restructures the mailer code to first map the deprecated settings on to the new ones - and then use ini.MapTo to map those on to the struct with additional validation as necessary. Ref #21744 Signed-off-by: Andrew Thornton <[email protected]>
Description
There are two problems with smtp auth in gitea:
When a user tries to log in, an empty page is shown.
In the logs one can see this:
I checked these things:
Gitea Version
1.18-rc0 (docker image gitea:latest)
Can you reproduce the bug on the Gitea demo site?
No
Log Gist
No response
Screenshots
No response
Git Version
not relevant
Operating System
Linux (docker)
How are you running Gitea?
Used this docker-compose.yml
docker image ls
:Database
SQLite
The text was updated successfully, but these errors were encountered: