FR: |IP| and |IP6| in templates

interfasys

Verified User
Joined
Oct 31, 2003
Messages
1,821
Location
Switzerland
For some templates, we need to detect whether we've been given an IPv6 and we need to place the right IP in the right location.

It seems that right now the templates only recognize |IP|. IT would be great if |IP6| could be introduced.

A concrete example where this is needed is for DNS records.

EDIT
And ditto for |SERVER_IP| and |SERVER_IP6|
 
Last edited:
Hello,

Double check that you're using our dns conf file templates...
eg: dns_a.conf should look like:
Code:
localhost=127.0.0.1
|*if IS_IPV6!="yes"|
|DOMAIN|.=|IP|
mail=|IP|
pop=|IP|
www=|IP|
ftp=|IP|
smtp=|IP|
|*endif|
and dns_aaaa.conf should look like:
Code:
|*if IS_IPV6="yes"|
|DOMAIN|.=|IP|
mail=|IP|
pop=|IP|
www=|IP|
ftp=|IP|
smtp=|IP|
|*endif|
The |IS_IPV6| token should be the yes/no indicator for IPv6 IPs.


As for |SERVER_IP|, our licensing system still requires that IPs be in IPv4, so this doesn't apply.. yet.
For now, the server IP will always be IPv4. If/when we swap our licensing system to allow IPv6, then we'd add an extra flag to let you know it's IPv6.

John
 
Hello John,

This won't work for dns_txt.conf.

We need something like this

Code:
|DOMAIN|.="v=spf1 a mx ip4:|SERVER_IP| ip6:|SERVER_IP6| ~all"

because both IPs must be on one line.

And btw, the aaaa template is still missing the localhost entry ;)

Cheers,

Olivier
 
Last edited:
Hello,

If the main IP of the box is IPv4, will emails ever leave on an IPv6 IP?

If so, what is the determining factor to cause exim to use that IP?
eg: How would DA figure out which IPv6 is the main v6 IP to know what value to set?

I've updated the dns_aaaa.conf to have the line:
Code:
localhost=::1
at the top of the file
Code:
localhost=::1
|*if IS_IPV6="yes"|
|DOMAIN|.=|IP|
mail=|IP|
pop=|IP|
www=|IP|
ftp=|IP|
smtp=|IP|
|*endif|
John
 
Hello John,

If the MX record for a receiving domain indicates a AAAA record, then Exim should connect using the server's or the local user's IPv6 address.

You could then argue that a user's IPv6's address would already be in the SPF record anyway, but it won't work in case the user uses the webmail.

Cheers,

Olivier
 
Hello,

That sounds reasonable. Now we need to figure out the value of the IPv6 IP. For IPv4, DA just uses the licensed IP, as it will be the first IP on the box. We can either have a simple directadmin.conf setting for the main IPv6 IP.. unless there is a reliable way to get it from ifconfig (in the case there are multiple IPv6 IPs, we'd need to know which one exim will be using)

John
 
Hello,

On FreeBSD, the information would be in /etc/rc.conf (ipv6_ifconfig). The first one would be the server's address.
In Exim, it's automatic for the server's main IPs, but you have to modify the config if you want it to use the user's real IP (v4 or v6).

Cheers,

Olivier
 
Back
Top