Blue Flower

Monday, 06 July 2015 00:40

Understanding rcpthosts and locals

Written by

rcpthosts - domains that we accept mail for - mostly used for vpopmail virtual domains that reside in /home/vpopmail/domains

If rcpthosts does not exist, you are an open relay. If it exists and is empty and there is no "morercpthosts.cdb" file as well, then your server will reject all incoming mail.

locals - domains that we deliver locally - mostly used for local delivery /home/$USER/Maildir

What to put in rcpthosts and locals: domain names
What NOT to put in rcpthosts: IP Addresses

Taken from http://www.lifewithqmail.org

Monday, 06 July 2015 00:39

Using POP before SMTP

Written by

Just skip the jsauth smtp patch and compile vpopmail with: ./configure --enable-roaming-users

Monday, 06 July 2015 00:39

How to access the qmail manpages

Written by

To add the qmail manpages, edit the following files:

For Bash (/etc/profile)
MANPATH=/var/qmail/bin:$MANPATH

For *sh (/etc/csh.login for csh and /etc/.cshrc for tcsh)
setenv MANPATH "/var/qmail/bin:${MANPATH}

Please logout and log back in for those settings to take effect or type 'source ~/.cshrc'
if you're using tcsh

Monday, 06 July 2015 00:38

How to setup qmail graphs with MRTG

Written by

How to get the qmail graphs working with mrtg.
graphs inclue rbl, validrcptto, jgreylist, and more
By William Olson http://freebsdrocks.net http://goodcleanemail.com
------------------------------------------------------------------

# cd /path/to/stats
# fetch http://www.goodcleanemail.com/files/tarballs/qmailmrtg2.tgz
# tar zxvf qmailmrtg2.tgz

Run the following commands to start the graphs at 0

# echo "     0" > /tmp/rbl-found
# echo "     0" > /tmp/valid-found
# echo "     0" > /tmp/jgrey-found
# echo "     0" > /tmp/vir-found

Edit the following files and change the "hostname" to your host in each file at the bottom
the uptime might need to be edited to work on your box

Note: When you are editing mrtg-clam, please note the location of the log file. If you are not using
the setup for FreeBSDrocks.net, this path may need to be changed to /var/log/clamav/clamd.log

mrtg-clam
mrtg-jgrey
mrtg-rbl
mrtg-valid

Now to set the correct file permissions:

# chmod 755 mrtg-clam
# chmod 755 mrtg-jgrey
# chmod 755 mrtg-rbl
# chmod 755 mrtg-valid

Now open up qmailmrtg.cfg and change the WorkDir at the top to the folder where the qmailmrtg will be saved
Change each instance of myhostname to your mailserver name or ip or whatever. Easiest way is to do it like so:

:%s/myhostname/newhostname/g

This is just a find and replace script. What this does is it replaces all instances of myhostname with newhostname

Scroll down to the end of qmailmrtg.cfg and change the following lines:

Target[clam]: `/path/to/stats/mrtg-clam`
Target[valid]: `/path/to/stats/mrtg-valid`
Target[rbl]: `/path/to/stats/mrtg-rbl`
Target[jgrey]: `/path/to/stats/mrtg-jgrey`

run /usr/local/bin/mrtg qmailmrtg.cfg and just make sure you don't have any errors.

Now to put the stats in cron:

*/5 * * * * /usr/local/bin/mrtg /path/to/qmailmrtg.cfg > /dev/null 2>&1

After about 15-20 minutes you should start seeing graphs.

Now to clean up the install:

# cd /path/to/stats
# rm qmailmrtg2.tgz
# rm install-*

Monday, 06 July 2015 00:36

How to enable bayes autolearning

Written by

Updated 2/9/10: Updated links so they worked correctly. Removed the references for maildrop and procmail spam filtering as they are now obsoleted.

There are a few things you need to train spamassassin to do before bayes can start learning how to tell the difference between spam and non-spam. The more you train bayes, the better the learning algorithm.

Before continuing on I want to let you know about 1 thing. If you are running the freebsdrocks spamd service, you do not have to change spamd to a non-root user. The service is configured to run as user qscand. Please skip down to the section that starts First to make sure bayes can be turned on, bayes needs to be trained for 200 hams and 200 spams. Run the following command:

