Over the past years, ISPs started to require email client to authenticate before sending a mail through their mail server. This was an attempt to prevent spamming.
For that time on, no more default configuration of sendmail ! (which actually is much better ;-). Alhtough the configuration is not difficult, it took me sometimes to go through the voluminous mail documentation. Eventually I find out what to do to enable authentification and to remap my local sender email address (root@localhost.localdomain) to a more friendly address (jerome.boismartel@gmail.com).
When I installed my new server using Fedora Core 4, I had once again to figure out what to install and how to configure it. This is the steps I followed :
<b><u>1 ) Finding out what is currently on the system</u></b>
[root@localhost log]# rpm -qa | grep sasl
gnu-crypto-sasl-jdk1.4-2.0.1-1jpp_5fc
cyrus-sasl-devel-2.1.20-5
cyrus-sasl-md5-2.1.20-5
cyrus-sasl-plain-2.1.20-5
cyrus-sasl-2.1.20-5
Cyrus-sasl is the library that takes care of the authentification. As I discovered, it seems to be installed by default on the system (at least with my package selection).
I decided to use postfix as a replacement for sendmail. This is a much better mail system and it's easier to configure. You can find more about postfix <a href="http://www.postfix.org">here</a>.
<b><u>2 ) Installing missing components </u></b>
I could not find a postfix package on my system. So I called up the handy yum ! :
yum install postfix
<b><u>3 ) Configuration </u></b>
I edited the file /etc/postfix/main.cf to add the following lines :
smtp_sasl_auth_enable = yes
smtp_sasl_security_options = noanonymous
smtp_sasl_password_maps=static:<your account>:<your password>
smtp_use_tls = yes
smtp_generic_maps = hash:/etc/postfix/generic
This basically tells your system that your ISP requires authentification. On the third line, you specify your account name and your password.
The last line is not about athentification but it is about address remapping. As I said at the beginning of this text, I wanted my address to appear as if my email was sent from my main mail account : jerome.boismartel@gmail.com and not from root@localhost.localdomain.
To enable address remapping you need to add the last line. Then you add your mapping to /etc/postfix/generic. It is a simple text file that says : "If local address is root@localhost.localdomain, remap it to jerome.boismartel@gmail.com". Here is the file :
#cat /etc/postifx/generic
root@whatever jerome.boismartel@gmail.com
Now that you added your entry, you need to create a DB from that file. The postfix program will search the DB and not the text file. Issue the command :
postmap /etc/postfix/generic
Now you probably want to stop sendmail which is most probably running :
/etc/init.d/sendmail stop
It would be a good idea at that point to rename this startup script preventing it to start at the next reboot :
mv /etc/init.d/sendmail /etc/init.d/sendmail.old
You can now start your postfix mail :
/etc/init.d/postfix start
And send you first email to the world !
echo "SUBJECT:test" | sendmail <email>
This server was built using the latest release of Fedora Core 4. My previous server was running an old version of Redhat (7.2) and<u></u>
No comments:
Post a Comment