2013-06-25 16:54:36 +01:00
|
|
|
# Compilation
|
2013-06-25 17:49:33 +01:00
|
|
|
|
2013-06-25 16:54:36 +01:00
|
|
|
1. Ensure the SQLite development libraries (sqlite-devel) are installed.
|
|
|
|
2. Either run the `build_from_scratch.sh` script or run the following commands:
|
2013-06-25 17:49:33 +01:00
|
|
|
|
|
|
|
```Shell
|
|
|
|
libtoolize
|
|
|
|
aclocal
|
|
|
|
autoconf
|
|
|
|
automake -a
|
|
|
|
./configure --with-apache=<Apache location>
|
|
|
|
make CFLAGS=-lsqlite3
|
|
|
|
```
|
2013-06-25 16:54:36 +01:00
|
|
|
|
|
|
|
# Installation
|
2013-06-25 17:49:33 +01:00
|
|
|
|
2013-06-25 16:54:36 +01:00
|
|
|
1. Activate in Apache using:
|
|
|
|
* (automatic) Using APXS:
|
2013-06-25 17:49:33 +01:00
|
|
|
|
|
|
|
```Shell
|
2013-06-25 16:54:36 +01:00
|
|
|
apxs -i -a -n blockinator libmodblockinator.la
|
|
|
|
```
|
2013-06-25 17:49:33 +01:00
|
|
|
|
|
|
|
_*or*_
|
2013-06-25 16:54:36 +01:00
|
|
|
* (manual) Add the following commands to the Apache configuration:
|
2013-06-25 17:49:33 +01:00
|
|
|
|
|
|
|
```ApacheConf
|
2013-06-25 16:54:36 +01:00
|
|
|
LoadModule blockinator_module modules/libmodblockinator.so
|
|
|
|
```
|
2013-06-25 17:49:33 +01:00
|
|
|
|
|
|
|
2. Configure mod_blockinator by adding the following lines in the appropriate location(s):
|
2013-06-25 16:54:36 +01:00
|
|
|
1. Define where the blocklist DB can be found:
|
2013-06-25 17:49:33 +01:00
|
|
|
|
|
|
|
```ApacheConf
|
2013-06-25 16:54:36 +01:00
|
|
|
<IfModule blockinator_module>
|
|
|
|
BlockinatorBlocklistDB /path/to/blocklist.db
|
|
|
|
</IfModule>
|
|
|
|
```
|
2013-06-25 17:49:33 +01:00
|
|
|
|
|
|
|
2. Create a mod_rewrite rule to block requests, if matched:
|
|
|
|
|
|
|
|
```ApacheConf
|
2013-06-25 16:54:36 +01:00
|
|
|
RewriteCond %{HTTP:X-Block} 1
|
|
|
|
RewriteRule . - [R=403,L]
|
|
|
|
```
|
2013-06-25 17:49:33 +01:00
|
|
|
|
2013-06-25 16:54:36 +01:00
|
|
|
3. Create the SQLite DB:
|
2013-06-25 17:49:33 +01:00
|
|
|
1. Start SQLite3 on a new file:
|
|
|
|
|
|
|
|
```Shell
|
|
|
|
sqlite3 /path/to/blocklist.db
|
2013-06-25 16:54:36 +01:00
|
|
|
```
|
2013-06-25 17:49:33 +01:00
|
|
|
|
|
|
|
2. Run the following SQL:
|
|
|
|
|
|
|
|
```SQL
|
2013-06-25 16:54:36 +01:00
|
|
|
CREATE TABLE IF NOT EXISTS blocklist(remote_ip VARCHAR(15), forwarded_ip VARCHAR(15), useragent VARCHAR(256), cookie VARCHAR(1024), PRIMARY KEY(remote_ip));
|
|
|
|
```
|
2013-06-25 17:49:33 +01:00
|
|
|
|
2013-06-25 16:54:36 +01:00
|
|
|
3. (optional) Insert some test data:
|
2013-06-25 17:49:33 +01:00
|
|
|
|
|
|
|
e.g. Block requests from IP address 1.2.3.4
|
|
|
|
|
|
|
|
```SQL
|
|
|
|
INSERT INTO blocklist VALUES("1.2.3.4", "ANY", "ANY", "ANY");
|
|
|
|
```
|
|
|
|
|
2013-06-25 16:54:36 +01:00
|
|
|
4. Restart Apache
|