Fast Debian Lenny / Exim4 install
Posted: Thu Jan 20, 2011 10:41 pm
This is a howto for the install of spamgourmet on a Debian Lenny server by a root user. It's more or less a copy/paste tutorial... But some prior admin knowledge are required. You will do this install as root, so as privileged user, you should have a basic idea of the system you are working on...
1/ Install the dependencies
Accept default options. For exim4, you will have to set it to receive mails from the internet and to send them directly or via a smarthost. Insert the IP address which should be monitored (in place of 127.0.0.1), and set the other domains that accept emails to your spamgourmet domain (for example dontbug.me). Finally, select ?No? to split the configuration file in multiples files.
Now you have a working Exim configuration. You can test it by sending an email to user@dontbug.me where user is a localuser. Mails should be delivered to the user Maildir or in a mailbox file, depending on your Exim configuration.
2/ Download the spamgourmet source code
3/ Copy the files in the right place
4/ Edit the configuration files
/etc/spamgourmet/spamgourmet.config
/var/www-spamgourmet/index.pl
/var/www-spamgourmet/templates/EN/signupform.html
/usr/local/lib/spamgourmet/captchasrv/captchasrv.pl
/usr/local/lib/spamgourmet/mailhandler/spameater
To work with Exim4 I also had to change
to
5/ Create and setup the database
6/ Create a virtualhost
Create the config file: /etc/apache2/sites-available/dontbug.me
Activate the virtualhost
Reload the config
7/ Configure Exim4
Edit the main configuration file: /etc/exim4/exim4.conf.template
Enable the # character in the localparts (remove it twice):
Create a catchall router in the routers section
Create a transport in the transports section
Restart Exim 4
8/ Start the captcha server
Start the captcha server. This is for tests only! You should start it with a non privileged user and with daemontools or something similar.
9/ Test your new spamgourmet server
Open your browser and create a new account: http://dontbug.me
10/ Customize...
There are a lot of references to spamgourmet.com in the code... So you will have to tune everything to your needs. A good start is the folder: /var/www-spamgourmet/templates/EN.
To find the relevant parts, you can always use the grep command over the source code
1/ Install the dependencies
- Code: Select all
apt-get install exim4 apache2 libapache2-mod-perl2
Accept default options. For exim4, you will have to set it to receive mails from the internet and to send them directly or via a smarthost. Insert the IP address which should be monitored (in place of 127.0.0.1), and set the other domains that accept emails to your spamgourmet domain (for example dontbug.me). Finally, select ?No? to split the configuration file in multiples files.
Now you have a working Exim configuration. You can test it by sending an email to user@dontbug.me where user is a localuser. Mails should be delivered to the user Maildir or in a mailbox file, depending on your Exim configuration.
2/ Download the spamgourmet source code
- Code: Select all
svn co https://spamgourmet.svn.sourceforge.net/svnroot/spamgourmet spamgourmet
3/ Copy the files in the right place
- Code: Select all
cd spamgourmet
mkdir /usr/local/lib/spamgourmet
cp -R captchasrv mailhandler modules /usr/local/lib/spamgourmet
mkdir /var/www-spamgourmet
mkdir /var/www-spamgourmet/captcha
cp -R web/graphs.cgi web/html/* web/templates /var/www-spamgourmet
mkdir /etc/spamgourmet
cp conf/spamgourmet.config /etc/spamgourmet
4/ Edit the configuration files
/etc/spamgourmet/spamgourmet.config
- Code: Select all
%localdomains = (
'dontbug.me' => 1
);
$admindomain = 'realdomain.com';
$dbstring = 'DBI:mysql:database=XXXdatabaseXXX;host=localhost';
$dbuser = 'XXXuserXXX';
$dbpassword = 'XXXpassXXX';
$debugfilename = '/var/log/spamgourmet.log'; # full path to debug output file
$webapproot = '/var/www-spamgourmet/';
$webtemplatedir = '/var/www-spamgourmet/templates/';
$secretphrase = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
$mailhost = 'dontbug.me';
$adminemail = 'admin@realdomain.com';
$otherdomainemail = 'noreply@dontbug.me';
/var/www-spamgourmet/index.pl
- Code: Select all
use lib "/usr/local/lib/spamgourmet/modules";
my $config = Mail::Spamgourmet::Config->new(configfile=>'/etc/spamgourmet/spamgourmet.config');
/var/www-spamgourmet/templates/EN/signupform.html
- Code: Select all
<img src="http://www.dontbug.me/captcha/<%imagefilename%>" width="620" height="180" border="0">
/usr/local/lib/spamgourmet/captchasrv/captchasrv.pl
- Code: Select all
use constant InstallDir => "usr/local/lib/spamgourmet/captchasrv";
use constant TmpDir => "/var/www-spamgourmet/captcha";
/usr/local/lib/spamgourmet/mailhandler/spameater
- Code: Select all
use lib "/usr/local/lib/spamgourmet/modules";
my $configfile = "/etc/spamgourmet/spamgourmet.config";
To work with Exim4 I also had to change
- Code: Select all
$headerValues{'from'} = $ENV{'FROM'};
to
- Code: Select all
$headerValues{'from'} = $ENV{'SENDER'};
5/ Create and setup the database
- Code: Select all
mysqladmin -u root -p create XXXdatabaseXXX (name of the database from spamgourmet.config)
- Code: Select all
mysql -u root -p
mysql> grant all privileges on XXXdatabaseXXX.* to 'XXXuserXXX'@'localhost' identified by 'XXXpassXXX';
mysql> exit
- Code: Select all
mysql -u XXXuserXXX -p XXXdatabaseXXX < conf/db.sql
mysql -u XXXuserXXX -p XXXdatabaseXXX < conf/dialogs.sql
6/ Create a virtualhost
Create the config file: /etc/apache2/sites-available/dontbug.me
- Code: Select all
<VirtualHost xxx.xxx.xxx.xxx:80>
ServerAdmin admin@realdomain.com
ServerName dontbug.me
DocumentRoot /var/www-spamgourmet
<Directory /var/www-spamgourmet/>
Options +ExecCGI
AllowOverride None
AddHandler cgi-script .cgi .pl
</Directory>
ErrorLog /var/log/apache2/dontbug.me-error.log
LogLevel warn
CustomLog /var/log/apache2/dontbug.me-access.log combined
ServerSignature Off
</VirtualHost>
Activate the virtualhost
- Code: Select all
a2ensite dontbug.me
Reload the config
- Code: Select all
/etc/init.d/apache2 reload
7/ Configure Exim4
Edit the main configuration file: /etc/exim4/exim4.conf.template
Enable the # character in the localparts (remove it twice):
- Code: Select all
.ifndef CHECK_RCPT_LOCAL_LOCALPARTS
CHECK_RCPT_LOCAL_LOCALPARTS = ^[.] : ^.*[@%!/|`&?]
.endif
.ifndef CHECK_RCPT_REMOTE_LOCALPARTS
CHECK_RCPT_REMOTE_LOCALPARTS = ^[./|] : ^.*[@%!`&?] : ^.*/\\.\\./
.endif
Create a catchall router in the routers section
- Code: Select all
catchall_dontbugme:
driver = accept
domains = dontbug.me
transport = spamg_pipe
Create a transport in the transports section
- Code: Select all
spamg_pipe:
debug_print = "T: spamg_pipe for $local_part@$domain"
driver = pipe
command = /usr/local/spamgourmet/mailhandler/spameater
Restart Exim 4
- Code: Select all
/etc/init.d/exim4 restart
8/ Start the captcha server
Start the captcha server. This is for tests only! You should start it with a non privileged user and with daemontools or something similar.
- Code: Select all
/usr/local/spamgourmet/captchasrv/captchasrv.pl &
9/ Test your new spamgourmet server
Open your browser and create a new account: http://dontbug.me
10/ Customize...
There are a lot of references to spamgourmet.com in the code... So you will have to tune everything to your needs. A good start is the folder: /var/www-spamgourmet/templates/EN.
To find the relevant parts, you can always use the grep command over the source code