OpenSolaris Tutorials
Installing and Configuring OpenVPN in OpenSolaris
Deploying OpenSolaris In Amazon EC2
Installing Postfix and Dovecot Under OpenSolaris

Installing Postfix and Dovecot Under OpenSolaris

Installing Postfix and Spamassassin

Postfix is a flexible and easy to configure replacement for sendmail. By following these instructions you can have a complete Postfix installation complete with support for POP, IMAP and vhosts. POP and IMAP will be supplied by Dovecot. This tutorial will be based on Opensolaris 2009.06 with Blastwave.

The first thing to do is to disable sendmail.

# svcadm disable sendmail

Now to install postfix and related packages. Procmail is a powerful mail processing tool that can be configured to do just about anything with a message and the popular spamassassin anti-spam agent.

# pkg install SUNWprocmail
# /opt/csw/bin/pkgutil -i CSWspamassassin
# /opt/csw/bin/pkgutil -i CSWpostfix

Symlinking to common paths is always convenient when troubleshooting.

# ln -s /etc/opt/csw/postfix /etc/postfix
# cp /etc/mail/aliases /etc/postfix

Time to create the users that will own the virtual mailbox storage files. Take note of the UID/GID of these accounts as they're needed in the configuration.

# groupadd virtmail
# useradd -g virtmail -s /bin/false -c "Virtual Mail User" virtmail
# grep virtmail /etc/group /etc/passwd

Configuring Spamassassin

Setting up and integrating spamassassin into postfix requires a few things to be done. First we need to create a user/group for spamd to run under and a user/group for the spamfilters to use.

# groupadd spamd
# useradd -g spamd -s /bin/false -d /home/spamd -c "Spamassassin User" spamd
# grep spamd /etc/group /etc/passwd
# groupadd spamfilt
# useradd -g spamfilt -d /home/spamfilt -s /bin/false -c "Spam filter User" spamfilt
# groupadd spamfilt /etc/group /etc/passwd

Now we need to configure spamassassin. Symlink the spamassassin config directory to an easier to remember location and edit the file[;/P:]

# ln -s /opt/csw/etc/spamassassin /etc/spamassassin

An example

# Rewrite the subject header to start with *****SPAM*****
rewrite_header Subject *****SPAM*****
# trust mail from this network
trusted_networks 192.168.100.
# required score to tag mail as spam
required_score 5.0
# use bayesian filters built into spamassassin
use_bayes 1
# whether or not to feed mail into the bayesian scoring system
bayes_auto_learn 1
# path to store bayesian filter information
bayes_path              /home/spamd/
# permissions to store bayesian filters
bayes_file_mode         0666
# whitelist mail from
# whitelist all mail from
whitelist_from *
# blacklist mail from

Spamassassin needs to be running as a daemon.

# /opt/csw/bin/spamd --daemonize --username spamd --pidfile /home/spamd/

Now create a simple shell script called to process the mail through spamassassin and place it in /opt/csw/bin. This is the script that will be called by postfix.

/opt/csw/bin/spamc | /opt/csw/sbin/sendmail -i "$@"
exit $?

Adjust the permissions of the new script

# chown root:spamfilt /opt/csw/bin/
# chmod 755 /opt/csw/bin/
 1 2 3  >> Configuring Postfix
New Content