dimanche 14 décembre 2008

Outgoing emails : how to fake your MTA's idea of the host name?

When your MTA (mail transfer agent, in my case Postfix) is forwarding e-mails to the outside world, you'd better make it aware of your true host name (as seen from the Internet). In my case, like many personal Internet users I don't have my own servers and registered domain name. So I need to make Postfix believe that it's running on an Internet host and it better be the right one. My ISP assigns me a temporary IP address when my router connects. I want to discover the fully qualified domain name (FQDN) for this IP address then assign this host/domain name to the Postfix instances running inside my home network.

How do I know what my real Internet address is ?
Theres at least two ways to do this : from the inside (by looking at your software or router configuration or log files). This is usually the hardest way to get at the information (depending on how much your home network setup is complex). On the other hand, some sites like http://www.ip-adress.com/ will happily display the IP address that it sees connecting to itself. So all you have to do is fire up Firefox and look at that site. Heres an example:



How to resolve the IP address to a host name ?

$ dig -x 85.134.14.152 | grep PTR
;152.14.134.85.in-addr.arpa. IN PTR
152.14.134.85.in-addr.arpa. 28800 IN PTR 55860e98.adsl.multi.fi.


Where to put this host name ?

sudo vi /etc/postfix/main.cf
myhostname = 55860e98.adsl.multi.fi.

How to activate this change?

$ sudo /etc/init.d/postfix restart
* Stopping Postfix Mail Transport Agent postfix [ OK ]
* Starting Postfix Mail Transport Agent postfix Dec 15 01:33:05 kid postfix/master[4792]: terminating on signal 15
[ OK ]
luc@kid:~/tmp$ Dec 15 01:33:06 kid postfix/master[9762]: daemon started -- version 2.5.1, configuration /etc/postfix

Aucun commentaire: