next up previous contents
Next: 12 PPP Up: Redhat FAQ Previous: 10 Port Forwarding   Contents

Subsections

11 Postfix

These instructions need a lot of work.

11.1 All Machines

  1. Create a postfix user and groups
    # groupadd -g 220 postfix 
    # groupadd -g 225 postdrop 
    # useradd -u 220 -g postfix -d /dev/null -s /bin/false postfix
  2. Remove sendmail. There may be dependencies with mutt and fetchmail so either use the -no-deps option to rpm or remove mutt and fetchmail.
    # rpm -e mutt 
    # rpm -e fetchmail 
    # rpm -e sendmail
  3. Make and Install
    # make 
    # make install
  4. If necessary link /usr/sbin/sendmail to /usr/lib/sendmail (remove or rename old sendmail if necessary):
    # cd /usr/sbin
    # ln -s /usr/lib/sendmail sendmail
  5. Copy or create the postfix startup script (Sec: 11.6) to the init directory
  6. Set the service to start at boot
    # chkconfig postfix add 
    # chkconfig postfix -list
  7. Copy or modify the configuration for Send Only (Sec: 11.2) or Server (Sec: 11.3) as appropiate.
  8. Start the service
    # service postfix start


11.2 Send Only

  1. Comment out smtp in /etc/postfix/master.cf to prevent the machine from receiving mail.
  2. Copy or create the send-only aliases file, /etc/aliases.
  3. Create the aliases database
    # newaliases
  4. Send a test message


11.3 Mail Server

  1. Copy over main.cf and master.cf
  2. If using sendmail type aliases, copy or create the /etc/aliases file. If using virtual_maps create an empty aliases file.
    # touch /etc/aliases
  3. Create or copy : access, canonical, relocated, transport, and virtual.

11.3.1 Emptying mail queue

  1. $ postconf -e 'maximal_queue_lifetime=0s'
    $ postfix reload
    $ postfix flush
    $ ... wait for queue to drain ...
    $ postconf -e 'maximal_queue_lifetime=5d'
    $ postfix reload

11.4 Special Considerations

11.4.1 Local Delivery when forwarding

  1. In /etc/postfix/main.cf 
    mydestination = $myhostname localhost.$mydomain 
    relay_domains = $mydomain
  2. In /etc/postfix/virtual set the local user(s) to:
    <localuser>@totalflood.com    <localuser>@localhost.totalflood.com
  3. In /etc/postfix/transport set the local name to local delivery
    localhost.totalflood.com    local: 
    mail.totalflood.com         local:

11.5 Configuration Notes

When setting up smtpd restrictions remember:


11.6 Postfix init script

#!/bin/sh 
# 
# postfix This shell script takes care of starting and stopping 
# postfix. 
# 
# chkconfig: 2345 80 30 
# 
# description: Postfix is a Mail Transport Agent, which is the program 
# that moves mail from one machine to another. 
# Source function library. 
. /etc/rc.d/init.d/functions 
 
# Source networking configuration. 
. /etc/sysconfig/network 
 
# Check that networking is up. 
[ ${NETWORKING} = "no" ] && exit 0 
 
[ -f /usr/sbin/postfix ] || exit 0 
 
# See how we were called. 
case "$1" in 
   start) 
      # Start daemons. 
      echo -n "Starting postfix: " 
      newaliases 
      for I in access canonical relocated transport virtual 
      do 
      if [ -f /etc/postfix/$I ] ; then 
         /usr/sbin/postmap hash:/etc/postfix/$I < /etc/postfix/$I 
      fi 
      done 
      /usr/sbin/postfix start 2>/dev/null 
      echo postfix 
      touch /var/lock/subsys/postfix 
      ;; 
   stop) 
      # Stop daemons. 
      echo -n "Shutting down postfix: " 
      /usr/sbin/postfix stop 2>/dev/null 
      echo postfix 
      rm -f /var/lock/subsys/postfix 
      ;; 
   restart) 
      $0 stop 
      $0 start 
      ;; 
   reload) 
      /usr/sbin/postfix reload 
      ;; 
   status) 
      status master 
      ;; 
   *) 
      echo "Usage: $0 {start|stop|restart|reload|status}" 
      exit 1 
   esac 
 
exit 0


next up previous contents
Next: 12 PPP Up: Redhat FAQ Previous: 10 Port Forwarding   Contents
2005-03-20