Qmail (with SSL), Courier IMAP, vpopmail, SA, and ClamAV
Created: 12/02/2006
General Information
This guide is designed to help you install FreeBSD and setup qmail with mail filtering abilities. I designed my own qmail guide for a few reasons. First, there really isn't much out there when you look for this type of install from the ports system. Second, I have a vpopmail patch that allows creation of Custom Maildirs. I have been using a custom Maildir structure for about a year and a half now with no issues. The vpopmail skel patch allows you to patch vpopmail so you can make your own custom directories. If you create a user with just the normal vpopmail install, you get a default Maildir with new, tmp and cur in it which really doesn't allow you to do too much with filtering and the like. If you create a new user and vpopmail has been patched with the skel patch, the user's maildir is copied from the ~vpopmail/skel dir. If you really think about it, you can pretty much add your own maildrop recipe into the skel dir along with the .qmail file. If you add the qmailadmin into the mix, you or your users can turn on or off the spam filtering at leisure. If you really know what you're doing, this can open up a whole new world with vpopmail.Requirements
/usr/ports/shells/bash
/usr/ports/devel/gmake. If you dont, compiling vpopmail will give you some issues.Installation
This is a qmailrocks style install with a few modifications:Qmail
The qmail program is a secure, reliable, efficient simple message transfer agent. It is meant to be a replacement for the entire sendmail-binmail system that most UNIX hosts use. For more information, Please see the following links:|
# # # # # |
cd ~root fetch http://freebsdrocks.net/files/users.sh chmod 755 users.sh ./users.sh rm users.sh |
|
# # # |
cd ~root fetch http://freebsdrocks.net/files/qmail-1.03.tar.gz tar xvzf qmail-1.03.tar.gz |
|
# # # |
fetch http://qmail.jms1.net/patches/qmail-1.03-jms1.VER.patch cd ~root/qmail-1.03 patch < ../name_of_file |
| # | patch < ../qmail-1.03-jms1.6c.patch |
|
(Creating file strsalloc.c...) Patching file strsalloc.c using Plan A... Hunk #1 succeeded at 1. Hmm... The next patch looks like a unified diff to me... The text leading up to this was: -------------------------- |diff -ruN qmail-1.03-factory/strsalloc.h qmail-1.03-6b/strsalloc.h |--- qmail-1.03-factory/strsalloc.h 1969-12-31 19:00:00.000000000 -0500 |+++ qmail-1.03-6b/strsalloc.h 2005-05-23 15:13:58.000000000 -0400 -------------------------- (Creating file strsalloc.h...) Patching file strsalloc.h using Plan A... Hunk #1 succeeded at 1. Hmm... The next patch looks like a unified diff to me... The text leading up to this was: -------------------------- |diff -ruN qmail-1.03-factory/tcp-env.c qmail-1.03-6b/tcp-env.c |--- qmail-1.03-factory/tcp-env.c 1998-06-15 06:53:16.000000000 -0400 |+++ qmail-1.03-6b/tcp-env.c 2005-05-23 15:13:58.000000000 -0400 -------------------------- Patching file tcp-env.c using Plan A... Hunk #1 succeeded at 10. Hunk #2 succeeded at 35. Hunk #3 succeeded at 76. Hunk #4 succeeded at 102. Hmm... The next patch looks like a unified diff to me... The text leading up to this was: -------------------------- |diff -ruN qmail-1.03-factory/timeoutconn.c qmail-1.03-6b/timeoutconn.c |--- qmail-1.03-factory/timeoutconn.c 1998-06-15 06:53:16.000000000 -0400 |+++ qmail-1.03-6b/timeoutconn.c 2005-05-23 15:13:58.000000000 -0400 -------------------------- Patching file timeoutconn.c using Plan A... Hunk #1 succeeded at 10. Hunk #2 succeeded at 79. done |
|
# # |
make man make setup check |
| # | ./config-fast bsd.localhost |
make setup check and then start qmail again. This by any means won't fix everything but leaving the qmail files there won't hurt a bit. One last thing to recommend is going into /var/qmail/control/locals and making sure that file is empty. If you need a good explanation as to why to do this, take a look at How to use rcpthosts and locals.UCSPI-TCP
UCSPI-tcp is a set of command-line tools for building TCP-based client/server applications. They are compliant to UCSPI, the UNIX Client-Server Program Interface. UCSPI tools are available for several different types of networks. For more information, please see http://cr.yp.to/ucspi-tcp.html.|
# # |
cd /usr/ports/sysutils/ucspi-tcp make install clean |
rblsmtp with uscpi, that is completely up to you. By experience alone, I can tell you enabling rbls will dramatically decrease the amount of spams you get. If you have or plan to have a large email server, this will definitely help in the long run. The last option SSL is optional so if you plan on adding things like POP or SMTP with SSL, now is the time to do it. You can always install ucspi-ssl later on if you decide not to install it at this time.EZMLM-IDX
Ezmlm-idx is a mailing list addon. It is the best (in my opinion) mailing list option out there. It works quite well with qmailadmin, which we will install later in the guide, and works seamlessly with qmail. For more information, Please see http://www.ezmlm.org/.|
# # |
cd /usr/ports/mail/ezmlm-idx make install clean |
/usr/local/etc/ezmlm to "ezmlmglrc", "ezmlmrc" and "ezmlmsubrc" respectively.|
# # # |
cp /usr/local/etc/ezmlm/ezmlmglrc.sample /usr/local/etc/ezmlm/ezmlmglrc cp /usr/local/etc/ezmlm/ezmlmrc.sample /usr/local/etc/ezmlm/ezmlmrc cp /usr/local/etc/ezmlm/ezmlmsubrc.sample /usr/local/etc/ezmlm/ezmlmsubrc |
Qmail-Autoresponder
qmail-autoresponder is a program that allows you to setup responders for forwarding and mailing robots in qmailadmin. For more information, please see http://untroubled.org/qmail-autoresponder/.|
# # |
cd /usr/ports/mail/qmail-autoresponder make install clean |
Vpopmail
Let's get started! One of the first things we need to do is fetch the tarball which contains the vpopmail skel(eton) files. Why do we need this you say? In laymans terms, rather than having vpopmail make a basic Maildir with new, cur and tmp in it, we are going to replace that with a completely customized Maildir. The next few commands will fetch the tarball, extract it in the correct place and then chown and chmod it.|
# # # # # # |
cd ~vpopmail fetch http://freebsdrocks.net/files/skel.tgz tar zxvf skel.tgz chown -R vpopmail:vchkpw skel/ chmod 700 skel/ rm skel.tgz |
/usr/local/vpopmail so we're going to delete that folder and symlink it to ~vpopmail:|
# # # |
cd /usr/local rm -dfr vpopmail ln -s ~vpopmail /usr/local/vpopmail |
/usr/ports/mail/vpopmail/files folder and then download the patch into it so it's applied automagically!|
# # |
cd /usr/ports/mail/vpopmail/files fetch http://freebsdrocks.net/files/patch-vpopmail-skel.patch |
|
# # |
cd /usr/ports/mail/vpopmail make CONFIGURE_ARGS="--enable-logging=p" |
| # | make install |
Maildrop
Maildrop is a replacement for your local mail delivery agent and is similar to mail/procmail. For more information, please see http://www.courier-mta.org/maildrop/.|
# # |
cd /usr/ports/mail/maildrop make install clean |
.qmail file within the users virtual maildir tells maildrop to log in /var/log/qmail/maildrop using multilog. Let's create the directory and then give it proper ownership:|
# # # # |
cd /var/log/ mkdir maildrop chmod 1755 maildrop chown vpopmail:vchkpw maildrop |
Uninstalling Sendmail
Type in the following commands to eliminate sendmail from being called on your box:|
# # # |
killall sendmail mv /usr/sbin/sendmail /usr/sbin/sendmail.old chmod 0 /usr/sbin/sendmail.old |
/etc/rc.conf like so:|
# # # # |
echo "sendmail_enable=NONE" >> /etc/rc.conf echo "sendmail_submit_enable=NO" >> /etc/rc.conf echo "sendmail_outbound_enable=NO" >> /etc/rc.conf echo "sendmail_msp_queue_enable=NO" >> /etc/rc.conf |
/etc/make.conf like so:|
# # |
echo "NO_SENDMAIL=yes" >> /etc/make.conf echo "NO_MAILWRAPPER=yes" >> /etc/make.conf |
|
# # |
ln -s /var/qmail/bin/sendmail /usr/sbin/sendmail ln -s /var/qmail/bin/sendmail /usr/lib/sendmail |
Configuration
Qmail
Getting this part of qmail going is, well, going to be a little rough. We need to download the scripts for qmail-smtpd, qmail-send, and qmail-pop3d. We will start with making all the needed directories and stuff like that so let's get to it!|
# # # # # # |
cd ~root mkdir qmail cd qmail fetch http://freebsdrocks.net/files/scripts.tgz tar zxvf scripts.tgz rm scripts.tgz |
smtpd_run. We are going to want to setup smtp-auth with TLS on port 25 so we will configure it like so:IP=1.2.3.4 - Substitute your own IP address. Do not leave this set to 0 without a good reason.PORT=25 - Set the port number we will be listening on.SSL=0 - Do not run an SSL-only service.FORCE_TLS=0 - Refuse to accept mail from clients who have not done STARTTLS.DENY_TLS=0 - Do not refuse to process the STARTTLS command.AUTH=1 - Allow the AUTH command after STARTTLS has been completed.REQUIRE_AUTH=0 - Refuse to accept mail from clients who have not done AUTH.Note: Since there are a lot of commands here, I decided to make a little script for it.
|
# # # # # |
fetch http://freebsdrocks.net/files/qmail.sh chmod 755 qmail.sh ./qmail.sh cd ~root rm -dfr qmail |
|
# # # |
echo postmaster@domain.xxx >/var/qmail/alias/.qmail-root echo postmaster@domain.xxx >/var/qmail/alias/.qmail-postmaster echo postmaster@domain.xxx >/var/qmail/alias/.qmail-mailer-daemon |
| # | vi /var/qmail/supervise/qmail-pop3d/run |
|
# # # # |
mkdir /etc/tcp/ cd /etc/tcp fetch http://freebsdrocks.net/files/etc-tcp-makefile mv etc-tcp-makefile Makefile |
/var/qmail/supervise/qmail-smtpd/run file in the /etc/tcp/smtp file. Let's say the IP you used was 192.168.9.1. The line should look like this:|
192.168.9.1:allow,RELAYCLIENT="" |
| # | vi /etc/tcp/smtp |
|
127.:allow,RELAYCLIENT="" :allow |
| # | gmake |
|
tcprules smtp.cdb smtp.tmp < smtp chmod 644 smtp.cdb smtp |
|
# # # |
cd ~vpopmail/bin chmod 6711 vchkpw chown vpopmail:vchkpw vchkpw |
Qmail with TLS
We need to install ucspi-ssl so qmail will accept smtp connections with ssl. We can do that like so:|
# # |
cd /usr/ports/sysutils/ucspi-ssl make install clean |
/var/qmail/control/servercert.pem file. This file contains the public and private keys used to set up SSL or TLS encryption. It should be readable to the userid which your "qmail-smtpd" program runs as (which is normally the "qmaild" user).|
# # |
cd /var/qmail/control openssl req -newkey rsa:1024 -x509 -nodes -days 3650 -out servercert.pem -keyout servercert.pem |
Note: The common name must be the name of the mail server so make sure you enter it on that line.
|
Country Name (2 letter code) [AU]:US State or Province Name (full name) [Some-State]:State ocality Name (eg, city) []:City Organization Name (eg, company) [Internet Widgits Pty Ltd]: Organizational Unit Name (eg, section) []: Common Name (eg, YOUR name) []: THIS IS YOUR EMAIL SERVER NAME Email Address []:user@domain.xxx |
| # | chown root:nofiles servercert.pem |
|
# # # |
chmod 640 servercert.pem cp servercert.pem clientcert.pem chown root:qmail clientcert.pem |
| # | chmod 640 clientcert.pem |
|
# # |
rehash qmailctl start |
|
Starting qmail... Starting qmail-send Starting qmail-smtpd Starting qmail-pop3d |
| # | qmailctl stat |
|
/service/qmail-send: up (pid 87953) 344 seconds /service/qmail-send/log: up (pid 87955) 344 seconds /service/qmail-smtpd: up (pid 87957) 344 seconds /service/qmail-smtpd/log: up (pid 87958) 344 seconds /service/qmail-pop3d: up (pid 87954) 344 seconds /service/qmail-pop3d/log: up (pid 87956) 344 seconds messages in queue: 0 messages in queue but not yet preprocessed: 0 |
SpamAssassin
SpamAssassin is a mail filter which attempts to identify spam using text analysis and several internet-based realtime blacklists. Additional drop-in rule sets are available at http://wiki.apache.org/spamassassin/CustomRulesets. The official SpamAssassin website is at http://spamassassin.apache.org/.|
# # |
cd /usr/ports/mail/p5-Mail-SpamAssassin make install |
| # | /usr/ports/mail/p5-Mail-SpamAssassin/work/Mail-SpamAssassin-3.x.x/build/check_dependencies |
/usr/local/etc/mail/spamassassin/v310.pre. All you need to do is install the perl module for it and then uncomment it in v310.pre. Pretty easy to do.|
# # |
cd /usr/ports/mail/p5-Mail-SpamAssassin make clean |
/usr/local/etc/mail/spamassassin/, you will see four files. Two of them are .sample files and the two others are your SpamAssassin global options. init.pre and v310.pre have many different options to choose from. Enable them at your leisure. We will not be going over them as they are optional settings.|
# # # |
cd /usr/local/etc/mail/spamassassin/ cp local.cf.sample local.cf vi local.cf |
rewrite_header Subject - Leave this commented (#). We will configure qmail-scanner to rewrite the subject for us.report_safe - Leave this commented. This just leaves the message as Spam or Ham and does not save it as an attachment.trusted_networks - Leave this commented. We define this globally in qmail in the /etc/tcp/smtp file.lock_method flock - Leave this commented.required_score - Uncomment this and set this to around 4.3 or so. I have mine set at 3.9 right now and seems to be catching a lot of spams.use_bayes - Leave this commented. We will configure bayes later in the guide.bayes_auto_learn - Leave this also commented. See use_bayes.bayes_ignore_header - Leave these commented. I really don't have a clue as to what this is even used for.|
# # |
cd /usr/local/etc/rc.d vi sa-spamd |
|
: ${spamd_flags="-c "} |
|
: ${spamd_flags="-c -u qscand "} |
| # | echo 'spamd_enable="YES"' >> /etc/rc.conf |
| # | spamassassin --lint |
|
warn: config: created user preferences file: /tmp/.spamassassin/user_prefs |
| # | /usr/local/etc/rc.d/sa-spamd start |
|
Starting spamd. |
| # | /usr/local/etc/rc.d/sa-spamd status |
|
spamd is running as pid [pid] |
ClamAV
Clam Antivirus is command line virus scanner written entirely in C and its database is kept up-to-date. For more information, please see: http://www.clamav.net/|
# # |
cd /usr/ports/security/clamav make install clean |
| # | vi /usr/local/etc/clamd.conf |
Example - needs be commented (#)LogFile - should be uncommented and set to /var/log/clamav/clamd.log
LogTime - should be uncommmentedLogSyslog - should be uncommentedUser - should be uncommented and set to qscandScanMail - should be uncommented| # | vi /usr/local/etc/freshclam.conf |
Example - needs be commented (#)DatabaseDirectory - should be uncommented and set to /var/db/clamav/DatabaseOwner - change from clamav to qscand|
# # # |
chown -R qscand:qscand /var/log/clamav chown -R qscand:qscand /var/run/clamav/ chown qscand:qscand /var/db/clamav/ |
|
# # # |
rm /usr/local/etc/rc.d/clamav-freshclam rehash freshclam |
|
ClamAV update process started at Wed Nov 30 22:49:29 2005 main.cvd is up to date (version: 34, sigs: 39625, f-level: 5, builder: tkojm) daily.cvd is up to date (version: 1198, sigs: 1667, f-level: 6, builder: diego) |
| # | crontab -e |
|
* 1,12 * * * /usr/local/bin/freshclam --quiet -l /var/log/clamav/clam-update.log |
/var/log/clamav/clam-update.log.| # | echo 'clamav_clamd_enable="YES"' >> /etc/rc.conf |
|
# # |
/usr/local/etc/rc.d/clamav-clamd start /usr/local/etc/rc.d/clamav-clamd status |
|
clamav_clamd is running as pid [pid] |
QmailScanner
Qmail-Scanner is e-mail content scanner that enables a qmail server to scan all messages it receives for certain characteristics (normally viruses), and react accordingly. For more information see http://qmail-scanner.sourceforge.net/.|
# # |
cd /usr/ports/mail/qmail-scanner/ make extract |
|
# # # # # # |
cd work fetch http://freebsdrocks.net/files/qms-analog-0.4.2.tar.gz tar zxvf qms-analog-0.4.2.tar.gz cd qms-analog-0.4.2 gmake all cp qmail-scanner-1.25-st-qms-YYYYMMDD.patch ../qmail-scanner-1.25 |
|
# # |
cd ../qmail-scanner-1.25 patch -p1 < qmail-scanner-1.25-st-qms-YYYYMMDD.patch |
| # | vi qms-config |
|
./configure --domain domain.com --admin postmaster --local-domains "yourdomain.com,yourotherdomain.com" --add-dscr-hdrs yes --dscr-hdrs-text "X-Antivirus-MYDOMAIN" --ignore-eol-check yes --sa-quarantine 0 --sa-delete 0 --sa-reject no --sa-subject ":SPAM:" --sa-delta 0 --sa-alt yes --sa-debug no --notify admin "$INSTALL" |
|
# # |
chmod 755 qms-config ./qms-config |
|
Finished. Please read README(.html) and then go over the script to check paths/etc, and then install as you see fit. Remember to copy quarantine-attachments.txt to /usr/local/qmailscan and then run "qmail-scanner-queue.pl -g" to generate DB version. |
| # | /usr/local/bin/qmail-scanner-queue.pl -g |
Note: If you see an error saying "CANNOT EVEN RUN A SIMPLE SETUID SCRIPT" that means you did not enable Perl with Setuid. Bad news: You will have to make deinstall SpamAssassin, Clamav, and qmail-scanner and start those steps all over again.
Now let's install it providing the above worked flawlessly:| # | ./qms-config install |
/var/qmail/bin. Go ahead and hit enter on the keyboard when it asks.Updating the qmail-scanner version files
The first one is the command that updates your version files. It updates your headers when you upgrade ClamAV or SpamAssassin. It also helps keep the/var/spool/qmailscan folder clear when SMTP sessions are dropped. I would HIGHLY suggest putting this in cron and running it once a day. If you don't, you'll see an error pop up frequestly in /var/log/maillog.| # | setuidgid qscand /var/qmail/bin/qmail-scanner-queue.pl -z |
| # | setuidgid qscand /var/qmail/bin/qmail-scanner-queue.pl -g |
|
perlscanner: generate new DB file from /var/spool/qmailscan/quarantine-attachments.txt perlscanner: total of 81 entries. |
| # | chown -R qscand:qscand /var/spool/qmailscan |
| # | /usr/ports/mail/qmail-scanner/work/qmail-scanner-1.25/contrib/test_installation.sh -doit |
/var/spool/qmailscan/quarantine, one message in ~vpopmail/domains/domain.xxx/postmaster/Maildir/new and one in your ~vpopmail/domains/domain.xxx/postmaster/Maildir/.Spam/new folder.E-Mail Client Setup
Thunderbird
Click File, click New and click Account








Microsoft Outlook
Click Tools and click E-mail Accounts




Outlook Express
Click "Tools" and then click on "Accounts"









Optional Configuration
This next section is optional. If you want to have web based interfaces for adding users and domains, please continue on.Courier-IMAP
Courier-IMAP is a server that provides IMAP access to Maildir mailboxes. This IMAP server does not handle traditional mailbox files (/var/spool/mail, and derivatives). It was written for the specific purpose of providing IMAP access to Maildirs. For more information, please visit http://www.courier-mta.org/imap/.|
# # # # # # |
echo "WITHOUT_X11=yes" >> /etc/make.conf echo "NO_X=yes" >> /etc/make.conf cd /usr/ports/lang/expect make install clean cd /usr/ports/mail/courier-imap make install clean |
|
# # |
cd /usr/ports/security/courierpassd make install clean |
/usr/local/etc/rc.d folder:| # | rm /usr/local/etc/rc.d/courier-authdaemond |
/etc/rc.conf
|
enable_courier-authdaemond=YES |
/var/qmail/supervise as the physical location for my service directories, you can use whatever you like except that it cannot be /service itself. The examples below will assume you are using /var/service like I did- if you are using something different, adjust the paths where appropriate.|
# # # # # # # # # # # |
cd /var/qmail/supervise mkdir -m 1755 courier-passwd cd courier-passwd fetch http://freebsdrocks.net/files/service-courierpassd-run mv service-courierpassd-run run chmod 755 run mkdir -m 755 log cd log fetch http://freebsdrocks.net/files/service-any-log-run mv service-any-log-run run chmod 755 run |
| # | ln -s /var/qmail/supervise/courier-passwd /service/courier-passwd |
| # | svstat /service/courier-passwd/ |
|
# # # |
cd /usr/local/etc/courier-imap cp imapd.cnf.dist imapd.cnf cp imapd-ssl.dist imapd-ssl |
| # | /usr/local/share/courier-imap/mkimapdcert |
| # | vi /usr/local/etc/authlib/authdaemonrc |
|
authmodulelist="authvchkpw" |
|
# # # # # # # # # # # |
cd /var/qmail/supervise mkdir -m 1755 courier-authdaemond cd courier-authdaemond fetch http://freebsdrocks.net/files/courier-authdaemond-run mv courier-authdaemond-run run chmod 755 run mkdir -m 755 log cd log fetch http://freebsdrocks.net/files/service-any-log-run mv service-any-log-run run chmod 755 run |
/service
| # | ln -s /var/qmail/supervise/courier-authdaemond /service/courier-authdaemond |
/usr/local/etc/rc.d:|
# # |
rm /usr/local/etc/rc.d/courier-imap-imapd.sh rm /usr/local/etc/rc.d/courier-imap-imapd-ssl.sh |
/etc/rc.conf
|
enable_courer-imap-imapd=YES enable_courer-imap-imapd-ssl=YES |
/etc/rc.conf. Now we want to make service directories for courier-imap just like you did for courierpassd|
# # # # # # # # # # # |
cd /var/qmail/supervise mkdir -m 1755 courier-imap cd courier-imap fetch http://freebsdrocks.net/files/courier-imap-run mv courier-imap-run run chmod 755 run mkdir -m 755 log cd log fetch http://freebsdrocks.net/files/service-any-log-run mv service-any-log-run run chmod 755 run |
| # | ln -s /var/qmail/supervise/courier-imap /service/courier-imap |
/service/courier-imap and make sure its running for more than 1 or 2 seconds.|
# # # # # # # # # # # |
cd /var/qmail/supervise mkdir -m 1755 courier-imap-ssl cd courier-imap-ssl fetch http://freebsdrocks.net/files/courier-imap-ssl-run mv courier-imap-ssl-run run chmod 755 run mkdir -m 755 log cd log fetch http://freebsdrocks.net/files/service-any-log-run mv service-any-log-run run chmod 755 run |
| # | ln -s /var/qmail/supervise/courier-imap-ssl /service/courier-imap-ssl |
|
# # # |
cd /var/qmail/bin fetch http://freebsdrocks.net/files/imapctl chmod 755 imapctl |
imapctl stat, you should get a output for imap related services. Very cool, huh? Once the courier daemons are started, we are all done here! WOOT!QmailAdmin
QmailAdmin is a cgi program for administering Qmail with vchkpw. It provides a web interface to create users, aliases, install ezmlm lists, and also configure mailing robots. For more information, please see http://www.inter7.com/qmailadmin/.|
# # # # # |
cd /usr/ports/mail/qmailadmin make CONFIGURE_ARGS="--enable-modify-spam=Y \ --enable-spam-command='|preline /usr/local/bin/maildrop mailfilter | \ multilog t s1000000 n20 /var/log/maildrop' --enable-cgibindir=/path/to/cgi-bin --enable-htmldir=/path/to/www \ --enable-imagedir --enable-help --enable-autoresponder-path=/usr/local/bin/qmail-autoresponder" |
| # | make install |
| # | vi /usr/local/share/qmailadmin/html/add_user.html |
|
<input type="checkbox" name="spamcheck"> |
|
<input type="checkbox" name="spamcheck" checked> |
|
# # |
cd /usr/ports/mail/qmailadmin make clean |
~vpopmail/bin/vadddomain.vQadmin
vqadmin is a web based cgi program. It allows system administrators to perform actions which require root access. The cgi is authenticated using Apache style htpasswd files. Root access is required for adding and deleting domains. A user based ACL provides control over what actions can be performed, such as adding/deleting a domain. Accessing user email account information to allow modification of user passwords and quotas. Account service restrictions include enabling or disabling of pop access, authentication based smtp relay control, courier-imap access and sqwebmail access.|
# # # |
cd /usr/ports/mail/vqadmin make CONFIGURE_ARGS="--enable-cgibindir=/usr/local/www/cgi-bin --enable-htmldir=/usr/local/www" make install clean |
|
# # |
cd /path/to/your/cgi-bin/vqadmin vi .htaccess |
AuthUserFile to the path where you will put the .htpasswd file. You can put this file anywhere on your system but I do not recommend that you put it into your www or cgi-bin folders. This is very insecure if you do that.|
AuthType Basic AuthUserFile /path/to/where/you/want/to/store/the/password/file/.htpasswd AuthName vQadmin require valid-user satisfy any |
.htaccess file so only the Apache user can read it. You may need to change the chown to either "nobody", "apache", or "www" etc., depending on what user your installation of Apache is running as:| # | chown www .htaccess |
admin_password below to a password you choose to use to login to the site.| # | htpasswd -bc /path/to/where/you/want/to/store/the/password/file/.htpasswd admin admin_password |
|
<Directory "/path/to/your/cgi-bin/vqadmin"> deny from all Options ExecCGI AllowOverride AuthConfig Order deny,allow </Directory> |
|
# # |
apachectl restart chmod 644 /path/to/where/you/want/to/store/the/password/file/.htpasswd |
Squirrelmail
SquirrelMail is a standards-based webmail package written in PHP4. It includes built-in pure PHP support for the IMAP and SMTP protocols, and all pages render in pure HTML 4.0 (with no Javascript) for maximum compatibility across browsers. It has very few requirements and is very easy to configure and install. SquirrelMail has all the functionality you would want from an email client, including strong MIME support, address books, and folder manipulation. For more information, please see http://www.squirrelmail.org.|
# # |
cd /usr/ports/mail/squirrelmail make install clean |
/usr/local/www and install all required modules. Now what we will want to do is symlink the webmail location. The reason why we are doing it this way is because we won't want to move the squirrelmail folder to your webmail location as that will make portupgrading harder for you. If we symlink it, it's kinda like an alias.| # | ln -s /usr/local/www/squirrelmail/ /path/to/your/www/webmail |
|
# # |
cd /path/to/webmail/config ./conf.pl |
1 - Organization Preferences, any one of the settings inside this window are optional. When you are done, hit S to save and then hit Enter and then hit R to go back to the Main Menu.2 - Server settings. Hit 1 for Domain and hit Enter on the keyboard. You can type the name of the server, the local IP, or public IP, whichever you prefer. If your mailserver is behind a router/firewall, I use the local IP. If you are on the public side of things, the hostname or the static IP will work fine. If you are using a dyndns service like dyndns.org, I would highly suggest using the local IP and putting your qmail server behind a router/firewall.Update SMTP Settings and hit Enter. Please verify the following settings:|
SMTP Settings ------------- 4. SMTP Server : hostname 5. SMTP Port : 25 6. POP before SMTP : false 7. SMTP Authentication : none 8. Secure SMTP (TLS) : false 9. Header encryption key : |
your-squirrelmail-location with your ip or your hostname. This will tell you if squirrelmail is setup correctly. If you see this:|
ERROR: Error connecting to SMTP server "localhost:25".Server error: (0) Unknown error: 0 |
Upgrading and Maintaining the Qmail System
Upgrading your ports and maintaining them are pretty easy. The first thing I would recommend is installing portupgrade from/usr/ports/sysutils/portupgrade. Once that is installed, you can run man portupgrade or just run portupgrade -r name. The -r switch means to upgrade everything recursively. Recurvisly meaning all of it's dependancies, or more simply, anything the program requires. You can do this for anything else not related to qmail or any of its programs. So for instance portupgrade -r kde, it will upgrade kde and all it's dependancies.Qmail
Qmail doesn't require any type of upgrades. Qmail hasn't been upgraded since 1997 or 1998 but it is very stable and very secure.UCSPI-TCP
Pretty much the same as qmail. I don't think has changed at all. Quite honestly, I have never upgraded it and I haven't ever had a problem with running any old/previous versions.Daemontools
Again, Pretty much the same as qmail or UCSPI-TCP.Ezmlm-idx
This can change from time to time. I would first backup your list which resides in~vpopmail/domains/domain.xxx/listname before upgrading the port. Then upgrade it.| # | portupgrade -r ezmlm-idx |
Qmail-Autoresponder
This can be upgraded when new versions come out. In most cases the following works fine:| # | portupgrade -r qmail-autoresponder |
Vpopmail
Portupgrading this can go great or it can really screw up your system. Before running a portupgrade I would highly recommend backing up the entire ~vpopmail folder. If you have the patch file inside/usr/ports/mail/vpopmail/files, things should go okay. I have yet to have run a portupgrade -r vpopmail on my box as I have the latest version. Vpopmail doesn't change too frequently but check it for any Vulnerabilites.|
# # # |
cd ~vpopmail/bin chmod 6711 vchkpw chown vpopmail:vchkpw vchkpw |
SpamAssassin
When I have run portupgrades with Spamassassin in the past, I usually don't run into any issues except the upgrade from 2.6x to 3.0.1. There were quite a few changes from version to version including some of the required modules that were new, like the SPF addon for it and such. If you do run a portupgrade on Spamassassin, I would go to Spamassassins website (http://www.spamassassin.org) and read the README files under the download section of the site. There it will tell you any changes/modifications that have been done since the previous version. I would also check the rules under/usr/local/etc/mail/spamassassin file, specifically local.cf, to see if any additions or deletions were made.|
# # |
setuidgid qscand /var/qmail/bin/qmail-scanner-queue.pl -z setuidgid qscand /var/qmail/bin/qmail-scanner-queue.pl -g |
ClamAV
ClamAV is probably the worst one out of all of them all but I make it easy for you. ClamAV changes almost every three months, possibly sooner. I would recommend backing up theclamd.conf and freshclam.conf in /usr/local/etc, upgrade, and then change the ownerships.|
# # # # # # |
cp /usr/local/etc/clamd.conf ~ cp /usr/local/etc/freshclam.conf ~ portupgrade -r clamav chown -R qscand:qscand /var/log/clamav chown -R qscand:qscand /var/run/clamav/ chown qscand:qscand /var/db/clamav/ |
clamd.conf and freshclam.conf back to /usr/local/etc and then run freshclam to make sure everything is working perfectly. Restart clamd and then we will need to update the qmail-scanner database.|
# # # # # # |
cp ~/clamd.conf /usr/local/etc cp ~/freshclam.conf /usr/local/etc freshclam /usr/local/etc/rc.d/clamav-clamd restart setuidgid qscand /var/qmail/bin/qmail-scanner-queue.pl -z setuidgid qscand /var/qmail/bin/qmail-scanner-queue.pl -g |
Qmail-scanner
At the time of this writing, I would not recommend doing a portupgrade of qmail-scanner. There are a few reasons why. First, it does not even register with the packages system as we run the configure commands manually. Second, we manually patch it with the qms-analog patch to get the nifty qmail-analog reports. So if a new vesion of qmail-scanner is released, I will update the documentation within a few days of it being released.Courier-imap
Upgrading this shouldn't be too bad. What I would suggest doing is backing up the files, upgrade courier-imap, and copy the backup files back over.|
# # # |
cp -R /usr/local/etc/courier-imap ~ portupgrade -r courier-imap cp -R ~/courier-imap /usr/local/etc |
Qmailadmin
This is something else I wouldn't recommend doing a portupgrade on. When the new version comes out just run through the guide as normal only using the newest version from ports after running the following command. It just can't get any easier than that!|
# # |
cd /usr/ports/mail/qmailadmin make deinstall |
vqAdmin
Nothing needs to be backed up here. Follow the guide when the the new version comes out after running:|
# # |
cd /usr/ports/mail/vqadmin make deinstall |
Squirrelmail
This one is a rarity but every so often a squirrelmail upgrade does come up and if it does, backup your squirrelmail folder and then run| # | portupgrade -r squirrelmail |
Author: Bill
wolson at gmail dot com