Harden contract validation, STARTTLS edge cases, and rule output
This commit is contained in:
parent
a925e4f162
commit
fa212f0fae
9 changed files with 104 additions and 39 deletions
|
|
@ -7,6 +7,11 @@ import (
|
|||
"strings"
|
||||
)
|
||||
|
||||
// EHLOHostname is the hostname sent in the SMTP EHLO command during STARTTLS
|
||||
// negotiation. Override it at startup (e.g. via -ldflags or programmatically)
|
||||
// to match the identity of the host running the checker.
|
||||
var EHLOHostname = "checker.localhost"
|
||||
|
||||
func init() {
|
||||
registerStartTLS("smtp", starttlsSMTP)
|
||||
registerStartTLS("submission", starttlsSMTP)
|
||||
|
|
@ -20,7 +25,7 @@ func starttlsSMTP(conn net.Conn, sni string) error {
|
|||
return fmt.Errorf("read greeting: %w", err)
|
||||
}
|
||||
|
||||
if _, err := rw.WriteString("EHLO checker.happydomain.org\r\n"); err != nil {
|
||||
if _, err := fmt.Fprintf(rw, "EHLO %s\r\n", EHLOHostname); err != nil {
|
||||
return fmt.Errorf("write ehlo: %w", err)
|
||||
}
|
||||
if err := rw.Flush(); err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue