Sendmail - Configuration

From Wiki-UX.info
Jump to: navigation, search

Sendmail Configuration

Sendmail is packaged with the core HP-UX 11i v2 operating system. When you install the operating system, Sendmail is automatically installed on your system. The necessary files required for Sendmail operation are created or modified on your system. The Sendmail configuration file supplied with the operating system, sendmail.cf, will work without modifications for most installations.

Verify current version

HP-UX 11i v1 (11.11)

# sendmail -bs
220 jets.rose.hp.com ESMTP Sendmail 8.9.3/8.9.3; Thu, 24 Jul 2008 13:29:59 -0700 (PDT)

HP-UX 11i v2 (11.23)

# sendmail -bs
220 rx26-189.usa.hp.com ESMTP Sendmail 8.11.1/8.11.1; Wed, 30 Jul 2008 03:17:21 -0400 (EDT)

HP-UX 11i v3 (11.31)

# sendmail -bs
220 delta.cri.hp.com ESMTP Sendmail @(#)Sendmail version 8.13.3 - Revision 1.000 - 1st August,2006/8.13.3; Thu, 24 Jul 2008 15:21:02 -0500 (CDT)
  • Note: Alternative, the "what" command can be use in all releases to gather similar information:
# what /usr/sbin/sendmail | grep version
        Sendmail version 8.13.3 - Revision 1.000 - 1st August,2006

Configure boot start

Sendmail is configure to start on boot by default. The configuration of the "/etc/rc.config.d/mailservs" file is as follows:

-> /etc/rc.config.d/mailservs
export SENDMAIL_SERVER=1

Verify running process

To check that the daemon is running, use the following command:

# ps -ef | grep [s]endmail
    root  3689     1  0 03:28:07 ?         0:00 sendmail: accepting connections

Sending an email

Use the following commands to purge root user mail accout and send a e-mail with the current system date.

[rx26-189]:/ # > /var/mail/root
[rx26-189]:/ # date | mailx -s "Local sendmail Test" root

Read user email

The "elm" Mail User Agent (MUA) will be use to read user local emails.

[rx26-189]:/ # elm

Notice:
This version of ELM requires the use of a .elm directory in your home
directory to store your elmrc and alias files. Shall I create the
directory .elm for you and set it up (y/n/q)? Yes.
Great! I'll do it now.

Notice:
ELM requires the use of a folders directory to store your mail folders in.
Shall I create the directory //Mail for you (y/n/q) Yes.
Great! I'll do it now.
              Mailbox is '/var/mail/root' with 1 message [ELM 2.4]


  N  1   Jul 24                    (14)   Local sendmail Test











   You can use any of the following commands by pressing the first character;
 d)elete or u)ndelete mail,  m)ail a message,  r)eply or f)orward mail,  q)uit
    To read a message, press <return>.  j = move down, k = move up, ? = help

Command:
Message 1/1 root@rx26-189.usa.hp.com             Jul 30, 2008 03:23:02 am -0400

Date: Wed, 30 Jul 2008 03:23:02 -0400 (EDT)
To: root@rx26-189.usa.hp.com
Subject: Local sendmail Test

Wed Jul 30 03:23:02 EDT 2008

Command ('i' to return to index):

The "/etc/mail/sendmail.cf" file

This is the main configuration file for sendmail. This file contains many rules for processing mail messages on the system.

Normally, "/etc/mail/sendmail.cf" file will be backup and a fresh copy will be obtained from "/usr/newconfig" directory

[rx26-189]:/ # cd /etc/mail
[rx26-189]:/etc/mail # cp sendmail.cf sendmail.cf.old
[rx26-189]:/etc/mail # cp /usr/newconfig/etc/mail/sendmail.cf .

Check the "D" macros in "/etc/mail/sendmail.cf" file

[rx26-189]:/etc/mail # grep ^D sendmail.cf
DX
DW
DS
DR
DH
DM
DnMAILER-DAEMON
DZ8.11.1
DP
DQ
  • The DZ macro shows the version of the sendmail.cf configuration file. Use "sendmail -bs" to get the version of the binary file.

The DS macro ("Smart" relay host)

The DSD macro defines the name of your mail relay host. This is the macro that you will set to the hostname of the gateway server.

Example:

Edit /etc/mail/sendmail.cf and define "smtp.hp.com" as your relay host using the DS macro. Send an email to your mail account. There is no need to stop & restart sendmail

[rx26-189]:/ # grep ^D /etc/mail/sendmail.cf
DX
DW
DSsmtp.hp.com
DR 
DH
DM
DnMAILER-DAEMON
DZ8.11.1
DP
DQ
[rx26-189]:/ # date | mailx -s "Smart relay host test" alejandro.marin-badilla@hp.com

Relay email.png

Use view, options to see the complete message header information.

Received: from g1t0023.austin.hp.com (15.216.28.30) by
 G5W0333.americas.hpqcorp.net (16.228.8.77) with Microsoft SMTP Server (TLS)
 id 8.1.263.0; Wed, 30 Jul 2008 07:30:40 +0000
Received: from rx26-189.usa.hp.com (rx26-189.usa.hp.com [16.118.112.93])	by
 g1t0023.austin.hp.com (Postfix) with ESMTP id 868443C0C3	for
 <alejandro.marin-badilla@hp.com>; Wed, 30 Jul 2008 07:30:30 +0000 (UTC)
Received: (from root@localhost)	by rx26-189.usa.hp.com (8.11.1/8.11.1) id
 m6U7Wnb19701	for alejandro.marin-badilla@hp.com; Wed, 30 Jul 2008 03:32:49
 -0400 (EDT)
Date: Wed, 30 Jul 2008 03:32:49 -0400
From: <root@rx26-189.usa.hp.com>
Message-ID: <200807300732.m6U7Wnb19701@rx26-189.usa.hp.com>
To: alejandro.marin-badilla@hp.com
Subject: Smart relay host test
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Brightmail-Tracker: AAAAAQAAAAI=
X-Whitelist: TRUE
Return-Path: root@rx26-189.usa.hp.com

The DH macro (mail hub)

If you required that local as well as non-local mail is forwarded to the gateway server, then set the DH macro on the "sendmail.cf" file.

[rx26-189]:/ # grep ^D /etc/mail/sendmail.cf
DX
DW
DS
DR 
DHsmtp.hp.com
DM
DnMAILER-DAEMON
DZ8.11.1
DP
DQ
  • Note: Only use this option if your email gateway / central hub is configure to store message for all unix user accounts or provide some sort of account translation services.

The "check_local" rule

This rules is frequently used when is required to:

  • Deliver all local mail to local users on the system.
  • Forward all Internet mail to the gateway server.
  • Deliver all mail in the local domain directly to the relevant system(s).

You need to set the DS macro and also uncomment the "check_local" rule in the sendmail.cf file as shown.

-> /etc/mail/sendmail.cf
DSsmtp.hp.com
.
.
.
# See if we are supposed to deliver to hosts in the local domain
R$* < @ $* > $*  $: $>check_local <$m> $1 < @ $2 >$3 Local Domain?
.
.
.

Example:

  1. Install Alt-N MDaemon Ver.9.6.6 30 days trial Email Server on your workstation.
    1. Domain: americas.hpqcorp.net
    2. Administrator account: <First Name>.<Last Name>
    3. Disable strong password: Under Setup menu -> Miscellaneous options -> Miscellaneous -> Uncheck Strong passwords box.
    4. Create a root account to sent e-mail from your HP-UX test server: Accounts, New Account, Super User root@americas.hpqcorp.net
    5. Create root aliases to map your HP-UX test server domain "usa.hp.com" to the workstation domain "americas.hpqcorp.net": Accounts, Address aliases, root@<hostname>.usa.hp.com; root@<hostname>
  2. Add an entry on your server "/etc/host" file to resolve the workstation IP address to <host>.usa.hp.com on your HP-UX test server.
  3. Configure sendmail "check_local" rule. Don't forget to set DS macro too.
  4. Sent an email to your workstation root account: "date | mailx -s "Test check_local_rule" root@<hostname>.usa.hp.com
  • Note: Using of the MDaemon email server may need to disable your Windows firewall or open access to TCP ports 25, 110, 143 and 3000.

The MDaemon "SMPT(in) log" should gave an entry simmilar to the following.

Tue 2008-07-29 15:43:44: Session 1; child 1; thread 1076
Tue 2008-07-29 15:43:43: Accepting SMTP connection from [16.90.48.75:54188]
Tue 2008-07-29 15:43:43: Performing PTR lookup (75.48.90.16.IN-ADDR.ARPA)
Tue 2008-07-29 15:43:43: *  D=75.48.90.16.IN-ADDR.ARPA TTL=(120) PTR=[delta.cri.hp.com]
Tue 2008-07-29 15:43:43: *  Gathering A records...
Tue 2008-07-29 15:43:43: *  D=delta.cri.hp.com TTL=(120) A=[16.90.48.75]
Tue 2008-07-29 15:43:43: ---- End PTR results
Tue 2008-07-29 15:43:43: --> 220 americas.hpqcorp.net ESMTP MDaemon 9.6.6 UNREGISTERED; Tue, 29 Jul 2008 15:43:43 -0600
Tue 2008-07-29 15:43:43: <-- EHLO delta.cri.hp.com
Tue 2008-07-29 15:43:43: Performing IP lookup (delta.cri.hp.com)
Tue 2008-07-29 15:43:43: *  D=delta.cri.hp.com TTL=(120) A=[16.90.48.75]
Tue 2008-07-29 15:43:43: ---- End IP lookup results
Tue 2008-07-29 15:43:43: --> 250-americas.hpqcorp.net Hello delta.cri.hp.com, pleased to meet you
Tue 2008-07-29 15:43:43: --> 250-ETRN
Tue 2008-07-29 15:43:43: --> 250-AUTH=LOGIN
Tue 2008-07-29 15:43:43: --> 250-AUTH LOGIN CRAM-MD5
Tue 2008-07-29 15:43:43: --> 250-8BITMIME
Tue 2008-07-29 15:43:43: --> 250 SIZE 0
Tue 2008-07-29 15:43:43: <-- MAIL From:<root@delta.cri.hp.com> SIZE=500 AUTH=root@delta.cri.hp.com
Tue 2008-07-29 15:43:43: Performing IP lookup (delta.cri.hp.com)
Tue 2008-07-29 15:43:43: *  D=delta.cri.hp.com TTL=(120) A=[16.90.48.75]
Tue 2008-07-29 15:43:43: ---- End IP lookup results
Tue 2008-07-29 15:43:43: Performing SPF lookup (delta.cri.hp.com / 16.90.48.75)
Tue 2008-07-29 15:43:43: *  Result: none; no SPF record in DNS
Tue 2008-07-29 15:43:43: ---- End SPF results
Tue 2008-07-29 15:43:43: --> 250 <root@delta.cri.hp.com>, Sender ok
Tue 2008-07-29 15:43:43: <-- RCPT To:<root@l400.cri.hp.com>
Tue 2008-07-29 15:43:43: root@l400.cri.hp.com is an alias for root@americas.hpqcorp.net
Tue 2008-07-29 15:43:44: Performing DNS-BL lookup (16.90.48.75 - connecting IP)
Tue 2008-07-29 15:43:44: *  zen.spamhaus.org - passed
Tue 2008-07-29 15:43:44: ---- End DNS-BL results
Tue 2008-07-29 15:43:44: --> 250 <root@l400.cri.hp.com>, Recipient ok
Tue 2008-07-29 15:43:44: <-- DATA
Tue 2008-07-29 15:43:44: Creating temp file (SMTP): c:\mdaemon\queues\temp\md50000000001.tmp
Tue 2008-07-29 15:43:44: --> 354 Enter mail, end with <CRLF>.<CRLF>
Tue 2008-07-29 15:43:44: Message size: 519 bytes
Tue 2008-07-29 15:43:44: Performing DKIM lookup
Tue 2008-07-29 15:43:44: *  File: c:\mdaemon\queues\temp\md50000000001.tmp
Tue 2008-07-29 15:43:44: *  Message-ID: 200807292134.m6TLYpAf027412@delta.cri.hp.com
Tue 2008-07-29 15:43:44: *  Result: neutral
Tue 2008-07-29 15:43:44: ---- End DKIM results
Tue 2008-07-29 15:43:44: Performing DomainKeys lookup (Sender: root@delta.cri.hp.com)
Tue 2008-07-29 15:43:44: *  File: c:\mdaemon\queues\temp\md50000000001.tmp
Tue 2008-07-29 15:43:44: *  Message-ID: 200807292134.m6TLYpAf027412@delta.cri.hp.com
Tue 2008-07-29 15:43:44: *  Querying for policy: delta.cri.hp.com
Tue 2008-07-29 15:43:44: *    Querying: _domainkey.delta.cri.hp.com ...
Tue 2008-07-29 15:43:44: *    DNS: *  Name server reports domain name unknown
Tue 2008-07-29 15:43:44: *  Result: neutral
Tue 2008-07-29 15:43:44: ---- End DomainKeys results
Tue 2008-07-29 15:43:44: Message creation successful: c:\mdaemon\queues\inbound\md50000000001.msg
Tue 2008-07-29 15:43:44: --> 250 Ok, message saved <Message-ID: 200807292134.m6TLYpAf027412@delta.cri.hp.com>
Tue 2008-07-29 15:43:44: <-- QUIT
Tue 2008-07-29 15:43:44: --> 221 See ya in cyberspace
Tue 2008-07-29 15:43:44: SMTP session successful (Bytes in/out: 660/469)
Tue 2008-07-29 15:43:44: ----------

