Don't use smtps on local host mail servers. #7040

Closed
opened 2025-11-02 07:14:13 -06:00 by GiteaMirror · 0 comments
Owner

Originally created by @tuxmaster5000 on GitHub (Mar 21, 2021).

  • Gitea version (or commit ref): 1.13.4
  • Git version: 2.18.4
  • Operating system: CentOS7
  • Database (use [x]):
    • PostgreSQL
    • [X ] MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No

Description

An common setup is, that postfix will run as an smart host on the same server.
So it is ok to configure the mail settings like this:

MAILER_TYPE = smtp
HOST = [::1]:25

But this will not work, because gitea will always try to setup an secure smtp connection.
But for local host (::1, 127.0.0.1, localhost) it make no sense and will only results in error, because not certificates of official ca can provides an SAN entry for this address.

Workaround

Add this setting:
SKIP_VERIFY = true

But this is an dirty, it will munch better when gitea don't try to use smtps for local host.
And using sendmail is no option in many cases, because not all postfix milters will work there.

Originally created by @tuxmaster5000 on GitHub (Mar 21, 2021). - Gitea version (or commit ref): 1.13.4 - Git version: 2.18.4 - Operating system: CentOS7 - Database (use `[x]`): - [ ] PostgreSQL - [X ] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No ## Description An common setup is, that postfix will run as an smart host on the same server. So it is ok to configure the mail settings like this: ``` MAILER_TYPE = smtp HOST = [::1]:25 ``` But this will not work, because gitea will always try to setup an secure smtp connection. But for local host (::1, 127.0.0.1, localhost) it make no sense and will only results in error, because not certificates of official ca can provides an SAN entry for this address. ### Workaround Add this setting: `SKIP_VERIFY = true` But this is an dirty, it will munch better when gitea don't try to use smtps for local host. And using sendmail is no option in many cases, because not all postfix milters will work there.
GiteaMirror added the type/proposal label 2025-11-02 07:14:13 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#7040