Difference between revisions of "Configuring Sendmail with smarthost Ubuntu Gutsy"

From Scalix Wiki
Jump to: navigation, search
Line 20: Line 20:
  
 
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'''.
 
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'''.
 +
 +
=== Prepare 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:
 
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:
Line 30: Line 32:
 
* '''<account>''' is the account to be used for your smarthost (often your email address as well)
 
* '''<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
 
* '''<password>''' is the password that belongs to your smarthost username
 +
  
 
Next, you'll have to build the password hash database with this command:
 
Next, you'll have to build the password hash database with this command:
Line 36: Line 39:
  
  
 +
=== 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 below before this line:
 +
 +
<pre>
 +
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
 +
</pre>
 +
 +
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/auth/ && m4 sendmail.mc > sendmail.cf"
 +
 +
=== 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:
 +
 +
<pre>
 +
localhost
 +
mylocaldomain.com
 +
myotherlocaldomain.com
 +
</pre>
 +
 +
Of course, the domains '''mylocaldomain.com''' and '''myotherlocaldomain.com'''
  
 
= Sources =
 
= Sources =

Revision as of 14:47, 29 January 2008

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.

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.

Prepare 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 below 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/auth/ && m4 sendmail.mc > sendmail.cf"

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

Sources