Preparing your Host for Postfix

From Initq

Jump to: navigation, search

Contents

Abbreviations

You type a message and hit enter on your keyboard and like magic the other person gets the email. What really happens in between. We are going to explain a few terms to make this process clear.

  • MUA - Mail user agent (squirrelmail, kmail, outlook)
  • MTA - Mail transport agent (Postfix, sendmail, qmail, exim)
  • MDA - Mail delivery agent (procmail)
  • MSA - Message Store agent (Postfix mbox or MailDir)
  • POP/IMAP server (dovecot)

You use a MUA to write your message, you hand that message off to a MTA which might store the message if it is to a local user using Message Store or hand it off to another MTA who will then use its MSA. MTAs use a protocol SMTP to talk between each other. On the receiving side the user will use a MUA with build in POP/IMAP protocol client to connect to their POP/IMAP server to retrieve the message from the MSA. This is the most simplistic way of explaining how email works. There is, of course, many more things that happen to an message which we will explain in more detail later on.

There are many thing you have to check before you could run a successful mail server.

Hostname

[root@lexiana ~]# hostname -f
lexiana.com

Connectivity

Verify that you can connect to tcp port 25.

[lexiana@initq ~]$ telnet lexiana.com 25
Trying 71.164.213.43...
Connected to lexiana.com (71.164.213.43).
Escape character is '^]'.
220 mail.lexiana.com ESMTP Postfix (20060606) (Lexiana Email Server)

System time and Timestamps

Correct system time is the most important thing for mail servers. This stamp is used on email and all the logs so always make sure your server time is correct. Use the following in your cron job.

In Solaris the zoneinfo files are kept in

/usr/share/lib/zoneinfo/

In All Linux systems they are kept at

/usr/share/zoneinfo/
ln -s /usr/share/zoneinfo/America/Los_Angeles /etc/localtime
*/2 * * * * /usr/sbin/ntpdate -u 1.pool.ntp.org > /dev/null 2>&1

Syslog

Check your /etc/syslog.conf file for how your mail messages are logged. Ours looks like this.

# Mail logging
mail.=debug;mail.=info;mail.=notice             -/var/log/mail/info.log
mail.=warn                                      -/var/log/mail/warnings.log
mail.err                                        -/var/log/mail/errors.log

If you do not see any messages being logged then first check and make sure that syslogd is running.

[root@lexiana etc]# ps -eaf | grep syslogd
root      7279     1  0 Oct07 ?        00:01:06 syslogd -m 0 -a /var/spool/postfix/dev/log

Name Resolution

Make sure you have at least two DNS servers defined on your host. Nameservers returns the IP address of a hostname. The sooner you can find the ip address of your destination the quicker your email server will start talking with the remore mail server.

  • MX record - lets clients know that your server is responsibl for mail delivery for the domain or a certain host.
[root@lexiana etc]# dig initq.com MX

; <<>> DiG 9.5.0-P1 <<>> initq.com MX
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 46749
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1

;; QUESTION SECTION:
;initq.com.                     IN      MX

;; ANSWER SECTION:
initq.com.              3600    IN      MX      10 mail.lexiana.com.
initq.com.              3600    IN      MX      20 mail.initq.com.

;; ADDITIONAL SECTION:
mail.lexiana.com.       6784    IN      A       71.164.213.43

;; Query time: 113 msec
;; SERVER: 68.238.96.12#53(68.238.96.12)
;; WHEN: Thu Nov  6 19:37:10 2008
;; MSG SIZE  rcvd: 93
  • A record - Your mail must have a fully qualified host name so that clints can find out where your server is.
[root@lexiana etc]# dig 71.164.213.43 A

; <<>> DiG 9.5.0-P1 <<>> 71.164.213.43 A
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 36446
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;71.164.213.43.                 IN      A

;; AUTHORITY SECTION:
.                       10790   IN      SOA     A.ROOT-SERVERS.NET. NSTLD.VERISIGN-GRS.COM. 2008110601 1800 900 604800 86400

;; Query time: 9 msec
;; SERVER: 68.238.96.12#53(68.238.96.12)
;; WHEN: Thu Nov  6 19:45:14 2008
;; MSG SIZE  rcvd: 106
  • PTR record - Your hist should have a reverse dns lookup. Ours does not.
[root@lexiana etc]# dig -x 71.164.213.43

; <<>> DiG 9.5.0-P1 <<>> -x 71.164.213.43
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 13571
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;43.213.164.71.in-addr.arpa.    IN      PTR

;; ANSWER SECTION:
43.213.164.71.in-addr.arpa. 84366 IN    PTR     static-71-164-213-43.dllstx.fios.verizon.net.

;; Query time: 6 msec
;; SERVER: 68.238.96.12#53(68.238.96.12)
;; WHEN: Thu Nov  6 19:46:46 2008
;; MSG SIZE  rcvd: 102
Personal tools