Skip to content

Commit 02a52d6

Browse files
zeripathguillep2k
andauthored
Add warning to mailer documentation about authentication (#11563)
* Add warning to mailer documentation about authentication References #7966 Signed-off-by: Andrew Thornton <art27@cantab.net> * As per @guillep2k and @mrsdizzie * as per @mrsdizzie Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
1 parent 39b792f commit 02a52d6

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

custom/conf/app.ini.sample

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,8 @@ SUBJECT_PREFIX =
627627
; Mail server
628628
; Gmail: smtp.gmail.com:587
629629
; QQ: smtp.qq.com:465
630-
; Note, if the port ends with "465", SMTPS will be used. Using STARTTLS on port 587 is recommended per RFC 6409. If the server supports STARTTLS it will always be used.
630+
; Using STARTTLS on port 587 is recommended per RFC 6409.
631+
; Note, if the port ends with "465", SMTPS will be used.
631632
HOST =
632633
; Disable HELO operation when hostnames are different.
633634
DISABLE_HELO =
@@ -639,11 +640,13 @@ SKIP_VERIFY =
639640
USE_CERTIFICATE = false
640641
CERT_FILE = custom/mailer/cert.pem
641642
KEY_FILE = custom/mailer/key.pem
642-
; Should SMTP connection use TLS
643+
; Should SMTP connect with TLS, (if port ends with 465 TLS will always be used.)
644+
; If this is false but STARTTLS is supported the connection will be upgraded to TLS opportunistically.
643645
IS_TLS_ENABLED = false
644646
; Mail from address, RFC 5322. This can be just an email address, or the `"Name" <email@example.com>` format
645647
FROM =
646648
; Mailer user name and password
649+
; Please Note: Authentication is only supported when the SMTP server communication is encrypted with TLS (this can be via STARTTLS) or `HOST=localhost`.
647650
USER =
648651
; Use PASSWD = `your password` for quoting if you use special characters in the password.
649652
PASSWD =

docs/content/doc/advanced/config-cheat-sheet.en-us.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,10 +397,15 @@ set name for unique queues. Individual queues will default to
397397
- `DISABLE_HELO`: **\<empty\>**: Disable HELO operation.
398398
- `HELO_HOSTNAME`: **\<empty\>**: Custom hostname for HELO operation.
399399
- `HOST`: **\<empty\>**: SMTP mail host address and port (example: smtp.gitea.io:587).
400+
- Using opportunistic TLS via STARTTLS on port 587 is recommended per RFC 6409.
401+
- `IS_TLS_ENABLED` : **false** : Forcibly use TLS to connect even if not on a default SMTPS port.
402+
- Note, if the port ends with `465` SMTPS/SMTP over TLS will be used despite this setting.
403+
- Otherwise if `IS_TLS_ENABLED=false` and the server supports `STARTTLS` this will be used. Thus if `STARTTLS` is preferred you should set `IS_TLS_ENABLED=false`.
400404
- `FROM`: **\<empty\>**: Mail from address, RFC 5322. This can be just an email address, or
401405
the "Name" \<email@example.com\> format.
402406
- `USER`: **\<empty\>**: Username of mailing user (usually the sender's e-mail address).
403407
- `PASSWD`: **\<empty\>**: Password of mailing user. Use \`your password\` for quoting if you use special characters in the password.
408+
- Please note: authentication is only supported when the SMTP server communication is encrypted with TLS (this can be via `STARTTLS`) or `HOST=localhost`. See [Email Setup]({{< relref "doc/usage/email-setup.en-us.md" >}}) for more information.
404409
- `SKIP_VERIFY`: **\<empty\>**: Do not verify the self-signed certificates.
405410
- **Note:** Gitea only supports SMTP with STARTTLS.
406411
- `SUBJECT_PREFIX`: **\<empty\>**: Prefix to be placed before e-mail subject lines.
@@ -415,7 +420,6 @@ set name for unique queues. Individual queues will default to
415420
- `SENDMAIL_PATH`: **sendmail**: The location of sendmail on the operating system (can be
416421
command or full path).
417422
- `SENDMAIL_TIMEOUT`: **5m**: default timeout for sending email through sendmail
418-
- ``IS_TLS_ENABLED`` : **false** : Decide if SMTP connections should use TLS.
419423

420424
## Cache (`cache`)
421425

docs/content/doc/usage/email-setup.en-us.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ PASSWD = `password`
4646

4747
For the full list of options check the [Config Cheat Sheet]({{< relref "doc/advanced/config-cheat-sheet.en-us.md" >}})
4848

49+
- Please note: authentication is only supported when the SMTP server communication is encrypted with TLS or `HOST=localhost`. TLS encryption can be through:
50+
- Via the server supporting TLS through STARTTLS - usually provided on port 587. (Also known as Opportunistic TLS.)
51+
- SMTPS connection (SMTP over transport layer security) via the default port 465.
52+
- Forced SMTPS connection with `IS_TLS_ENABLED=true`. (These are both known as Implicit TLS.)
53+
- This is due to protections imposed by the Go internal libraries against STRIPTLS attacks.
54+
4955
### Gmail
5056

5157
The following configuration should work with GMail's SMTP server:

0 commit comments

Comments
 (0)