flashmob / go-guerrilla

Mini SMTP server written in golang
MIT License
2.77k stars 365 forks source link

The “header” processor populates “Received:” headers wrongly. #198

Closed issuefiler closed 4 years ago

issuefiler commented 4 years ago

RFC 5321

   From-domain    = "FROM" FWS Extended-Domain

   By-domain      = CFWS "BY" FWS Extended-Domain

   Extended-Domain  = Domain /
                    ( Domain FWS "(" TCP-info ")" ) /
                    ( address-literal FWS "(" TCP-info ")" )

   TCP-info       = address-literal / ( Domain FWS address-literal )
                  ; Information derived by server from TCP connection
                  ; not client EHLO.

https://github.com/flashmob/go-guerrilla/blob/51f7dda326b1e9878e5f679ccb34a134127951b0/backends/p_header.go#L59

A Domain in a TCP-info should not be from the HELO command. Would better omit it as go-guerrilla doesn’t do rDNS lookup.

And replacing from with FROM would better comply with the RFC. (Unsure if case-insensitive.)


https://github.com/flashmob/go-guerrilla/blob/51f7dda326b1e9878e5f679ccb34a134127951b0/backends/p_header.go#L61

I can’t say it is wrong for this one, just want to know your opinion on changing with SMTP to WITH ESMTPS, as go-guerrilla supports both EHLO and STARTTLS (which might be a poor reason to back it).

flashmob commented 4 years ago

Hi, thanks for the bug reports - they're excellently written! Sorry, no time to respond them yet, will soon.

flashmob commented 4 years ago

Thanks.

TODO

As for, FROM - in the wild, eg. Postfix, Gmail always leave it all lowercase.

flashmob commented 4 years ago

Implemented in #202