3

Suppose that I have some instance running in Amazon EC2:

 somehost.example.com

This instance hosts some number of applications or websites for other domains:

 www.example.com
 web.example.org
 etc.

This host is configured to use exim4 to interface with Amazon SES for sending mail. In Amazon SES, each domain is separately allowed as a valid sender:

www.example.com
web.example.org
etc.

However, as one would expect, the FQDN of the instance and the executing user are being used as the sender of each email, so all emails appear to originate from:

[email protected]

I can certainly configure Amazon SES to allow mails from somehost.example.com, and I can further add a 'From: "Whoever" <[email protected]>' envelope to the emails at the application level.

What I am wondering is, (a) is this an acceptable solution, and if not, (b) what configuration might I explore to show that mail for each domain (e.g. example.com) appears to originate directly from a "something.example.com" server rather than the actual host. I assume this involves creating a hostname.example.com DNS entry and pointing it to the server, but beyond that I am lost in how to set up exim or the application to allow this.

2 Answers 2

3

You can configure exim to hide the local mail name in outgoing mail. In addition you should configure your main exim server to use a smarthost, in this case the amazon SES thing.

Let's assume each site runs on its own virtual server, www.example.com (192.0.2.1) and web.example.com (192.0.2.2) and your email server is on yet another virtual server, smtp.example.com (192.0.2.10).

To reconfigure exim4 you can run:

dpkg-reconfigure exim4-config

On the main email server smtp.example.com configure it as follows (I only listed the relevant ones):

  • General type of mail configuration: mail sent by smarthost; received via SMTP or fetchmail

  • System mail name: smtp.example.com

  • Machines to relay mail for: 192.0.2.1;192.0.2.2

  • IP address or host name of the outgoing smarthost: THE_AMAZON_SES_IP

  • Hide local mail name in outgoing mail? Yes

  • Visible domain name for local users: example.com

On the other servers configure exim like this, using www.example.com as example host:

  • General type of mail configuration: mail sent by smarthost; no local mail

  • System mail name: www.example.com

  • Other destinations for which mail is accepted: LEAVE_EMPTY <-- this will cause "The option to hide the local mail name in outgoing mail was enabled"

  • Visible domain name for local users: www.example.com

  • IP address or host name of the outgoing smarthost: 192.0.2.10

In case you do only have one server, then just ignore the second step. Your main server should send out emails hiding the local server name and send them out as coming from example.com.

1

Are you trying to hide the fact that the email originated from an EC2 instance? The short answer is, you can't. The Received: headers will contain a reasonably complete trace of the email's path through the network. Fortunately for you, almost nobody ever looks at them.

If you just want recipients to see something reasonable for the From: header, then just put something reasonable in the From: header when you send the email.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .