.. | ||
AUTHORS | ||
build_from_scratch.sh | ||
Changelog | ||
configure.in | ||
Makefile.am | ||
mod_blockinator.c | ||
NEWS | ||
README.md |
Compilation
- Ensure the SQLite development libraries (sqlite-devel) are installed.
- Either run the
build_from_scratch.sh
script or run the following commands:libtoolize
aclocal
autoconf
automake -a
./configure --with-apache=<Apache location>
make CFLAGS=-lsqlite3
Installation
- Activate in Apache using:
- (automatic) Using APXS:
orapxs -i -a -n blockinator libmodblockinator.la
- (manual) Add the following commands to the Apache configuration:
LoadModule blockinator_module modules/libmodblockinator.so
- (automatic) Using APXS:
- Configure mod_blockinator by adding the following lines in the appropriate location(s):
- Define where the blocklist DB can be found:
<IfModule blockinator_module> BlockinatorBlocklistDB /path/to/blocklist.db </IfModule>
- Create a mod_rewrite rule to block requests, if matched:
RewriteCond %{HTTP:X-Block} 1 RewriteRule . - [R=403,L]
- Define where the blocklist DB can be found:
- Create the SQLite DB:
sqlite3 /path/to/blocklist.db
- 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));
- (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");
- Restart Apache