1
0
mirror of https://blitiri.com.ar/repos/chasquid synced 2026-01-05 17:37:03 +00:00

smtp-check: Add flag to specify local name

Some MTAs reject client connections unless the local name (used in the
HELO/EHLO command) looks like an FQDN. Currently, smtp-check always uses
`localhost`, which does not look like an FQDN.

This patch adds a command line flag to smtp-check to specify the
local name to be used.

Fixes https://github.com/albertito/chasquid/issues/37.

Amended-by: Alberto Bertogli <albertito@blitiri.com.ar>
  Minor edits to the commit message, adjust flag name, go fmt.
This commit is contained in:
znerol
2023-07-14 19:01:19 +02:00
committed by Alberto Bertogli
parent 9e8452520a
commit ad0dbb9cda
3 changed files with 17 additions and 4 deletions

View File

@@ -25,6 +25,8 @@ import (
var (
port = flag.String("port", "smtp",
"port to use for connecting to the MX servers")
localName = flag.String("localname", "localhost",
"specify the local name for the EHLO command")
skipTLSCheck = flag.Bool("skip_tls_check", false,
"skip TLS check (useful if connections are blocked)")
)
@@ -91,6 +93,10 @@ func main() {
if err != nil {
log.Fatal(err)
}
err = c.Hello(*localName)
if err != nil {
log.Fatal(err)
}
config := &tls.Config{
// Expect the server to have a certificate valid for the MX