blockinator/apache
Scott Wallace 5b5aad08cb Fix possible SEGVs by changing the nByte parameter of sqlite3_prepare_v2().
Segmentation Faults reported and observed under high traffic.  For some reason this is a previously seen issue with the nBytes parameter of sqlite3_prepare_v2().  Not sure why, but it seems to fix the issue.
2012-12-19 15:27:41 +00:00
..
AUTHORS Initial code commit. 2012-05-21 19:08:04 +01:00
build_from_scratch.sh Initial code commit. 2012-05-21 19:08:04 +01:00
Changelog Initial code commit. 2012-05-21 19:08:04 +01:00
configure.in Initial code commit. 2012-05-21 19:08:04 +01:00
Makefile.am Initial code commit. 2012-05-21 19:08:04 +01:00
mod_blockinator.c Fix possible SEGVs by changing the nByte parameter of sqlite3_prepare_v2(). 2012-12-19 15:27:41 +00:00
NEWS Initial code commit. 2012-05-21 19:08:04 +01:00
README Removed cookie checking -- deprecated. 2012-11-08 14:03:38 +00:00

Compilation
-----------
1. Ensure the SQLite development libraries (sqlite-devel) are installed.

2. Either run the build_from_scratch.sh script or run the following commands:
    1. libtoolize
    2. aclocal
    3. autoconf
    4. automake -a
    5. ./configure --with-apache=<Apache location>
    6. make CFLAGS=-lsqlite3

Installation
------------
1. Activate in Apache using:
    a) (automatic) Using APXS:
        apxs -i -a -n blockinator libmodblockinator.la
    b) (manual) Add the following commands to the Apache configuration:
        LoadModule blockinator_module modules/libmodblockinator.so

2. Configure mod_blockinator by adding the following lines in the appropriate location(s):
    1. Define where the blocklist DB can be found:
        <IfModule blockinator_module>
            BlockinatorBlocklistDB	/path/to/blocklist.db
        </IfModule>
    2. Create a mod_rewrite rule to block requests, if matched:
        RewriteCond %{HTTP:X-Block}	1
        RewriteRule .			-  [R=403,L]

3. Create the SQLite DB:
    1. sqlite3 /path/to/blocklist.db
    2. Run the following SQL:
        CREATE TABLE IF NOT EXISTS blocklist(remote_ip VARCHAR(15), forwarded_ip VARCHAR(15), useragent VARCHAR(256), cookie VARCHAR(1024), PRIMARY KEY(remote_ip));
    3. (optional) Insert some test data:
        Block requests from IP address 1.2.3.4
        e.g. INSERT INTO blocklist VALUES("1.2.3.4", "ANY", "ANY", "ANY");

4. Restart Apache