Exim sending messages with ip assigned to other users

shadow79

Verified User
Joined
May 18, 2010
Messages
5
Hi,

i have my first license of DirectAdmin and i have problem with exim.
Server is running on CentOS 5.3 x64 and there are one eth0 interface with 3 added ip aliases: eth0:0 - eth0:2
I have main eth0 ip for admin domain and 3 ip - one reseller with 2 users, every has one domain with dedicated dns configuration.
Everything works fine but when i'm sending message from any of this domain ehlo connection is always from ip assigned for domain with higher number at the end of the in ip address and there is en error with spf check for sender.

I suppose that this is something with exim.conf connected with domain resolving but it is not changed after instalation, maybe you can help me with this confusing situation.

All domains and users are configured correct, ip addresses are assigned, not sharing with server ip.
exim conf version is: SpamBlocker.exim.conf.2.1.1-release 05-Jun-2007


Thanks for any help
Piotr
 
Last edited:
Unless you've changed your exim.conf file, it defaults to send all email on the main server IP#; this is what most of us want to use, because most of us use rDNS for that IP# to the hostname.

To change the IP#, find the lines:
Code:
remote_smtp:
driver = smtp
and add the line:
Code:
interface = 22.22.22.22
immediately below, each time it appears, of course replacing 22.22.22.22 with the IP# on your server which you want to use.

If you want to enable mail sending on specific IP#s, based on domains, search these forums; it's been discussed.

By default DirectAdmin will write the main IP# into each spf record; you can change the template (be sure to move it to the custom directory first) if you want to use a different IP#.

Jeff
 
You can customize exim.conf to send and receive from the correct user IP, using the user's own SSL cert and protecting his reputation or protecting your server (depending on who he is ;)).
 
Unless you've changed your exim.conf file, it defaults to send all email on the main server IP#; this is what most of us want to use, because most of us use rDNS for that IP# to the hostname.

To change the IP#, find the lines:
Code:
remote_smtp:
driver = smtp
and add the line:
Code:
interface = 22.22.22.22
immediately below, each time it appears, of course replacing 22.22.22.22 with the IP# on your server which you want to use.

If you want to enable mail sending on specific IP#s, based on domains, search these forums; it's been discussed.

By default DirectAdmin will write the main IP# into each spf record; you can change the template (be sure to move it to the custom directory first) if you want to use a different IP#.

Jeff

Thanks for your advices, I have put this lines into exim.conf and it works now:

local_interfaces = a.a.a.a : b.b.b.b : c.c.c.c : d.d.d.d
smtp_active_hostname = ${lookup{$interface_address}lsearch{/etc/virtual/smtp_active_hostnames}{$value}}
smtp_banner = "$smtp_active_hostname ESMTP $tod_full"

create new file smtp_active_hostname with ip: hostname compare for every domain and ip address

remote_smtp:
driver = smtp
interface = "${lookup{$sender_address_domain}lsearch{/etc/virtual/domainips}{$value}}"
helo_data = "mail.$sender_address_domain"

and create file domainips with domain: ip address compare for every domain and ip address

Best Regards
Piter
 
Last edited:
Does anyone have a script for this or can it be built into DA as a feature? In my situation I have both a /29 and a /27 IP block and I have a couple of my bigger customers barking at me about emails going to Yahoo or GMail not making it through.

Thanks for your advices, I have put this lines into exim.conf and it works now:

local_interfaces = a.a.a.a : b.b.b.b : c.c.c.c : d.d.d.d
smtp_active_hostname = ${lookup{$interface_address}lsearch{/etc/virtual/smtp_active_hostnames}{$value}}
smtp_banner = "$smtp_active_hostname ESMTP $tod_full"

create new file smtp_active_hostname with ip: hostname compare for every domain and ip address

remote_smtp:
driver = smtp
interface = "${lookup{$sender_address_domain}lsearch{/etc/virtual/domainips}{$value}}"
helo_data = "mail.$sender_address_domain"

and create file domainips with domain: ip address compare for every domain and ip address

Best Regards
Piter
 
I can't see why you would need a script to make a change to exim.conf and to create a file once. Since SpamBlocker Version 4 is now finished, I'm not going to make any changes to the exim.conf file, and most of us don't need it.

Are you telling us that Yahoo and GMail aren't accepting mail from your server if your domain is on a different IP#? Mail should be going out from your server IP# and I know of no domain that won't accept email because the mail server uses a different IP#.

For example, nobaloney.net is on it's own IP#, yet all it's email goes out from the server IP#.

The fact that you have different IP# blocks shouldn't make a difference because the mail should be going out from your main IP#.

In fact the fix discussed by shadow79 won't make a difference if the problem has anything to do with your /29 and /27.

Check your logs to see if Gmail and Yahoo are accepting the email. If not, find out why. If yes, find out why they're accepting the email and then not delivering it. Until you know, there's very little you can do to resolve the problem.

Jeff
 
Maybe the mails are getting through, but they're being dumped and marked as Junk? Many people, including me, see this problem so many times even though theres a SPF record added.
 
Subdomain

Hello,

Do you think that is this work for subdomains like:

abc.com: 11.22.33.44
sub.abc.com: 55.66.77.88

in domainips file.

Thanks
Mesut TUNGA
 
A few questions for clarity

Jeff - you mention,

If you want to enable mail sending on specific IP#s, based on domains, search these forums; it's been discussed.
Can you provide a link to this thread? I can not find any other threads on this subject other than this one. - thank you.

