From LedHed's Wiki
Jump to: navigation, search
Line 6: Line 6:
  
 
== Prerequisites ==
 
== Prerequisites ==
Depending on the storage driver you intend to use you will need to have that database backend installed before compiling dspam.
+
Depending on the storage driver you intend to use you will need to have that database backend installed before compiling dspam.<br>
_____________________________________________________________________<br>
+
 
 
  mysql_drv:  MySQL client libraries      (and a server to connect to)<br>
 
  mysql_drv:  MySQL client libraries      (and a server to connect to)<br>
 
  pgsql_drv:  PostgreSQL client libraries (and a server to connect to)<br>
 
  pgsql_drv:  PostgreSQL client libraries (and a server to connect to)<br>

Revision as of 12:23, 6 October 2007

To view the compile options on an existing installation of dspam use this command:

dspam --version



Prerequisites

Depending on the storage driver you intend to use you will need to have that database backend installed before compiling dspam.

mysql_drv:   MySQL client libraries      (and a server to connect to)
pgsql_drv: PostgreSQL client libraries (and a server to connect to)
sqlite_drv: SQLite v2.7.7 or above
sqlite3_drv: SQLite v3.x
hash_drv: None (Self-Contained Hash-Based Driver)



Compile Options

Note: these are the compile options I typically use. There are many more options to suit other needs

--sysconfdir=/etc/dspam \
--enable-daemon \
--enable-clamav \
--with-storage-driver=mysql_drv \
--with-mysql-libraries=/usr/lib/mysql \
--with-mysql-includes=/usr/include/mysql \
--enable-virtual-users \
--enable-preferences-extension \
--enable-domain-scale \
--enable-debug \
--with-logdir=/var/log/dspam


Download & Install

wget http://dspam.nuclearelephant.com/sources/dspam-3.X.X.tar.gz


tar -xvzf dspam-3.X.X.tar.gz
cd dspam-3.X.X


./configure \
--sysconfdir=/etc/dspam \
--enable-daemon \
--enable-clamav \
--with-storage-driver=mysql_drv \
--with-mysql-libraries=/usr/lib/mysql \
--with-mysql-includes=/usr/include/mysql \
--enable-virtual-users \
--enable-preferences-extension \
--enable-domain-scale \
--enable-debug \
--with-logdir=/var/log/dspam


make && make install



File Permissions

File permissions can drive you nutz when installing dspam.
Here are a few tips.

1. Create a 'dspam' Group and 'dspam' User

groupadd dspam
useradd -M -s /sbin/nologin -g dspam dspam

2. change ownership of all dspam files to be owned by dspam.dspam

chown dspam.dspam dspam_files

3. set the sticky bit (SUID) for the dspam executable (/usr/local/bin/dspam)

chmod 4510 /usr/local/bin/dspam

4. set the correct file permissions of all of the dspam files see: DSpam File Permissions


Configuration

All of DSpam's configuration takes place within dspam.conf (typically located in: /etc/dspam.conf or /etc/dspam/dspam.conf)

Read through dspam.conf, it contains explanations for each configuration option. If you are still unsure after reading dspam.conf, try reading the 'README' (AKA documentation). If that doesn't help try Google and if that still doesn't shed any light on your problem join the the IRC channel #dspam at irc.freenode.net

More to Come!



MySQL

To use DSpam with MySQL you need a functional MySQL Server before you compile DSpam (or at least have the mysql libs installed). Read the mysql_drv.txt file in the doc/ directory.

1. Once you have MySQL installed and running you need to create a user within MySQL that has permission to SELECT, INSERT, UPDATE, and DELETE.

GRANT SELECT, INSERT, UPDATE, DELETE ON dspam.* TO 'postfix'@'localhost' IDENTIFIED BY 'SomePassword';

2. You need to create the DSpam database

mysqladmin -u root -p CREATE dspam

3. Import the dspam tables into MySQL There are several files under src/tools.mysql. Choose one of these files depending on your needs (Speed, Space, Etc...) and insert it into MySQL to create the Table structure DSpam needs.
In this case Virtual Users will be implemented so we need to insert two table structures.

mysql -u root -p dspam < mysql_objects-4.1.sql
mysql -u root -p dspam < virtual_users.sql

4. Edit the MySQL options in /etc/dspam.conf

MySQLServer             /var/lib/mysql/mysql.sock
MySQLPort               3306
MySQLUser               dspam
MySQLPass               SomePassword
MySQLDb                 dspam
MySQLCompress           true
MySQLVirtualTable          dspam_virtual_uids
MySQLVirtualUIDField       uid
MySQLVirtualUsernameField  username