2004-08-20
# cd /usr/ports/mail/procmail # make install && make clean
I. Add these lines to /etc/make.conf:
SENDMAIL_WITH_SMTPS=yes #you won't need this line if you don't want SMTPs SENDMAIL_WITH_SASL=yes
II. Install Sendmail
# cd /usr/ports/mail/sendmail # make install && make clean # cd /usr/local/etc/rc.d # mv sendmail.sh.sample sendmail.sh
III. Modify the following lines in /etc/mail/Makefile
SENDMAIL_START_SCRIPT?= /usr/local/etc/rc.d/sendmail.sh SENDMAIL?= /usr/local/sbin/sendmail
IV. Create a template .mc file for your host from freebsd.mc
# make cf
That should have created /etc/mail/yourhostname.domain.mc
V. Edit yourhostname.domain.mc (I use something like this)
divert(-1)
#
divert(0)
VERSIONID(`$FreeBSD: src/etc/sendmail/freebsd.mc,v 1.10.2.19 2003/12/31 17:42:16 gshapiro Exp $')
OSTYPE(freebsd4)
DOMAIN(generic)
FEATURE(access_db, `hash -o -T /etc/mail/access')
FEATURE(blacklist_recipients)
FEATURE(local_lmtp)
FEATURE(mailertable, `hash -o /etc/mail/mailertable')
FEATURE(virtusertable, `hash -o /etc/mail/virtusertable')
FEATURE(delay_checks)dnl override blacklists
dnl the following lines are for spam blacklists
FEATURE(dnsbl, `list.dsbl.org', `"550 Mail from " $&{client_addr} " rejected, see http://dsbl.org/listing?" $&{client_addr}')
FEATURE(dnsbl, `bl.spamcop.net', `"550 Mail from " $&{client_addr} " rejected, see http://www.spamcop.net/"')
FEATURE(dnsbl, `combined.njabl.org', `"550 Mail from " $&{client_addr} " rejected, see http://dnsbl.njabl.org/"')
FEATURE(dnsbl, `xbl.spamhaus.org', `"550 Mail from " $&{client_addr} " rejected, see http://http://www.spamhaus.org/xbl/"')
FEATURE(dnsbl, `ipwhois.rfc-ignorant.org',`"550 Mail from " $&{client_addr} " refused. Rejected for bad WHOIS info on IP of your SMTP server - see http://www
.rfc-ignorant.org/"')
FEATURE(`local_procmail')dnl procmail fixes a duplicate mail problem when using quotas
dnl these lines add authentication support to sendmail.
TRUST_AUTH_MECH(`PLAIN LOGIN')dnl
define(`confAUTH_MECHANISMS', `PLAIN LOGIN')dnl
MODIFY_MAILER_FLAGS(`LOCAL', `+S')
define(`confCW_FILE', `-o /etc/mail/local-host-names')
define(`ALIAS_FILE', `/etc/mail/aliases')
define(`confMAX_MESSAGE_SIZE', `10000000')
dnl assuming that you already have imapd.pem ...for ssl.
define(`CERT_DIR', `/usr/local/certs')dnl
define(`confCACERT_PATH', `CERT_DIR')dnl
define(`confCACERT', `CERT_DIR/imapd.pem')dnl
define(`confSERVER_CERT', `CERT_DIR/imapd.pem')dnl
define(`confSERVER_KEY', `CERT_DIR/imapd.pem')dnl
define(`confCLIENT_CERT', `CERT_DIR/imapd.pem')dnl
define(`confCLIENT_KEY', `CERT_DIR/imapd.pem')dnl
DAEMON_OPTIONS(`Name=IPv4, Family=inet, M=A')dnl
DAEMON_OPTIONS(`Port=smtps, Name=TLSMTA, M=s')dnl
define(`confBIND_OPTS', `WorkAroundBrokenAAAA')
define(`confNO_RCPT_ACTION', `add-to-undisclosed')
define(`confPRIVACY_FLAGS', `authwarnings,noexpn,novrfy')
dnl this adds anti-virus scanning
INPUT_MAIL_FILTER(`clmilter',`S=local:/var/run/clamav/clmilter.sock, F=, T=S:4m;R:4m')dnl
define(`confINPUT_MAIL_FILTERS', `clmilter')
MAILER(local)
MAILER(smtp)
MAILER(`procmail')dnl procmail fixes a duplicate mail problem when using quotas
VI. Install clamd (virus scanning)
# cd /usr/ports/security/clamav # make install && make clean
Be sure that you check [X] Milter VII. After installation completes add the following lines to /etc/rc.conf:
clamav_freshclam_enable="YES" clamav_clamd_enable="YES" clamav_milter_enable="YES"
VIII. Uncomment following lines on /usr/local/etc/clamav.conf
StreamSaveToDisk
IX. Start up all the services
# cd /usr/local/etc/rc.d # ./clamav-freshclam.sh start # ./clamav-clamd.sh start # ./clamav-milter.sh start
X. Make and install the sendmail.cf file (from yourhostname.domain.mc file)
# cd /etc/mail/ # make cf # make install
XI. And finally start sendmail…
# make stop # make start
If you see no errors (check /var/log/maillog) you should be good. Send an email through your system and make sure the clamd header gets added.
