1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
|
Installation:
1) Pick a user and group that smtpd/smtpfwdd will run as. These
MUST NOT BE ROOT, but should be specified as a user that can run
"sendmail -f" to specify the sender of a mail message. "uucp" or "daemon"
might be a good choice. If you are running sendmail, check the /etc/sendmail.cf
file for a section like:
-------------------------8<--------------------------------------
#####################
# Trusted users #
#####################
Troot
Tdaemon
Tuucp
Tmajordom
-------------------------8<--------------------------------------
Be sure your user is one of those trusted by sendmail. Add the user
to the cf file if they aren't there.
2) Pick a directory where smtpd will store incoming mail before
forwarding it. The default location is "/usr/spool/smtpd". Create this
directory, and change it so that it is owned by the user you chose, and
is readable, writable and accessable ONLY to that user (i.e. mode 700).
3) Edit the makefile to reflect your choices for the user and
directory above, as well as anything else that tickles your fancy,
such as the install location, rules checking, etc.
***IMPORTANT*** If you *DO NOT* have the Juniper firewall toolkit
installed, you must change JUNIPER_SUPPORT=1 to JUNIPER_SUPPORT=0
in the makefile or smtpd probably won't build.
***IMPORTANT*** be sure to uncomment your choice of operating system
at the bottom of the makefile.
4) Type "make" to build the daemons.
5) Type "make install" to install them. This will barf horribly
if you're on a machine with a broken (i.e. System V :) "install" program.
If it does, install by hand, or get a copy of gnu install.
6) Make an "etc" directory in /usr/spool/smtpd (or whatever you picked).
and copy your /etc/resolv.conf file to /usr/spool/smtpd/etc/resolv.conf. You
will need this since smtpd checks hostnames while being chrooted to the spool
directory, so it needs a copy of /etc/resolv.conf to find your nameserver.
On Solaris you need other stuff too. It's detailed in the file INSTALL.SOLARIS
7) Make a copy of your timezone configuration file to the appropriate
place under /usr/spool/smtpd (or whatever you picked). i.e. if your
file is /etc/localtime, copy it to /usr/spool/smtpd/etc/localtime. if
it is /usr/lib/timezone/localtime, copy to
/usr/spool/smtpd/usr/lib/timezone/localtime, etc. The location of these
files will vary by OS. (Or even from distribution to distribution in the
case of Linux)
Again, since smtpd is chrooted to this directory, you need a copy of the
timezone file, or your syslog messages will show up in GMT time. (If they
do, you didn't get the right file :-)
8) Kill off your old mail transport daemon if you are running one.
9) Edit /etc/inetd.conf and add a line like:
smtp stream tcp nowait root /usr/local/sbin/smtpd smptd
Or, if you're using juniper, edit /etc/juniperd.conf and
make sure you have a definition like:
proxy smtpd tcp
port smtp
username root
options trusted-ident untrusted-ident acct
captured-proxy NONE
trusted-daemon /usr/local/sbin/smtpd smtpd
untrusted-daemon /usr/local/sbin/smtpd smtpd
end-proxy
10) For inetd, restart inetd, (usually with a "kill -HUP"), for juniper,
restart with "/usr/local/juniper/bin/jc restart".
11) Start the forwarding daemon. (As root, run /usr/local/sbin/smtpfwdd)
12) Edit your system startup files so that smtpfwdd is started
INSTEAD of sendmail, or anything you were running before.
13) Check your /etc/syslog.conf file. Many systems (such as many linux
distribs) come with notoriously lame /etc/syslog.conf setups.
smtpd generates lots of logs which will be onerous if you don't
have your syslogs set up nice. I personally prefer a line such as
mail.debug /var/log/mail.log
to catch all smtpd/smtpfwdd/sendmail logs to one file, which I
then rotate frequently, but your mileage may vary depending on
your system and your preferences.
14) If you are using sendmail, you may need to ensure sendmail gets
invoked to process any queued messages periodically. You can do this
with a cron job that runs "sendmail -q" periodically (such as
every 20 minutes or so). I.E. (in root's crontab):
# Flush sendmail queues every 20 mins
14,34,54 * * * * /usr/sbin/sendmail -q
Sendmail also has an option that will allow it to run
persistently, checking the queue periodically but not listening on
the network. You may choose to use this instead of a cron job,
but beware that this feature was broken until recent sendmail
releases.
|