Configuring Sendmail with smarthost Ubuntu Gutsy

From Scalix Wiki
Jump to: navigation, search

Contents

Important Note

Please note that these manual installation instructions should only be used on Ubuntu distributions, such as Ubuntu Gutsy Gibbon 7.10 server, the distribution the document was written for. If you install Scalix on an unsupported platform, this invalidates your ability to receive Scalix support. Thank you for your understanding and compliance.

This document might be inaccurate and under construction. Do not trust this document.


Configuring Sendmail with smarthost on Ubuntu 7.10 Server (Gutsy Gibbon)

As Ubuntu 7.10 is an unsupported platform there is currently no manual describing the configuration of sendmail (the recommended MTA to be used with Scalix) to be used with a smarthost (smtp relay). As I managed to get Scalix it up and running and I already documented and shared this with the community (here), I thought it would be useful to share my experiences regarding the sendmail configuration as well.

So below you'll find a how-to that describes the configuration of sendmail to be used with Scalix on a Ubuntu 7.10 server.

Sendmail is a remarkably flexible program, supporting many kinds of mail transfer and delivery including the SMTP, which Scalix uses. Sendmail remains the most popular MTA on the Internet. Its popularity is due in part to its position as the standard MTA under most variants of the Unix and Linux operating system. Sendmail can be used with a smarthost to relay SMTP mesages to another host. For example your provider's SMTP server.

A smart host is a type of mail relay server which allows an SMTP server to route e-mail to an intermediate mail server rather than directly to the recipient’s server. Often this smart host requires authentication from the sender to verify that the sender has privileges to have mail forwarded through the smart host. This is an important distinction from an open relay that will forward mail from the sender without authentication.

I used several sources of information on the web. I listed the ones I can remember at the end of the document under Sources.


Applicable Environments

These Installation instructions have been tested with

  • Scalix CE 11.3.0
  • Ubuntu 7.10 Server (Gutsy Gibbon)

They might not apply unmodified to any other version of Scalix or Ubuntu.


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!


Note: Gmail as a SMTP relay

If you would like to use Gmail from Google as a SMTP relay for your Scalix instance have a look at these websites:


Sources


The author

The origin for this document was written by Max Wiertz. As a Scalix newbie, I invested a lot of work in getting Scalix together with sendmail to work for me on Ubuntu. I felt like sharing this with all of you, so you can probably take advantage of it.

If you have any questions, remarks, comments or suggestions regarding this document, do not hesitate to contact me by e-mail: mailto:max_DOT_wiertz_AT_gmail_DOT_com.