Before starting with Bayes, one of the things I would suggest is running SpamAssassin as a non-root account. You can do this by adding an option to the spamd.sh startup script. Edit your SpamAssassin startup script and look for the following line. I give 2 different options depends on what version of SpamAssassin you're running.

Option 1: spamd_flags=${spamd_flags:-"-d -x -r ${spamd_pidfile} "}
Option 2: : ${spamd_flags="-c  "}

Add the -u qscand to make SpamAssassin run as user qscand:

Option 1: spamd_flags=${spamd_flags:-"-u qscand -d -x -r ${spamd_pidfile} "}
Option 2: : ${spamd_flags="-c -u qscand "}

The path or flags file may vary from system to system. When you are done, save and exit and restart spamd. All your spamd processes should now run as qscand.

First to make sure bayes can be turned on, bayes needs to be trained for 200 hams and 200 spams. Run the following command:

# sa-learn --dump magic

0.000 0 5752 0 non-token data: nspam
0.000 0 1702 0 non-token data: nham

As you can see from the above example, I have 5752 spams and 1702 hams
The spam and ham totals must be at least 200 each.

The nspam total is the total amount of spams Bayes has learned.
The nham total is the total amount of hams Bayes has learned.

Here is how to train SpamAssassin hams and spams.

There are a few ways to feed sa-learn spams and hams. The easiest way is
by running the command right from console. Lets just say that you have a
folder in ~vpopmail/domains/domain.ext/test/Maildir/spam. Run the sa-learn
command like so. Replace domain.ext with your domain andreplace user with the actual user on your system :

# sa-learn --spam ~vpopmail/domains/domain.ext/user/Maildir/.Spam/new

To learn hams in ~vpopmail/domains/domain.ext/user/Maildir/new, run

# sa-learn --ham ~vpopmail/domains/domain.ext/user/Maildir/new

You'll get an output similar to the following in wither either case. Actual messages numbers may vary.

Learned from 30 message(s) (30 message(s) examined).

This tells you that out of 30 messages in the new folder, 30 were learned. If you run sa-learn --dump magic, your nspam total will have 30 more new messages learned as spam.

You basically need 200 hams and 200 spams before you can enable bayes autolearning. Once you have done that, add the following lines to your local.cf

# The line below needs to point to the users bayes_path that spamassassin runs as. In this case, the qscand home folder is /tmp
bayes_path /tmp/.spamassassin/bayes
use_bayes 1
bayes_auto_learn 1
bayes_file_mode 0770

The first line tells the bayes path to tell bayes where to store the bayes database. The next line enables bayes. The next line after that enables autolearning. and the next line just forces a chmod of 770 on the bayes database for security reasons.

Restart spamd and within a day or so you will see autolearn appear in your headers. I am not sure why it takes so long for it to come into the header part of the emails. It just does for some reason.

Monday, 06 July 2015 00:03

Installing and Configuring Razor and Pryzor

Written by

How to install Dcc:

# echo "WITHOUT_SENDMAIL=yes" >> /etc/make.conf
# cd /usr/ports/mail/dcc-dccd
# make install clean

Now lets install Pyzor

# cd /usr/ports/mail/pyzor
# make install clean

When the popup box comes up, Hit Tab and hit Enter on the Keyboard.

And last we need to install Razor Agents

# cd /usr/ports/mail/razor-agents
# make install clean

You will now need to create a config file for razor using a non-root
account. Substitute test with a real non-root user on your system:

# su test
# razor-admin -create (It should just drop to the next line)
# exit

We now need to register razor with the Razor servers. Replace the test
user with the actual username you used above to create the razor
account. Type in a password and hit enter.

# razor-admin -register -user=test -pass yourpass -home=/home/test/.razor

If successful, it should say:

Register successful. Identity stored in /home/user/.razor/identity-user

You can now integrate razor with SpamAssassin. Lets backup your local.cf first:

# cd /usr/local/etc/mail/spamassassin
# cp local.cf baklocal.cf

Now add/modfy the following to local.cf . Again, Replace the test user with
the actual username you used above to create the razor account.

loadplugin Mail::SpamAssassin::Plugin::DCC
dcc_path /usr/local/bin/dccproc
score PYZOR_CHECK 1

We now need to create the /var/dcc folder

# mkdir /var/dcc
# chown qscand:qscand /var/dcc
# chmod 755 /var/dcc

Just to make sure everything is running correctly, run:

# spamassassin --lint

And fix any errors that come up!

We're done!

Page 16 of 23