Reseller email sent out on main ip

Chrysalis

Verified User
Joined
Aug 25, 2004
Messages
1,321
Location
uk
I got a reseller with his own ip's but his email is going out on my ip meaning in the email headers it has my hostname, he doesnt want this, can directadmin be made to not send out reseller emails on the first ip address?
 
You can do a lot with exim by changes to the exim.conf file.

I'm not sure if what you're asking for is doable or not, but if it is it would require major custom changes to the exim.conf file.

You might want to read documentation at www.exim.org, or join the exim-users mailing list.

Jeff
 
I played with this for awhile, then decided it wasn't worth the headache of getting too deep into it...

Essentially, you need to add an "interface" line to exim's smtp transport.

http://www.exim.org/exim-html-4.50/doc/html/spec_30.html#SECT30.3

So, first you need file that contains a list of domains and the ip address that you want to use for them, let's call it domainips:
Code:
domain1.com: 192.168.1.100
domain2.com: 192.168.1.101
Then, in exim's remote_smtp transport:
Code:
driver = smtp
interface = "${lookup{$sender_address_domain}lsearch{/etc/exim/domainips}{$value}}"
helo_data = "mail.$sender_address_domain"
Then, exim will bind to the specified IP for outgoing mail and further use "mail.domain1.com" for the HELO string when connecting (assming the sender is "[email protected]", e.g.).

That's as far as I got into playing with it... I haven't thought much about the implications of actually implementing this, but you would have to account for the PTR addresses that would have to match the hostname with the IP, TLS certs that should match, risk of misuse by other verified senders, multiple domains sharing the same IP, etc. So, use at your own risk... But do let us know if have any luck.
 
Last edited:
yes I never solved it, the biggest and easiest solution would be to use a generic hostname.
 
Here's another example that I was playing with...
Code:
remote_smtp:
  driver = smtp
  interface = "${lookup{$sender_address_domain}lsearch{/etc/exim/domain-ips}{$value}}"
  helo_data = "${lookup{$sender_address_domain}lsearch{/etc/exim/domain-ips}{mail.$sender_address_domain}{$primary_hostname}}"
This will replace the helo_data with "mail.domain1.com" if you specify that domain1.com has it's own ip address in domainips and use the primary hostname otherwise (which should be the default).

Still majorly untested, lots of issues, caveat emptor, etc.
 
Very interesting ...

Perhaps if I ever finish the rest of the changes to exim.conf, I'll look into this one.

Caveats noted.

Jeff
 
remote_smtp:
driver = smtp
interface = "${lookup{$sender_address_domain}lsearch{/etc/exim/domain-ips}{$value}}"
helo_data = "${lookup{$sender_address_domain}lsearch{/etc/exim/domain-ips}{mail.$sender_address_domain}{$primary_hostname}}"

Anybody had any luck with this?
 
I just discovered this thread while looking for something else, but thought I would add my experiences to it if it will help anyone.

Here are some mods I made to the SpamBlocker.exim.conf.2.0-release (Thank you, Jeff). So far, the mods have worked fine for me. It's been so long ago that I did these that I forget all of the sources I researched.

Anyway, in exim.conf, right before "# Specify your host's canonical name here" I have added:
Code:
  smtp_active_hostname = ${lookup{$interface_address}lsearch{/etc/virtual/smtp_active_hostnames}{$value}}
  smtp_banner = "$smtp_active_hostname server is ready"
To work, it requires the interface mod I'll mention shortly.
The two lines above effectively do several things, but mainly and oversimplified, when the mail server is queried, it returns the appropriate message for the domain in question. I created a separate file in etc/virtual called "smtp_active_hostnames" which is a listing of all the domains on the server and looks like this:
Code:
69.61.61.198: mail.refs.org
69.61.61.196: mail.refereehosting.com 
.....etc
So, for refs.org, the mail greeting message sent states, "220 mail.refs.org server is ready", with no server hostname showing at all.

