ipv6 problem

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

ipv6 problem

jvangent
Hi,
 
When trying to connect using IPV6 to exim I get:
 
2014-02-23 23:21:05 H=[2001:111:111:1::6] temporarily rejected connection in "connect" ACL: PGSQL: query failed: ERROR:  unterminated quoted string at or near "'2001"
 
(ipv6 address isn’t the real one, I edited it).
 
 
 
 

_______________________________________________
http://pledgie.com/campaigns/12056
Reply | Threaded
Open this post in threaded view
|

Re: ipv6 problem

jvangent
This post has NOT been accepted by the mailing list yet.
This post was updated on .
the problem in a nutshell:

hostlist whitelisted_hosts = WHITELISTED_HOSTS
hostlist blacklisted_hosts = BLACKLISTED_HOSTS
hostlist relay_sql_hosts = RELAY_SQL_HOSTS


accept  message       = Authorized sender: $sender_host_address
          hosts         = +whitelisted_hosts

and similar acl entries for blacklisted and relay hosts.

the lookup in macros.conf:

WHITELISTED_HOSTS = pgsql;SELECT from_address FROM lists WHERE to_address='any' AND list_type=1 AND from_address='${quote_pgsql:$sender_host_address}';


the last bit ${quote_pgsql:$sender_host_address}'  is where the problem lies, as this works correctly for ipv4 addresses as they use a . as separator, IPv6 uses : which is also a list separator. Leading to the error.

For now I have added  condition     = ${if isip4{$sender_host_address}{yes}}
 which leads to blacklisting/whitelisting per host only being performed on ipv4 addresses, meaning ipv6 host can connect and send mail, but no ability to block or whitelist them on ipv6 host address. (at least not using the database).

Actually exim offers a way to change the list separator in a list, which is what I'm using now in the config file:

hostlist ip6_blacklist = <; 2001:123:123:1::1 ; 2001:123:123:1::2

where the <; signifies to change the list separator to ; instead of :

this way this hostlist will work in acl's on ipv6 address.

Now all I need to figure out is how to pass $sender_host_address to pgsql with the same trick, but so far I haven't found it yet, hoping someone with more exim experience could help me.


Reply | Threaded
Open this post in threaded view
|

Re: ipv6 problem

jvangent
This post has NOT been accepted by the mailing list yet.
Thanks to a very helpful chap down at the exim user list, to make this work for both ipv4+ ipv6 addresses:

WHITELISTED_HOSTS = pgsql;SELECT from_address FROM lists WHERE to_address='any' AND list_type=1 AND from_address='${quote_pgsql:$sender_host_address}';


becomes:

WHITELISTED_HOSTS =<\n pgsql;SELECT from_address FROM lists WHERE to_address='any' AND list_type=1 AND from_address='${quote_pgsql:$sender_host_address}';

The same applies to

BLACKLISTED_HOSTS and RELAY_SQL_HOSTS all in macros.conf.