go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
44.08k stars 5.41k forks source link

gitea sending "null" password to stmp server #29139

Closed dsdole closed 7 months ago

dsdole commented 7 months ago

Description

I have a selfhosted gitea instance which i have configured to use my selfhosted mailserver(postfix+dovecot+cyrus-sasl) for sending mail. My mailer config is below(I have the password in single quotes):

[mailer]
ENABLE = true
FROM = gitea@example.com
PROTOCOL = smtp+starttls
SMTP_ADDR = mail.example.com
SMTP_PORT = 587
USER = gitea
PASSWRD = 'gitea_password_here'

When sending a test email from the web gui, I get this error: image

My mailserver's saslauthd service shows this error: image

I am able to use the username and password to login to the mailserver manually with a desktop mail client. I can manually send and receive email as the gitea user.

I am not sure why gitea is sending a NULL password, I have tried using the follow pairs of characters to quote the password in app.ini: " ",' ', ` `.

I cannot reproduce this issue on the demo site as none of my systems are exposed to the internet.

Gitea Version

1.21.5

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

Fedora 39

How are you running Gitea?

I am using a docker compose configuration from the install documentation.

Database

SQLite

davegermiquet commented 7 months ago

What type of auth are you using:

Is it one of the following:

    if strings.Contains(options, "CRAM-MD5") {
        auth = smtp.CRAMMD5Auth(opts.User, opts.Passwd)
    } else if strings.Contains(options, "PLAIN") {
        auth = smtp.PlainAuth("", opts.User, opts.Passwd, host)
    } else if strings.Contains(options, "LOGIN") {
        // Patch for AUTH LOGIN
        auth = LoginAuth(opts.User, opts.Passwd)
    } else if strings.Contains(options, "NTLM") {
        auth = NtlmAuth(opts.User, opts.Passwd)
    }

I'm new here, but I'll try to help. Is it one of the above types if not that might be the issue.

dsdole commented 7 months ago

I am using PLAIN authentication and the server is set to reject connections which don't use starttls. If I change the protocol and app.ini to "smtp" then the server refuses connection. "smtp+starttls" successfully contacts the server but the password isn't working.

davegermiquet commented 7 months ago

I notice in the config its PASSWRD, I think it should be PASSWD not PASSWRD.

Try it...

dsdole commented 7 months ago

Worked perfectly... been staring at my pc too long I think. Thanks.

github-actions[bot] commented 6 months ago

Automatically locked because of our CONTRIBUTING guidelines