You can check the email using the MDaemon WebClient: http://localhost:3000 Mdaemon check local.png

The DM Macro

If you need to have mail appear to be from some host or location other than the local host, set the DM macro to the name you wish to masquerade as.

This is also know as “Site Hiding”. Site Hiding is often used to make mail appear as originating from a site, rather than an individual host or central mail hub.

# grep ^D /etc/mail/sendmail.cf
DX
DW
DSsmtp.hp.com
DR 
DMtest.org
DnMAILER-DAEMON
DZ8.11.1
DP
DQ
  • Note: "Site Hiding" does not apply on email generated with the root account. You need to send your email from a user account so it works properlly. You can workaround this issue using the su command. For example: su amarin -c 'date | mailx -s "Site Hiding test" alejandro.marin-badilla@hp.com'.

Example:

# whoami
nassar
# date | mailx -s "Site Hiding test" alejandro.marin-badilla@hp.com

Site hiding email.png

Received: from g5t0002.atlanta.hp.com (15.192.0.39) by
 G3W0059.americas.hpqcorp.net (16.232.1.154) with Microsoft SMTP Server (TLS)
 id 8.1.263.0; Wed, 30 Jul 2008 08:57:39 +0000
Received: from delta.cri.hp.com (delta.cri.hp.com [16.90.48.75])	by
 g5t0002.atlanta.hp.com (Postfix) with ESMTP id 2D7B3300A4	for
 <alejandro.marin-badilla@hp.com>; Wed, 30 Jul 2008 08:57:13 +0000 (UTC)
Received: (from nassar@localhost)	by delta.cri.hp.com (@(#)Sendmail version
 8.13.3 - Revision 1.000 - 1st August,2006/8.13.3) id m6U8mA1X003887	for
 alejandro.marin-badilla@hp.com; Wed, 30 Jul 2008 03:48:10 -0500 (CDT)
Date: Wed, 30 Jul 2008 03:48:10 -0500
From: <nassar@test.org>
Message-ID: <200807300848.m6U8mA1X003887@delta.cri.hp.com>
To: alejandro.marin-badilla@hp.com
Subject: Site Hiding test
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Brightmail-Tracker: AAAAAQAAAAI=
X-Whitelist: TRUE
Return-Path: nassar@test.org

The "sendmail.cw" file

If the system is going to receive mail ensure that the "/etc/mail/sendmail.cw" file contains the following entries:

localhost
<hostname>
<fqdn>

Example:

localhost
delta
delta.cri.hp.com

If the systems is going to receive mail for another host or domain, then ensure that "the sendmail.cw" file contains those entries as well.

Example:

localhost
delta
delta.cri.hp.com
test.org

Relevant directories

  • Incoming mail is delivered locally on the system to the "/var/mail" directory.
  • Outgoing mail is queued for delivery in the "/var/spool/mqueue" directory.

Troubleshooting using /usr/sbin/sendmail

Sendmail can be used as a very simple but effective troubleshooting tool by employing it as a mail user agent (MUA) in verbose mode:

/usr/sbin/sendmail -v <user>@<domain>

This is a test

.  	# (i.e., a period on a line by itself)

Example:

# /usr/sbin/sendmail -v alejandro.marin-badilla@hp.com
Subject: This is a troubleshooting test
Running /usr/sbin/sendmail in verbose mode.
.
alejandro.marin-badilla@hp.com... Connecting to smtp.hp.com. via relay...
220 g5t0003.atlanta.hp.com ESMTP Postfix
>>> EHLO delta.cri.hp.com
250-g5t0003.atlanta.hp.com
250-PIPELINING
250-SIZE
250-ETRN
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
>>> MAIL From:<root@delta.cri.hp.com> SIZE=84
250 2.1.0 Ok
>>> RCPT To:<alejandro.marin-badilla@hp.com>
>>> DATA
250 2.1.5 Ok
354 End data with <CR><LF>.<CR><LF>
>>> .
250 2.0.0 Ok: queued as A6DFE10089
alejandro.marin-badilla@hp.com... Sent (Ok: queued as A6DFE10089)
Closing connection to smtp.hp.com.
>>> QUIT
221 2.0.0 Bye
#

Reference

  • HP-UX Mailing Services Administrator’s Guide - HP-UX 11i v1 and HP-UX 11i v2

http://docs.hp.com/en/5991-6611/index.html

  • Cedrone, Stuart. Module 6 - Sendmail Basic Configuration & Troubleshooting. 2006.03.23

Click to open Powerpoint 97-2003 presentation

Authors

Presentation

BACK TO Sendmail Handbook