Exim sending messages with ip assigned to other users

Artis

Verified User
Joined
Jun 24, 2012
Messages
37
Location
Zagreb - Croatia
@chatwizrd

I have 2 IP address on my server. One IP address is shared and one is for my reseller.

Question is:
When I add new user to server he is not able to send emails. But when I edit helo_data and domainips file and manually add domain to that files he is (new user) able to send emails.

Do you understand what is my problem ?
 

nobaloney

NoBaloney Internet Svcs - In Memoriam †
Joined
Jun 16, 2003
Messages
26,119
Location
California
@Artis, you've managed to confuse at least some of us. I'm the guy who wrote the exim.conf files, and you've gotten me very confused.

I'll strongly suggest going back to the original exim.conf file and then make changes from scratch to address the issue of one specific user using his own address and the others using the default address.

Jeff
 

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
14,255
Location
GMT +7.00
every time when i add new user, I must manually add his domain in domainips file ? How I can manage my users to send email from shared IP of server, and only specific user from specific IP. How I understand this solution is working but the problems is in manually edit helo_data and domainips files.

So I edited my configuration and make all my domains to address 111.222.333.444 and only one specific user to his address 555.666.777.888 and now after adding new user to my server hi is not able to send email if I do not add him to domainips and helo_data files.

Is there any solution for this ?


Best regards
You must be looking for something like this: http://www.directadmin.com/forum/showthread.php?t=36468&p=230789#post230789

In my example available by the link, if you have no domain in /etc/virtual/domainips then the default IP 11.22.33.44 (you should change it with your own) and $primary_hostname (the variable should be left as it is) will be used.
 

Artis

Verified User
Joined
Jun 24, 2012
Messages
37
Location
Zagreb - Croatia
EXIM problems

Hi,

Last night I try to configure exim. First I build fresh configuration of exim and then I edit exim.conf

What is the problem ? I can not force exim to use any external IP address.

When i try to use
Code:
remote_smtp:
   driver = smtp
   interface = 1.2.3.4
If i look in header for IP address i can see:

Code:
Delivered-To: xxxxx.xxxxx@gmail.com
Received: by 10.76.xxx.xxx with SMTP id pu4csp86710oab;
        Tue, 11 Dec 2012 19:03:54 -0800 (PST)
Received: by 10.204.xxx.xx with SMTP id k3mr112xxxxx.117.1355281433832;
        Tue, 11 Dec 2012 19:03:53 -0800 (PST)
Return-Path: <info@xxxxxxxxxxxxxxxx.com>
Received: from server.Xxxxxxxxxxxx.com ([[B]2001:4ba0:cafe:xxxx::xx[/B]])
        by mx.google.com with ESMTPS id fs12si33961141bkc.117.2012.12.11.19.03.53
        (version=TLSv1/SSLv3 cipher=OTHER);
        Tue, 11 Dec 2012 19:03:53 -0800 (PST)
.................
As you can see, I have recive email from IPv6 address (that is my IPv6 address, but it is unused)

My VPS has (3 interfaces look ifconfig output: venet0 (3 IPv6 address), venet0:0 (1 IPv4 address = shared IP), venet0:1 (1 IPv4 address = reseller IP)).

OS is CentOS 6.3, last version of exim 4.80.1 and my problem is still here. I can not force exim to use external IP address, it always use my IPv6 address.

In directadmin.conf IPv6 is set to NO (my clients and server has only IPv4 address in use), default interface in directadmin.conf is venet0:0

ifconfig output
Code:
lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:6817 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6817 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:976975 (954.0 KiB)  TX bytes:976975 (954.0 KiB)

venet0    Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
          inet addr:127.0.0.1  P-t-P:127.0.0.1  Bcast:0.0.0.0  Mask:255.255.255.255
          inet6 addr: 2001:4ba0:cafe:xxx::xxx/128 Scope:Global
          inet6 addr: 2001:4ba0:cafe:xxx::xxx/128 Scope:Global
          inet6 addr: 2001:4ba0:cafe:xxx::xxx/128 Scope:Global
          UP BROADCAST POINTOPOINT RUNNING NOARP  MTU:1500  Metric:1
          RX packets:72592 errors:0 dropped:0 overruns:0 frame:0
          TX packets:102885 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:14988317 (14.2 MiB)  TX bytes:106233219 (101.3 MiB)

venet0:0  Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
          inet addr:80.xxx.xxx.xxx  P-t-P:80.xxx.xxx.xxx  Bcast:80.xxx.xxx.xxx  Mask:255.255.255.255
          UP BROADCAST POINTOPOINT RUNNING NOARP  MTU:1500  Metric:1

venet0:1  Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
          inet addr:217.xxx.xxx.xxx  P-t-P:217.xxx.xxx.xxx  Bcast:217.xxx.xxx.xxx  Mask:255.255.255.255
          UP BROADCAST POINTOPOINT RUNNING NOARP  MTU:1500  Metric:1

any hint for this problem?
 

nobaloney

NoBaloney Internet Svcs - In Memoriam †
Joined
Jun 16, 2003
Messages
26,119
Location
California
Did you restart exim?