After those two lines above, I have also added the following:
Code:
received_header_text = "Received: \
    ${if def:sender_rcvhost {from ${sender_rcvhost}\n\t}\
    {${if def:sender_ident {from ${sender_ident} }}\
    ${if def:sender_helo_name {(helo=${sender_helo_name})\n\t}}}}\
    by ${lookup{$sender_address_domain} lsearch{/etc/virtual/interface_names}{$value}} \
    ${if def:received_protocol {with ${received_protocol}}} \
    (Refereemail Version 1.72)\n\t\}"
Ironically, at the end of my conf file under remote_smtp , my interface entry is almost identical to the one mentioned by ballyn :
Code:
interface = "${lookup{$sender_address_domain}lsearch{/etc/virtual/interfaces}{$value}}"
  helo_data = "mail.$sender_address_domain"
That requires another file that is easily created; ballyn uses 'domainips', mine is '/etc/virtual/interfaces' - containing the domain names and the ip addresses.
Code:
refs.org: 69.61.61.198
refereehosting.com: 69.61.61.196
etc.. 
etc...
This works for virtual hosts like a charm, which was already mentioned earlier in the thread.

Lots of other things here, but I'll keep it simple.

The mods I made remove the server hostname from the received headers and replaces it with the name of the domain sending the mail.

Also, by default, exim identifies itself as the MTA, and includes the version number. Not that there is anything wrong with that, but I feel some obscurity is still better than none at all (thus I use 'Refereemail" - you can make up your own name as an MTA.)

I'll give you a real example to let you see the impact. Here are part of two sets of genuine mail headers which will show the difference before adding all the additional lines above and after adding the additional lines. The mail that was sent was generated by a domain that was auto-responding to input from a php form.

BTW, for clarification, the server's primary_hostname is set as sv1.officiatingonline.com.

Here are the "before" headers:
Code:
Received: from [69.61.61.194] (HELO sv1.officiatingonline.com)
  by fe2.cluster1.echolabs.net (CommuniGate Pro SMTP 5.0.11)
  with ESMTPS id 39181571 for [email][email protected][/email]; Sun, 03 Dec 2006 21:42:33 -0500
Received-SPF: neutral
 receiver=fe2.cluster1.echolabs.net; client-ip=69.61.61.194; [email protected]
Received: from apache by sv1.officiatingonline.com with local (Exim 4.63)
	(envelope-from <[email protected]>)
	id 1Gr3n0-0001c6-Hw
	for [email][email protected][/email]; Sun, 03 Dec 2006 21:42:42 -0500
To: [email][email protected][/email]
Subject: Our response
And the "after" headers
(took me about five minutes to repatch Exim, verify that all was well, and then resend myself an email):
Code:
Received: from mail.gspaldingrefs.com ([69.61.61.200] verified)
  by fe2.cluster1.echolabs.net (CommuniGate Pro SMTP 5.0.11)
  with ESMTPS id 39184461 for [email][email protected][/email]; Sun, 03 Dec 2006 21:47:22 -0500
Received-SPF: pass
 receiver=fe2.cluster1.echolabs.net; client-ip=69.61.61.200; [email protected]
Received: from apache by mail.gspaldingrefs.com with local (Refereemail Version 1.72)
	; Sun, 03 Dec 2006 21:47:32 -0500
To: [email][email protected][/email]
Subject: Our response
Take note of the Received-SPF part of the headers.

More documentation from exim on different variables with which to use can be found at: Exim Expansion Variables

Just thought I'd add what I have made work for me. All the mail being sent from the server now shows the domain from which it originated. I've tested it with users sending mail from Outlook and Thunderbird with smtp authentication, and it seems to be working fine. I've a small dedicated server with only a few domains, so YMMV depending upon your situation.

One thing I'm still working on, though, is how to modify the Message-ID; I haven't figured out how to get it to show the sender domain name instead of the server hostname. Any thoughts or clues on that are appreciated.

Mike
 
looks good, are you manually filling smtp_active_hostnames for new domains or you have it automated? also what happens if a domain is missing and mail is sent from that domain?
 
Studying your changes, my guess is that the first mod (domain-name instead of hostname) is only going to work for domains with their own IP#. Is this correct?

Regarding the second change; I don't believe in obfuscating the kind of server you use (exim vs Refereemail, for example); since different servers implement RFCs differently knowing the server used can be important in tracking email problems. I can understand why you might want to do so, but I won't do it myself.

You can't modify Message-ID but if the incoming message already has the header, the mta won't add one. So figure out where to create one before it gets added automatically. You can probably use the time as returned by the date +%N command followed by @ and the domain name. Remember every Message-ID must be unique.

Jeff
 
Will someone remember to add these suggestions to my soon-to-be-created thread on suggestions for the next version of SpamBlocker/MailBlocker?

Jeff
 
are you manually filling smtp_active_hostnames for new domains
Yes, because currently I only have seven on our server, but I sure it could be scripted.
what happens if a domain is missing and mail is sent from that domain?
I tried that already to see what it would do. It defaults back to the server/primary_host name.

And yes, Jeff, as for the stmp banner greeting, the domain has to be assigned to an unshared IP for the domain name to appear in the greeting.

However, for those who have resellers (I do not, so my experience/knowledge is limited here), each reseller should have a static IP, correct? The reseller at least would have all his/her accounts use his mailserver greeting as opposed to the system/server greeting. In theory and practice, this will work, but the practical logistics of making it work in production could be dicey. I'll think about that in more detail later.

Nonetheless, some initial thoughts:

Reseller
1) creates a user on a shared IP of the reseller's, or
2) gives the user his/her own IP.

