Configuration: Once Mail Avenger is installed, you must
configure asmtpd, the avenger SMTP daemon.
-
Create a user called avenger on your system. This is the user ID
under which system-wide avenger scripts will run. (If you wish to use
a name other than "avenger", you can put the directive "AvengerUser <username>" in the
asmtpd.conf configuration file when you create that.)
-
If you run sendmail, make sure the avenger
user you just created has permission to read the sendmail alias
database (by default /etc/mail/aliases.db). On some systems,
sendmail will stubbornly keep changing the alias database so that it
is only readable by group wheel, in which case you must add the
avenger user to the wheel group.
- Create the directory /etc/avenger and populate it with
sample configuration files with the following commands:
mkdir /etc/avenger
cp /usr/local/share/avenger/asmtpd.conf /etc/avenger/
cp /usr/local/share/avenger/unknown /etc/avenger/
- Edit the file /etc/avenger/asmtpd.conf. By default, it
is configured for sendmail. You will almost certainly need to edit it
if you are using another MTA, and even with sendmail you will probably
want to look over all the configuration options anyway. See the asmtpd.conf(5) man page for more information about the
format of this file.
-
Edit the file /etc/avenger/unknown to handle unknown users
properly. This script governs what happens to mail for users who are
not in the password file, who have uid 0, or who don't have valid
shells.
- If you are running sendmail and your alias file is
/etc/mail/aliases.db, the sample file is okay as long as the avenger user can read the
aliases.db file.
- If you are running qmail, you must
uncomment the QMAIL_OPT line. However, this only works if you are not using the qmail
users/assign file.
- If you are running any other MTA, or are using qmail with the
users/assign file, you will have to write your own, custom
/etc/avenger/unknown script.
You can alternatively just delete /etc/avenger/unknown
entirely. You won't lose mail, but your system will then send back
bounce messages for unknown users, which is less efficient than
rejecting mail during the SMTP transaction. (Of course, asmtpd will still use SPF to reject forged mail
outright.)
-
Create a file /etc/avenger/domains. List each domain for
which you would like to receive mail, followed by a colon, one per
line. For example:
my.first.domain:
my.second.domain:
-
Fire it up! Run the command asmtpd as root.
You may also want to set things up to run this command automatically
on system startup.
Optional steps: Once you have the Avenger SMTP daemon up and
running, you may wish to do any of the following.
-
Publish SPF records for your domains, if you haven't already. See http://www.openspf.org/
or the handy configuration wizard at http://www.openspf.org/wizard.html
for more information on SPF.
-
Play with more scripts. Read the man page for avenger(1), create a .avenger/rcpt file in
your home directory, and maybe create a site-wide default file
/etc/avenger/default.
-
Configure the avenger local delivery agent, avenger.local. (See the avenger.local(8) man page for more information.)
- If you use sendmail, include /usr/local/share/avenger/avsendmail.m4
towards the end of the ".mc" file you use to generate
sendmail.cf with the following line:
include(`/usr/local/share/avenger/avsendmail.m4')
- If you use postfix, add the following
lines to /etc/postfix/mail.cf, but be sure to substitute the
correct path for mail.local:
prepend_delivered_header = forward, file
mailbox_command = /usr/local/libexec/avenger.local
--fallback /usr/libexec/mail.local
-D "$RECIPIENT" -d "$LOCAL"
- If you use qmail, you don't really need
to install avenger.local, because qmail
already has a similar mechanism for delivering extension addresses.