Sunteți pe pagina 1din 3

Configuring a smarthost for sendmail

To configure a smarthost (with authentication) for sendmail, you'll have to create a file called /etc/mail/auth/client-info and modify the file /etc/mail/sendmail.mc.

Configure authentication
Let's start with creating the file /etc/mail/auth/client-info. The content in of this file represents your login credentials for the smarthost. It should look like the example below:
AuthInfo:<smarthost> "U:<username>" "I:<account>" "P:<password>"

Where: <smarthost> is the fully qualified domain name (fqdn) of your smarthost <username> is the userid used to login at the smarthost (often your email address) <account> is the account to be used for your smarthost (often your email address as well) <password> is the password that belongs to your smarthost username

Next, you'll have to build the password hash database with this command:
sudo bash -c "cd /etc/mail/auth/ && makemap hash client-info < client-info"

Configure sendmail
Now you have prepared the authentication setup for the concerning smarthost, let's go on and configure sendmail to use this smarthost. To do so, please edit the file /etc/mail/sendmail.mc. Find the line starting with MAILER_DEFINITIONS in this file and insert the lines before this line:
define(`SMART_HOST', <smarthost>)dnl define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl FEATURE(`authinfo', `hash /etc/mail/auth/client-info')dnl

Where: <smarthost> is the fully qualified domain name (fqdn) of your smarthost Now use the M4 macro processor to translate the /etc/mail/sendmail.mc file into a format sendmail understands (/etc/mail/sendmail.cf). This can be taken out by:
sudo bash -c "cd /etc/mail/ && m4 sendmail.mc > sendmail.cf"

Note: What to do if no authentication needed? In case no authentication is needed or necessary in your smarthost setup. This how-to can be used as

well. In that case, just simply skip the paragraph Configure authentication and only add the line define(`SMART_HOST', <smarthost>)dnl to the /etc/mail/sendmail.mc file. All the rest of the how-to applies as well.

Configure local recipients


To prevent sendmail from sending messages for local recipients through the smarthost, you'll have to tell sendmail which domains are locally processed. This can be done by inserting all local domains in the file /etc/mail/local-host-names, like in the example below:
localhost mylocaldomain.com myotherlocaldomain.com

Of course, the domains mylocaldomain.com and myotherlocaldomain.com need to be replaced by your actual local domains. Now, again this file /etc/mail/local-host-names needs to be translated into a format sendmail understands. Us the make command to do so, like shown below:
sudo bash -c "cd /etc/mail && make"

Restart sendmail and check the configuration


To make sure your configuration is all right, restart sendmail and run the Scalix command omsendin and have a look into the mail log file afterwards. To restart sendmail, use this command:
sudo /etc/init.d/sendmail restart

To make Scalix accept the changes, you should run the omsendin command. If you would do nothing, this command will result in this error: /opt/scalix/bin/omsendin: line 22: omcheckgc: command not found. To prevent this, edit the file /opt/scalix/bin/omsendin. Please replace:
OMCURRENT=`omcheckgc -l | head -1`

on line 22 by:
OMCURRENT=`/opt/scalix/bin/omcheckgc -l | head -1`

Afterwards the omsendin script works great. So now run the command:
sudo /opt/scalix/bin/omsendin

Next, check the configuration, by looking into the log file /var/log/mail.log. You can check it by using:
tail -400 /var/log/mail.log

If there's something wrong, have a look at the exact error message and fix the problem. If everything is all right, then you're done: congratulations!

S-ar putea să vă placă și