In 1), it's simple. The mail greeting MUST be that of the reseller's. (I'm presuming that we will already have created a listing for that shared IP of the reseller's in my proposed etc/virtual/smtp_active_hostname and in etc/virtual/interfaces files).

In 2), if the user has only one domain associated with the IP, the user can have a custom greeting for that domain.

Since DA allows only one IP per user, and if the user has more than one domain on an IP, the user would/should be able to select which of his/her domains will appear as 'mail.domain.com' in the custom smtp greeting. That presumes the user wants a custom greeting.

Maybe resellers should have the option to include for free or to charge extra in order to permit a user to have this feature??

Another thought - I haven't looked over the API commands that closely, but I know that the CMD_API_DOMAIN_OWNERS already exists, which dumps the contents of the /etc/virtual/domainowners file.

Considering that for each reseller the DA panel already pulls together the list of IPs, users, and the domains assigned to each IP, I would think it wouldn't all that difficult for DA to come up with a way to implement all of this through the panel itself. That, or create an API for the reseller/admin to be able to do this. Since the exim server does NOT need to be restarted when adding IP's and domains to the files I mentioned, changes should be immediate once the files are modified.

We just need to associate one mailserver per IP (etc/virtual/smtp_active_hostnames listed one per line as 12.34.56.789: mail.domain1.com); and associate all the domains to their interface IP (etc/virtual/interfaces would list all domains on the server)
domain1.com:12.34.56.100
domain2.com:12.34.56.100
domain3.com:12.34.56.102
etc...).

This file might be huge, so I'm not sure what it would do to processing time if exim needs to read a file with 400 domains listed.

Like I said, just some initial thoughts.

And regarding your comments about obfuscation - although my change is serving my purposes, Jeff, I do agree with you - in general practice it is not a good idea, and is not good for a variety of reasons.

Finally, I do know that Message IDs are unique. I just haven't made the time (low priority for me) to dig in more to include the mailserver name in the message Id as opposed to the server's hostname.

Enough for this post. As you can start to see, brevity has never been my knack.
 
