Skip to content

Commit 7c38831

Browse files
authored
Merge pull request #12 from jvdmr/develop
Release 2.2.0
2 parents 5cdc03b + 6fb1366 commit 7c38831

File tree

16 files changed

+1138
-939
lines changed

16 files changed

+1138
-939
lines changed

CHANGELOG

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
Version 2.2.0
2+
-----------
3+
4+
[20200208] jvdmr: Add DOSWhitelistUri config option
5+
16
Version 2.1.1
27
-----------
38

Dockerfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM jvdmr/apache-dev:latest
2+
MAINTAINER @jvdmr
3+
4+
EXPOSE 80
5+
6+
ADD . /opt/jvdmr/apache2/mod_evasive
7+
WORKDIR /opt/jvdmr/apache2/mod_evasive
8+
9+
RUN mv mod_evasive24.c mod_evasive.c && \
10+
/usr/bin/apxs -i -a -c -l pcre2-8 mod_evasive.c && \
11+
apache2ctl configtest
12+
13+
RUN cp mod_evasive.conf /etc/apache2/conf-enabled/mod_evasive.conf
14+
RUN cp test/sites.conf /etc/apache2/sites-enabled/sites.conf
15+
16+
CMD service apache2 start && bash

README.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ Optionally you can also add the following directives:
187187
DOSSystemCommand "su - someuser -c '/sbin/... %s ...'"
188188
DOSLogDir "/var/lock/mod_evasive"
189189
DOSWhitelist 127.0.0.1
190+
DOSWhitelistUri whitelist.*regex
190191
   DOSHTTPStatus 429
191192
```
192193

@@ -352,12 +353,33 @@ blocked.
352353
To whitelist an address (or range) add an entry to the Apache configuration
353354
in the following fashion:
354355
355-
DOSWhitelist 127.0.0.1
356-
DOSWhitelist 127.0.0.*
356+
DOSWhitelist 127.0.0.1
357+
DOSWhitelist 127.0.0.*
357358
358359
Wildcards can be used on up to the last 3 octets if necessary. Multiple
359360
DOSWhitelist commands may be used in the configuration.
360361
362+
You can add several entries.
363+
364+
## Whitelisting URI's
365+
366+
Specific URI's can be whitelisted to insure they are never denied. Some
367+
clients may repeatedly request the same URI (due to bugs, or for other
368+
reasons), and subsequently be blocked from making other (valid) requests. If
369+
you want, you may whitelist these URI's so these clients won't be blocked.
370+
Use with caution.
371+
372+
To whitelist a URI add an entry to the Apache configuration
373+
in the following fashion:
374+
375+
DOSWhitelistUri /path/to/whitelisted/resource
376+
DOSWhitelistUri .*whitelisted.*
377+
378+
`DOSWhitelistUri` supports perl-style regex and matches the whole request URI
379+
(everything between the domain name and the ?) against this regex.
380+
381+
You can add several entries.
382+
361383
# Tweaking Apache
362384
363385
The keep-alive settings for your children should be reasonable enough to

debian-build.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
cd dist
2+
cp /usr/lib/apache2/modules/mod_evasive.so libapache2-mod-evasive/usr/lib/apache2/modules/mod_evasive.so
3+
dpkg-deb --build libapache2-mod-evasive

dist/libapache2-mod-evasive.deb

3.52 KB
Binary file not shown.
Binary file not shown.

docker-build.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
docker build . -t mod_evasive || exit 1
4+
docker run -t -d -p 1980:80 mod_evasive
5+
./test/test.pl
6+
docker ps -a | grep mod_evasive | awk -F " +" '{print $7}' | xargs docker stop
7+
docker run -t -v `pwd`/dist:/opt/jvdmr/apache2/mod_evasive/dist mod_evasive bash debian-build.sh

mod_evasive.conf

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# vim:ts=4
2+
<IfModule mod_evasive.c>
3+
DOSEnabled true
4+
DOSHashTableSize 3097
5+
DOSPageCount 2
6+
DOSSiteCount 50
7+
DOSPageInterval 1
8+
DOSSiteInterval 1
9+
DOSBlockingPeriod 10
10+
# DOSEmailNotify [email protected]
11+
# DOSSystemCommand "su - someuser -c '/sbin/... %s ...'"
12+
# DOSLogDir "/var/lock/mod_evasive"
13+
# DOSWhitelist 127.0.0.1
14+
# DOSWhitelistUri white.*regex
15+
# DOSHTTPStatus 429
16+
</IfModule>

0 commit comments

Comments
 (0)