{"id":4,"date":"2005-02-26T12:38:29","date_gmt":"2005-02-26T11:38:29","guid":{"rendered":"http:\/\/blog.blackdown.de\/2005\/03\/08\/exim-4-and-dynamic-ip-addresses\/"},"modified":"2016-10-29T03:51:03","modified_gmt":"2016-10-29T01:51:03","slug":"exim-4-and-dynamic-ip-addresses","status":"publish","type":"post","link":"https:\/\/blackdown.de\/articles\/exim-4-and-dynamic-ip-addresses\/","title":{"rendered":"Exim 4 and Dynamic IP-Addresses"},"content":{"rendered":"
I’ve recently changed my network connection at home to a provider which assigns dynamic addresses. Exim<\/a> always provided a broken HELO\/EHLO name to my smarthost since then because my externally visible hostname changes each time I connect. I’m now using Exim’s Perl interface to lookup the assigned hostname when connecting my smarthost:<\/p>\n I’ve recently changed my network connection at home to a provider which assigns dynamic addresses. Exim always provided a broken HELO\/EHLO name to my smarthost since then because my externally visible hostname changes each time I connect. I’m now using Exim’s Perl interface to lookup the assigned hostname when connecting my smarthost: \/etc\/exim4\/exim.pl: Don’t forget\n
\/etc\/exim4\/exim.pl<\/code>:
\nDon’t forget to change ppp0<\/code> to the interface you want to handle!<\/em><\/p>\n
\r\n#! \/usr\/bin\/perl\r\n\r\n# Requires libio-interface-perl\r\n\r\nuse strict;\r\nuse IO::Socket;\r\nuse IO::Interface;\r\n\r\nsub get_remote_helo_data()\r\n{\r\n my $s = IO::Socket::INET->new(Proto => 'udp');\r\n my $addr = inet_aton($s->if_addr('ppp0'));\r\n my $hostname = gethostbyaddr($addr, AF_INET);\r\n\r\n $hostname = '' if (!$hostname);\r\n\r\n return $hostname;\r\n}\r\n<\/pre>\n<\/li>\n
\/etc\/exim4\/conf.d\/main\/50_exim4-localconfig_perl<\/code>:\n
\r\n#main\/50_exim4-localconfig_perl\r\nperl_at_start = true\r\nperl_startup = do '\/etc\/exim4\/exim.pl'\r\n<\/pre>\n<\/li>\n
remote_smtp_smarthost<\/code>:\n
\r\nhelo_data = \\\r\n ${if >{${strlen:${perl{get_remote_helo_data}}}}{0} \\\r\n {${perl{get_remote_helo_data}}} \\\r\n {$primary_hostname}}\r\n<\/pre>\n<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"
[→ Read the rest of this entry<\/a>]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true},"categories":[6,3,7],"tags":[],"yoast_head":"\n\n\n\n\n\n\n\n\n\n\n\n\n\t\n\t\n\t\n