If so, then you might want to ask on the exim-users mailing list as the code looks right to me.

Jeff
 

Artis

Verified User
Joined
Jun 24, 2012
Messages
37
Location
Zagreb - Croatia
@Jeff thanks you for advice

The problem was solved, at the top of /etc/exim.conf file i put disable_ipv6 and after that i can force exim to use ip that i want.

Solution that works

at the top of exim.conf
Code:
disable_ipv6
local_interfaces = 127.0.0.1 : aaa.aaa.aaa.aaa : bbb.bbb.bbb.bbb
smtp_active_hostname = ${lookup{$interface_address}lsearch{/etc/virtual/smtp_active_hostnames}{$value}}
smtp_banner = "$smtp_active_hostname ESMTP $tod_full"
edit exim.conf driver section
Code:
remote_smtp:
driver = smtp
interface = "${lookup{$sender_address_domain}lsearch{/etc/virtual/domainips}{$value}{aaa.aaa.aaa.aaa}}"
helo_data = "${lookup{$sending_ip_address}lsearch{/etc/virtual/helo_data}{$value}{$primary_hostname}}"
create file /etc/virtual/smtp_active_hostnames
Code:
aaa.aaa.aaa.aaa: mail.hostname_for_domain_a
bbb.bbb.bbb.bbb: mail.hostname_for_domain_b
/etc/virtual/helo_data
Code:
aaa.aaa.aaa.aaa: mail.domain2.com
bbb.bbb.bbb.bbb: mail.domain3.com
ccc.ccc.ccc.ccc: mail.domain4.com
/etc/virtual/domainips
Code:
domain_a: aaa.aaa.aaa.aaa
domain_b: bbb.bbb.bbb.bbb
This solution is working for me, and I can confirm that hello response is ok whit this solution.
 

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
14,255
Location
GMT +7.00
Last edited:

aliweb

Verified User
Joined
Sep 11, 2013
Messages
6
Hi every body,

I followed the instructions in post #47 and now emails are sent through my user dedicated ip and that's fine.

But now there's a big problem! now directadmin is not receiving any further emails! in fact none of my server email accounts are receiving emails and server is just able to send email.

I don't know why. I just modified the exim.conf file as told above. please help
 

nobaloney

NoBaloney Internet Svcs - In Memoriam †
Joined
Jun 16, 2003
Messages
26,119
Location
California
Exim will only receive mail if mx record for the domain points to an IP# to which exim is bound.

Jeff
 

aliweb

Verified User
Joined
Sep 11, 2013
Messages
6
Exim will only receive mail if mx record for the domain points to an IP# to which exim is bound.

Jeff
would you please explain more? well my mx records for domains are in the form :

domain.com. 14400 IN MX 10 mail

how should this mx record point to a specific IP? or maybe you mean something else
 

aliweb

Verified User
Joined
Sep 11, 2013
Messages
6
You should check "A" record for mail in the particular case.
the A record for mail is fine and points to the right ip.

would you please repeat the post 47 with some sample ips and domains? I know the problem is with this section.

assume I have 3 users with 2 ips which one of them is dedicated:

user1: user1_domain1 , user1_domain2, user1_domain3

user2: user2_domain1

user3: user3_domain1

and 2 IPs which ip1 is the main server ip and also the shared ip between user1 and user2 (and others),
and the ip2 is dedicated to user3

also other users will be added to the server with the shared ip : ip1

would you please provide the exampilified howto according to these sample data?
 

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
14,255
Location
GMT +7.00
The post #47 which you are referring to, has nothing to do with receiving emails. So you should check exim logs for errors.
 

aliweb

Verified User
Joined
Sep 11, 2013
Messages
6
The post #47 which you are referring to, has nothing to do with receiving emails. So you should check exim logs for errors.
well it was working fine and receiving emails with no problem before I modify my exim.conf file as told in that post. so it should be related to the modification.

I also checked all exim log files and didn't found any log related. (after sending emails from yahoo and gmail)
 

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
14,255
Location
GMT +7.00
Post here results for

Code:
netstat -ntpl | grep exim
You probably need to change local_interfaces section to

Code:
local_interfaces = 0.0.0.0
or completely remove it and restart exim.
 

aliweb

Verified User
Joined
Sep 11, 2013
Messages
6
found it!

in the section :

PHP:
local_interfaces = 127.0.0.1 : a.a.a.a : b.b.b.b : c.c.c.c : d.d.d.d
I had not added the main server ip and after adding that, now it works fine and receives emails like a charm!

anyway, thanks for your responses
 

jkirker

Verified User
Joined
Nov 22, 2012
Messages
97
Are there scripts to automate the creation and updating of these files??

/etc/virtual/smtp_active_hostnames
/etc/virtual/helo_data
/etc/virtual/domainips
For this purpose, has anyone written any scripts which cull through the users/dns/whatever to automatically create these files on the fly or after an update to domains?

If yes, please share. If no, I will gladly pay someone here to do this and open it up to the community to use. Please let me know. Keeping this up to date manually could be a challenge and it really should be automated.

Editing the exim.conf is the easy part - the lack up keeping things updated in an automated fashion will drive us crazy. ;)
 
Top