Web Mail


Single IP

Project Links
resume
about me
about server
user land
webmail

Photo Albums
bpfountz
lpfountz
twice DIGITAL

Web Pages
bpfountz
lpfountz

Reviews
3054CB
Netgate Q&A
5354AP1 Aries2

You are visiting...
The DigitalPimp


created by:
 Ben Pfountz
Untitled Document
Setting Up blackhole with qmail

FreeBSD 4.9-STABLE

The Digitalpimp Collection

Ben Pfountz

Dec 29, 2004

 

Note: blackhole is a spam control program, these directions show how to use it in a mode called qmail-queue mode, which means it checks all mail being relayed through the server.

 

Note: blackhole depends on many other ports.

 

install automake from ports:

cd /usr/ports/devel/automake

make install

make clean

 

 

install autoconf from ports:

cd /usr/ports/devel/autoconf

make install

make clean

 

 

install pcre from ports:

cd /usr/ports/devel/pcre

make install

make clean

 

 

install clamav from ports:

cd /usr/ports/security/clamav

make install

make clean

 

pw groupadd clamav
pw useradd clamav -g clamav -d /nonexistent -c "Clam Antivirus" -s /sbin/nologin

 

touch /var/log/freshclam.log
chmod 644 /var/log/freshclam.log
chown clamav:clamav /var/log/freshclam.log


Create a startup and shutdown script (/usr/local/etc/rc.d/clamav.sh)for freshclam:

#!/bin/sh
   #
   # Startup / shutdown script for Clam Antivirus
case "$1"    in
   start)
   /usr/local/bin/freshclam -d -c 12 -l /var/log/freshclam.log
   echo -n ' freshclam'
   ;;
 stop)
   /usr/bin/killall freshclam > /dev/null 2>&1 \
   && echo -n ' freshclam'
   ;;
 *)
   echo ""
   echo "Usage: `basename $0` { start | stop }"
   echo ""
   exit 64
   ;;
   esac

Set the script permissions:

chmod 744 /usr/local/etc/rc.d/clamav.sh

 

Set some extra permissions for freshclam:

chown clamav /usr/local/share/clamav
chown clamav /usr/local/share/clamav/*
chmod u+w /usr/local/share/clamav/*

 

Patch and Build blackhole:

- Download or restore BlackHole.tar.gz

- Unzip and cd into blackhold directory

patch < /usr/home/bpfountz/projects/digitalpimp/patches/qmail_spam_ctl/blackhole.c.patch

(note, this patch resolves a small bug I found in the 'Received: from' filter, email me if you want it)

- Change /opt/blackhole/bin to /usr/local/bin/spamcheck in execute.h

(note, I am using /usr/home/bpfountz/projects/digitalpimp/email_filter instead, you can write your own)

- You may also need to patch for the latest arguments to clamscan (--no-summary). Use grep to search:

grep -r 'unzip=/usr/bin/unzip' *

- After doing this, you will need to update 'every' makefile with the correct path to automake:
AUTOMAKE = ${SHELL} /usr/home/bpfountz/projects/digitalpimp/patches/qmail_spam_ctl/BlackHole-1.0.9/BlackHole-1.0.9/missing --run /usr/local/libexec/automake15/automake


./buildconf && ./Setup

 

answer questions like this:

prefix: /usr/local
smtp: 2 (qmail_queue)
oldqmf: no
subject line tag: yes
mysql conf and logging: no
default logging method: 3 (syslog)
logging by default: yes
viruschecker: clamscan
clamscan binary: /usr/local/bin/clamscan
send warning about virus to sender: no
clean viruses: yes
razor: /usr/bin/perl
razor-check: /usr/bin/razor-check

 

- change to #define HAVE_LIBPCRE 1 in config.h.in

spits out a config command, use this one in the following directions:

 

./configure --prefix=/usr/local --enable-qmailqueue --with-config1=.blackhole --enable-qmailqfilter --enable-one-box --with-log-type=syslog --enable-use-log --enable-virus-clean --enable-use-log --enable-ok-log --enable-log-score --enable-log-size --enable-log-iprelay --enable-log-sender --enable-log-score --with-rbl-dnssrv=127.0.0.1

 

- run the above configure command to generate Makefile
- change /usr/include/pcre to /usr/local/include in Makefile
- add /usr/local/lib/libpcre.a to blackhole_LDADD in Makefile

- run gmake
- run gmake install
- copy /var/qmail/bin/qmail-queue to /var/qmail/bin/qmail-queue-old
- copy blackhole to /var/qmail/bin/qmail-queue-new

- copy /var/qmail/bin/qmail-queue-new to /var/qmail/bin/qmail-queue
- chown qmailq:qmail qmail-queue
- chmod 6755 qmail-queue
- chown -R root:wheel /var/spool/blackhole/msg
- chmod -R 1777 /var/spool/blackhole/msg

 

Configure blackhole:

backup and restore /etc/blackhole.conf

 

Individual user configurations:

these can be placed in:

/var/spool/blackhole/conf/[fqhn]/[user]/.blackhole

where [fqhn] is the fully qualified hostname the email is sent to and [user] is the username sent to

 

 

Install Notes
a7v bios
os notes
os install
kernel cfg
ports update
vinum
soft updates
quotas
public pmsns
firewall
named
ppp
dhcpd
samba
apache+modssl
mod_php5
proftpd
qmail
blackhole
courier-imap
shared-folders
sqwebmail
skeleton
dependencies
nut
automount
net-snmpd
mrtg
system update
system config
formt floppy
wireless IPsec
bdes cdrw's
MySQL
Cert Auth
CPES AD 1
CPES AD 2
CPES Grp Plcy
AD1 <-> AD2
AD Reference