1
0
mirror of https://blitiri.com.ar/repos/chasquid synced 2026-01-08 17:51:57 +00:00

courier: Use the hostname in SMTP HELO

The SMTP courier, which handles outgoing connections, uses the domain of
the envelope's from as the domain in the HELO/EHLO greeting.

This works fine in practice, but ideally the domain used in the greeting
should match the reverse DNS record. This used to be more relevant but
nowadays it is not really enforced; however, it sometimes comes up in
self checks, and might cause some confusion when troubleshooting.

So this patch makes it use the configured hostname instead, which is
under the users' control and more likely to be compliant. It also
simplifies the code.

The documentation of the hostname configuration option is also updated
to mention this behaviour.

Thanks to Jonas Seydel (thor77) for bringing this up.
This commit is contained in:
Alberto Bertogli
2020-05-13 19:52:08 +01:00
parent 7b0703eaa0
commit 13ee3ba482
8 changed files with 37 additions and 31 deletions

View File

@@ -36,7 +36,7 @@ func newSMTP(t *testing.T) (*SMTP, string) {
t.Fatal(err)
}
return &SMTP{dinfo, nil}, dir
return &SMTP{"hello", dinfo, nil}, dir
}
// Fake server, to test SMTP out.
@@ -94,7 +94,7 @@ func TestSMTP(t *testing.T) {
responses := map[string]string{
"_welcome": "220 welcome\n",
"EHLO me": "250 ehlo ok\n",
"EHLO hello": "250 ehlo ok\n",
"MAIL FROM:<me@me>": "250 mail ok\n",
"RCPT TO:<to@to>": "250 rcpt ok\n",
"DATA": "354 send data\n",
@@ -140,14 +140,14 @@ func TestSMTPErrors(t *testing.T) {
// MAIL FROM not allowed.
{
"_welcome": "220 mail from not allowed\n",
"EHLO me": "250 ehlo ok\n",
"EHLO hello": "250 ehlo ok\n",
"MAIL FROM:<me@me>": "501 mail error\n",
},
// RCPT TO not allowed.
{
"_welcome": "220 rcpt to not allowed\n",
"EHLO me": "250 ehlo ok\n",
"EHLO hello": "250 ehlo ok\n",
"MAIL FROM:<me@me>": "250 mail ok\n",
"RCPT TO:<to@to>": "501 rcpt error\n",
},
@@ -155,7 +155,7 @@ func TestSMTPErrors(t *testing.T) {
// DATA error.
{
"_welcome": "220 data error\n",
"EHLO me": "250 ehlo ok\n",
"EHLO hello": "250 ehlo ok\n",
"MAIL FROM:<me@me>": "250 mail ok\n",
"RCPT TO:<to@to>": "250 rcpt ok\n",
"DATA": "554 data error\n",
@@ -164,7 +164,7 @@ func TestSMTPErrors(t *testing.T) {
// DATA response error.
{
"_welcome": "220 data response error\n",
"EHLO me": "250 ehlo ok\n",
"EHLO hello": "250 ehlo ok\n",
"MAIL FROM:<me@me>": "250 mail ok\n",
"RCPT TO:<to@to>": "250 rcpt ok\n",
"DATA": "354 send data\n",