Regarding the Instructions by Shadow79:

I have added the lines to the exim.conf as instructed.

However, I don't completely understand the following instruction:

create new file smtp_active_hostname with ip: hostname compare for every domain and ip address
I created a file called "smtp_active_hostname" with the following code:

remote_smtp:
driver = smtp
interface = "${lookup{$sender_address_domain}lsearch{/etc/virtual/domainips}{$value}}"
helo_data = "mail.$sender_address_domain"


I created the file in the following directory, /etc/virtual/

  • Was I suppose to replace any of the above information with my own IPs or hostnames?

  • Does ownership of the new files matter? Must they be owned by "mail" to work properly?

  • Where do I add the "ip: hostname" for "...every domain and ip address?"

I have created the file "domainips" as instructed but EXIM does not restart.

I'm doing something wrong but can't figure out what.

Thank you for your help,

Eric Bergez
Broadband Comedy Network, Inc.
http://www.bcnonline.com
 
I was working from memory; probably referring to previous posts in this thread.

Read man exim to learn how to test your configuration file; you should then see the error that's keeping exim from restarting.

Jeff
 
Floyd -

Thank you for the link.

I made the changes as you recommended in #58 to the exmi.conf file and created the new "Interfaces" file in the /etc/virtual/ directory adding each URL and corresponding IP address.

EXIM started correctly but this did not appear to fix the domain ehlo connection problem.

According the my client, when they send an email from their website the ehlo is still using my servers default hostname rather than their websites hostname.

This was suppose to fix this, correct?

Thank you,

Eric Bergez
BCN, Inc.
http://www.bcnonline.com
 
All that will do is use the outgoing IP#. It won't change the HELO from the default.

The helo command uses the hostname; I don't think it can be reset at will, but I'm not sure; do some research in exim documentation at http://www.exim.org/.

Find some information in Edit#1 in my newest exim.conf file, here.

Jeff
 
Granted this is just my opinion but if your users want that level of control they should be on a VPS. I do not think any hosting company is going to give them that level of control in a shared environment. However you may already be charging them enough to make it worth it to you.
 
The code in the Jaguar forum looks very straightforward and doable. Of coursse you'd have to refer to files you create and maintain outside of DirectAdmin.

This is my concern for outgoing email:

You can only do this if you've got a separate IP# for each outgoing domain you're going to set up, because otherwise many recipient MTAs will notice a mismatch in IP#s/domain names, and will not accept the email.

So you've got send on an IP# that matches the hostname on which you're sending, and the match must be in both directions, both DNS and rDNS.

And both DNS and rDNS must match.

I still don't see any reason to do this, and I'm saving IP#s by not giving them out to every domain (as I hope you're doing), so I simply send mail from my hostname, and accept mail from my hostname. The term hostname as used in exim even suggests this. I've never had a client ask to be able to send email from his own hostname, and if I did, I'd ask why.

But of course your needs may differ. I'm not going to take the time to add this as a community gift; it's just not something I need myself and after all the time I've spent on exim.conf over the past few years there are a few other projects I need to work on.

Perhaps you'd be willing to figure it out, release your work under the GPL, version 2, as mine is, and then bring it to my attention. Then I might be willing to take the time to merge it with mine, or of course you could merge your work into mine, release it under the same license, and maintain it yourself.

Alternatively you could hire us to do the work (it would still need to be released under GPL, as the original is), and I could have one of our staff develop it for you.

There's nothing wrong with sponsoring an open-source project :).

Jeff
 
Hi Jeff -

Thank you for the reply.

Well,...I'm just a dude that owns a server which host a few websites. I'm not much of a programmer nor claim to be a wiz at webmastering :eek:

Some of the websites have their own IP's and others do not. The client/friend in question happens to have their own IP so this is not the problem.

The emails in question are automatically generated by their website upon a successful transaction or automated response. Since they are using the server to send the email, the hostname I gave the system when installing DirectAdmin is being displayed rather then her own URL.

Mailed-by: my.hostname.com

She would like it to read: www.herhostname.com

Soooo, it sounds like I'm S.O.L. :( That's OK. I was hopeful we could accomodate her needs. Maybe her programmers can find an alternative solution.

Kind Regards,

Eric Bergez
The Broadband Comedy Network, Inc.
http://www.bcnonline.com
 
Mailed-by: my.hostname.com

Where do you see this? I have never seen this as part of a valid header.

How many people view the headers of email anyway? The only time I look at headers is when diagnosing a email problem.

Are you thinking of perhaps the From address that shows up when email is sent? Where exactly do you see your hostname? What you stated is not part of any exim header I have ever seen.

Please show us the entire headers and maybe we can answer your question.
 
Very usefull post for me, I find it today.

I do this :
Code:
remote_smtp:
driver = smtp
interface = ${lookup{$sender_address_domain}lsearch{/etc/virtual/interfaces} {$value}{SHARED.IP.FROM.SERVER}}
helo_data = "mail.$sender_address_domain"
#{SHARED.IP.FROM.SERVER} for domains not list in /etc/virtual/interfaces

In /etc/virtual/interfaces, I put :
Code:
domain1.com: xxx.xxx.xxx.xxx
domain2.com: yyy.yyy.yyy.yyy

For IP, that's ok, now the domain with dedicated IP have their own IP when sending from smtp.

But HELO is not changed.

It adds a new header received in the mail, but nothing change.

I have always HELO=localhost.

Is it something else to change ?
Best regards
 
Back
Top