whitehat said:
As you can start to see, brevity has never been my knack.
Well, I'll try to be brief :) .
each reseller should have a static IP, correct?
We all have static IP#s; DA servers won't work on dynamic IP#s. But I think you meant dedicated IP.

And to that, the answer is no. Many of us do not give each reseller his/her own IP#.
Since DA allows only one IP per user, and if the user has more than one domain on an IP, the user would/should be able to select which of his/her domains will appear as 'mail.domain.com' in the custom smtp greeting. That presumes the user wants a custom greeting.
And of course all this is where it begins to get complex.
Maybe resellers should have the option to include for free or to charge extra in order to permit a user to have this feature??
And now it gets even more complex. I suppose this could be added to the checkbox list when creating a new user, but that's not trivial.
Considering that for each reseller the DA panel already pulls together the list of IPs, users, and the domains assigned to each IP, I would think it wouldn't all that difficult for DA to come up with a way to implement all of this through the panel itself.
That would require a mandatory rewrite of exim.conf for everyone. Which is actually non-trivial for a lot of us have customized exim.conf files, especially if we use SpamBlocker and have created a destination page for false positives.
This file might be huge, so I'm not sure what it would do to processing time if exim needs to read a file with 400 domains listed.
Exim already does this several times while it receives mail; for example, /etc/virtual/domains, /etc/virtual/use_rbl_domains, and the whitelists and blocklists.

But exim doesn't have to use flat files.
And regarding your comments about obfuscation - although my change is serving my purposes, Jeff, I do agree with you - in general practice it is not a good idea, and is not good for a variety of reasons.
One important issue is that people will attempt to find the server admin if someone is spamming or just has a broken autoresponder causing loops (for example). If that happens I want those attempts to find me, the server admin, and not the site admin, who may not care, especially if he's the spammer.
Finally, I do know that Message IDs are unique. I just haven't made the time (low priority for me) to dig in more to include the mailserver name in the message Id as opposed to the server's hostname.
But if you don't then you're not hiding anything anyway.

Jeff
 
not sure what the 'dedicated IP' issue is:

with two domains, domain1.com and
domain2.com, both on shared IP address 1.2.3.4, put

1.2.3.4: mail.domain1.com:mail.domain2.com

in /etc/virtual/smtp_active_hostnames

and

domain1.com: 1.2.3.4
domain2.com: 1.2.3.4

in /etc/virtual/interfaces

and that should work for both, with
messages received from either mail.domain1.com or mail.domain2.com as appropriate.
 
I have applied this on a new server, but this part causes problems.

Code:
received_header_text = "Received: \      ${if def:sender_rcvhost {from ${sender_rcvhost}\n\t}\      {${if def:sender_ident {from ${sender_ident} }}\      ${if def:sender_helo_name {(helo=${sender_helo_name})\n\t}}}}\      by ${lookup{$sender_address_domain} lsearch{/etc/virtual/interface_names}{$value}} \      ${if def:received_protocol {with ${received_protocol}}} \      (Refereemail Version 1.72)\n\t\}"

error as below in mainlog

2006-12-22 00:25:48 1GxYEO-000CNG-BG Expansion of "Received: ${if def:sender_rcvhost {from ${sender_rcvhost}\n }}{${if def:sender_ident {from ${sender_ident} }}${if def:sender_helo_name {(helo=${sender_helo_name})\n }}}}by ${lookup{$sender_address_domain} lsearch{/etc/virtual/interface_names}{$value}} ${if def:received_protocol {with ${received_protocol}}} (Refereemail Version 1.72)\n }" (received_header_text) failed: failed to open /etc/virtual/interface_names for linear search: No such file or directory

So I changed /etc/virtual/interface_names to /etc/virtual/interfaces and seems to be working fine, I also edited the refereemail to say Exim.

Now emails sent from this server are given a score of -2.0 on spamassassin and are fine in yahoo and gmail but still get sent to junk in hotmail, looking into that still, rdns, helo and spf are all set correctly.
 
Back
Top