Skip to content

Conversation

@dejanstrbac
Copy link

Adding support for XCLIENT extension useful for proxying

https://www.postfix.org/XCLIENT_README.html

@endreszabo
Copy link

As a side note, I use the industry-standard haproxy's Proxy Protocol to preserve the client's IP (and more) with go-smtp.
Implementing support for the Proxy Protocol needs no change to go-smtp codebase and is very easy to roll out:

proxyListener := &proxyproto.Listener{
        Listener:   l,
}
defer proxyListener.Close()

if err := s.Serve(proxyListener); err != nil {
        log.Fatal(err)
}

@dejanstrbac
Copy link
Author

As a side note, I use the industry-standard haproxy's Proxy Protocol to preserve the client's IP (and more) with go-smtp. Implementing support for the Proxy Protocol needs no change to go-smtp codebase and is very easy to roll out:

proxyListener := &proxyproto.Listener{
        Listener:   l,
}
defer proxyListener.Close()

if err := s.Serve(proxyListener); err != nil {
        log.Fatal(err)
}

I am aware of PROXY protocol, but Dovecot Proxy for LMTP delivery relies on XCLIENT extension which is our use case

@endreszabo
Copy link

but Dovecot Proxy for LMTP delivery

aah I see. I also use dovecot and was not aware of the existence of its LMPT server for delivery. Thus, I made a daemon that listens for gRPC calls from go-smtp and delivers the mails via the dovelot-lda. Not sure which one is better at this point :)

What would you say, what are the benefits for XCLIENT support with LMTP? Logging the original IP address?

@MarkNLD
Copy link

MarkNLD commented Sep 30, 2025

Watching this! Thanks for the work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants