1) ensure that the proper USE flags are set
Code: Select all
> nano -w /etc/make.conf
add apache2, maildir, and mysql as USE flags.Code: Select all
First of all, make sure that you unmerge the other mail handlers that may be installed, such as ssmtp, sendmail, or postfix:
> emerge -C ssmtp sendmail postfix
> emerge /usr/portage/net-mail/qmail/qmail-1.03-r13.ebuild
> ebuild /var/db/pkg/net-mail/qmail-1.03-r13/qmail-1.03-r13.ebuild config
> ln -s /var/qmail/supervise/qmail-send /service/qmail-send
> ln -s /var/qmail/supervise/qmail-smtpd /service/qmail-smtpd
> rc-update add svscan default
> /etc/init.d/svscan startCode: Select all
> emerge /usr/portage/net-mail/vpopmail/vpopmail-5.4.0.ebuild
First log into mysql as your mysql root user and pass. Then:
> create database vpopmail;
> use mysql;
> grant select, insert, update, delete, create, drop on vpopmail.* to vpopmail@localhost identified by 'your password';
> flush privileges;
If you have problems with vpopmail not accepting mail properly,
please ensure that /etc/vpopmail.conf is chmod 600 and
owned by vpopmail:vpopmailCode: Select all
> emerge /usr/portage/net-mail/courier-imap/courier-imap-3.0.2-r1.ebuild
> nano -w /etc/courier-imap/authdaemonrc
authmodulelist="authvchkpw"
> nano -w /etc/courier-imap/imapd
IMAPDSTART=YES
AUTHMODULES="authvchkpw"
> nano -w /etc/courier-imap/pop3d
POP3DSTART=YES
AUTHMODULES="authvchkpw"
> rc-update add courier-imapd default
> rc-update add courier-pop3d default
> /etc/init.d/courier-imapd start
> /etc/init.d/courier-pop3d startCode: Select all
> nano -w /var/qmail/control/conf-smtpd
QMAIL_SMTP_POST="mail.mydomain.com /var/vpopmail/bin/vchkpw /bin/true"
> svc -t /var/qmail/supervise/qmail-smtpd
> chmod u+s /var/vpopmail/bin/vchkpw
The following step makes sending mail a lot faster under some circumstances, and I highly recommend that you do the following if you notice delays of 30 to 45 seconds sending mail:
> nano -w /var/qmail/control/conf-common
TCPSERVER_OPTS="-H -R -l 0" (that's lower-case L followed by zero)
Code: Select all
> emerge /usr/portage/dev-python/pyzor/pyzor-0.4.0-r1.ebuild
> emerge /usr/portage/net-mail/razor/razor-2.40.ebuild
> emerge /usr/portage/net-mail/dcc/dcc-1.2.28.ebuildCode: Select all
> emerge /usr/portage/app-antivirus/f-prot/f-prot-4.4.2.ebuild
> emerge /usr/portage/dev-perl/Mail-SpamAssassin/Mail-SpamAssassin-2.63.ebuild
> nano -w /etc/conf.d/spamd.conf
SPAMD_OPTS="-d -u vpopmail -v -x -C /etc/mail/spamassassin/local.cf"
> rc-update add spamd default
> /etc/init.d/spamd start
You'll want to set up a cron.hourly job to update the f-prot definitions automatically:
> nano -w /etc/cron.hourly/virus-update.cron
#!/bin/bash
/opt/f-prot/check-updates.pl -cron -quiet
> chmod 755 /etc/cron.hourly/virus-update.cron
> crontab -e
# min hour day month weekday command
0 * * * * /etc/cron.hourly/virus-update.cron
Now to set up spam processing rules:
> nano -w /etc/mail/spamassassin/local.cf
required_hits 5.0
rewrite_subject 1
subject_tag *****SPAM*****
report_safe 1
report_header 1
use_bayes 1
auto_learn 1
skip_rbl_checks 0
use_razor2 1
use_dcc 1
use_pyzor 1
ok_languages all
ok_locales allCode: Select all
> emerge /usr/portage/net-mail/maildrop/maildrop-1.5.3-r1.ebuild
> emerge /usr/portage/net-mail/qmail-scanner/qmail-scanner-1.16-r2.ebuild
Please log into the "qmaild" account and run
/var/qmail/bin/qmail-scanner-queue.pl -g
If you see the error "Can't do setuid", or "Permission denied", then
refer to the FAQ.
(e.g. "setuidgid qmaild "/var/qmail/bin/qmail-scanner-queue.pl -g"
or "su qmaild -c "/var/qmail/bin/qmail-scanner-queue.pl -g")
The 'subject_tag' variable in /etc/mail/sendmail/local.cf does not seem to change the subject of detected spam. As a workaround, do this:
> nano -w /var/qmail/bin/qmail-scanner-queue.pl
my $spamc_subject='*****SPAM*****';
Now update tcp.smtp to activate qmail-scanner
> nano -w /etc/tcp.smtp
# Qmail-Scanner disabled for mail from localhost, relay allowed
127.0.0.1:allow,RELAYCLIENT="",RBLSMTPD="",QMAILQUEUE="/var/qmail/bin/qmail-queue"
# Qmail-Scanner enabled (virus only) for mail from local network, relay allowed
192.168.1.:allow,RELAYCLIENT="",RBLSMTPD="",QMAILQUEUE="/var/qmail/bin/qmail-scanner-queue.pl"
# Qmail-Scanner enabled (virus and spam) for mail from external internet, relay denied
:allow,QMAILQUEUE="/var/qmail/bin/qmail-scanner-queue.pl"
save tcp.smtp and then:
> tcprules /etc/tcp.smtp.cdb /etc/tcp.smtp.tmp < /etc/tcp.smtp
> chmod 644 /etc/tcp.smtp*Code: Select all
> emerge /usr/portage/net-mail/squirrelmail/squirrelmail-1.4.2-r5.ebuild
> perl /var/www/localhost/htdocs/squirrelmail/config/conf.pl
set up squirrelmail
You can also set up the vpopmail squirrelmail plugin as follows. For this to work though, you'll need to run apache as vpopmail:vpopmail by editing /etc/apache2/conf/commonapache2.conf. This may be a security risk, so follow at your own risk:
> wget http://www.squirrelmail.org/plugins/vpopmail.1.00-1.4.0.tar.gz
> cd /<your squirrelmail dir>/plugins
> tar -zxvf /<location of vpopmail.1.00-1.4.0.tar.gz>
> cd vpopmail
> nano -w config.php
$vpopmail_autorespondpath = '/usr/local/bin';
> perl /var/www/localhost/htdocs/squirrelmail/config/conf.pl
activate the vpopmail plugin
Code: Select all
> emerge /usr/portage/net-mail/ezmlm-idx-mysql/ezmlm-idx-mysql-0.40-r2.ebuild
> emerge /usr/portage/net-mail/autorespond/autorespond-2.0.4.ebuild
> emerge /usr/portage/net-mail/qmailadmin/qmailadmin-1.2.0_rc2-r1.ebuild
You can access qmailadmin from http://www.youdomain.com/cgi-bin/qmailadmin ... if the image files are not showing, you'll have to copy the qmailadmin images to wherever apache is trying to access them from. You can find out where by checking your /var/log/apache2/error_log ... note that this version still does not use valias to maintain forward/alias info, and you'll need to install 1.2.1 from source for that to work.


