Next: 12 PPP
Up: Redhat FAQ
Previous: 10 Port Forwarding
Contents
Subsections
These instructions need a lot of work.
- 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
- 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
- Make and Install
# make
# make install
- 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
- Copy or create the postfix startup script (Sec: 11.6)
to the init directory
- Set the service to start at boot
# chkconfig postfix add
# chkconfig postfix -list
- Copy or modify the configuration for Send Only (Sec: 11.2)
or Server (Sec: 11.3) as appropiate.
- Start the service
# service postfix start
11.2 Send Only
- Comment out smtp in /etc/postfix/master.cf to prevent the machine
from receiving mail.
- Copy or create the send-only aliases file, /etc/aliases.
- Create the aliases database
# newaliases
- Send a test message
11.3 Mail Server
- Copy over main.cf and master.cf
- If using sendmail type aliases, copy or create the /etc/aliases
file. If using virtual_maps create an empty aliases file.
# touch /etc/aliases
- Create or copy : access, canonical, relocated, transport, and
virtual.
- $ postconf -e 'maximal_queue_lifetime=0s'
$ postfix reload
$ postfix flush
$ ... wait for queue to drain ...
$ postconf -e 'maximal_queue_lifetime=5d'
$ postfix reload
- In /etc/postfix/main.cf
mydestination = $myhostname localhost.$mydomain
relay_domains = $mydomain
- In /etc/postfix/virtual set the local user(s) to:
<localuser>@totalflood.com <localuser>@localhost.totalflood.com
- In /etc/postfix/transport set the local name to local delivery
localhost.totalflood.com local:
mail.totalflood.com local:
When setting up smtpd restrictions remember:
- client = hostname/ip
- sender = sender email adress
- recipient = recipient email adress
- smtpd_client_restrictions = restrict based on client IP address
or reverse DNS lookup of that IP address (Only if forward DNS lookup
give back same IP address)
- smtpd_helo_restrictions = restrict based on HELO/EHLO sent by client,
or any restriction appropriate to smtpd_client_restrictions
- smtpd_sender_restrictions = restrict based on MAIL FROM email address,
or any restriction appropriate to either smtpd_client_restrictions
or smtpd_helo_restrictions
- smtpd_recipient_restrictions = restrict based on RCPT TO email address,
or any restriction appropriate to any other smtpd_*_restrictions
line.
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: 12 PPP
Up: Redhat FAQ
Previous: 10 Port Forwarding
Contents
2005-03-20