1
0
mirror of https://blitiri.com.ar/repos/chasquid synced 2025-12-17 14:37:02 +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

View File

@@ -1,4 +1,4 @@
.\" Automatically generated by Pod::Man 4.11 (Pod::Simple 3.35)
.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43)
.\"
.\" Standard preamble:
.\" ========================================================================
@@ -133,7 +133,7 @@
.\" ========================================================================
.\"
.IX Title "smtp-check 1"
.TH smtp-check 1 "2018-04-02" "" ""
.TH smtp-check 1 "2023-07-16" "" ""
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -142,7 +142,7 @@
smtp\-check \- SMTP setup checker
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
\&\fBsmtp-check\fR [\-port \fIport\fR] [\-skip_tls_check] \fIdomain\fR
\&\fBsmtp-check\fR [\-port \fIport\fR] [\-localname \fIdomain\fR] [\-skip_tls_check] \fIdomain\fR
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
smtp-check is a command-line too for checking \s-1SMTP\s0 setups (\s-1DNS\s0 records, \s-1TLS\s0
@@ -152,6 +152,9 @@ certificates, \s-1SPF,\s0 etc.).
.IP "\fB\-port\fR \fIport\fR:" 8
.IX Item "-port port:"
Port to use for connecting to the \s-1MX\s0 servers.
.IP "\fB\-localname\fR \fIdomain\fR:" 8
.IX Item "-localname domain:"
Local name to use for the \s-1EHLO\s0 command.
.IP "\fB\-skip_tls_check\fR:" 8
.IX Item "-skip_tls_check:"
Skip \s-1TLS\s0 check (useful if connections are blocked).

View File

@@ -4,7 +4,7 @@ smtp-check - SMTP setup checker
=head1 SYNOPSIS
B<smtp-check> [-port I<port>] [-skip_tls_check] I<domain>
B<smtp-check> [-port I<port>] [-localname I<domain>] [-skip_tls_check] I<domain>
=head1 DESCRIPTION
@@ -19,6 +19,10 @@ certificates, SPF, etc.).
Port to use for connecting to the MX servers.
=item B<-localname> I<domain>:
Local name to use for the EHLO command.
=item B<-skip_tls_check>:
Skip TLS check (useful if connections are blocked).