Page 1 of 1

mod_evasive installieren

Posted: 2006-11-15 16:46
by Anonymous
Hat schon mal jemand mod_evasive Installiert? ich such seit einiger Zeit nach einer Anleitung die auf Suse 9.3 und Apache/2.0.53
funktioniert :roll:
Getestet wurde dieses HowTo auf folgendem System:

* SuSe 9.3
* Apache 2.x - Prefork

1. Aktuelles Paket runterladen
2. In /usr/local/src/mod_evasive entpacken
3. In das Verzeichnis mod_evasive wechseln
4. Mit dem Editor Deiner Wahl mod_evasive20.c öffnen
5. Die Zeile 45 umändern in
Code:

#define MAILER "/bin/mail -t %s"

6. Je nachdem, welchen Apache Du wie einsetzt, folgenden APXS ausführen, um das Modul zu kompilieren.
Apache2:
Code:

/usr/sbin/apxs2 -cia mod_evasive20.c

Apache2-Prefork:
Code:

/usr/sbin/apxs2-prefork -cia mod_evasive20.c

7. Eine eigene Conf-Datei für mod_evasive anlegen
Code:

touch /etc/apache2/conf.d/mod_evasive.conf

8. Mit dem Editor Deiner Wahl folgenden Inhalt (je nachdem ob Prefork oder nicht) in die eben erstellte mod_evasive.conf
Apache2:
Code:

LoadModule evasive20_module /usr/lib/apache2/mod_evasive20.so

Apache2-Prefork:
Code:

LoadModule evasive20_module /usr/lib/apache2-prefork/mod_evasive20.so

und danach dann danach bei beiden folgendes in die gleiche Datei:
Code:

<IfModule mod_evasive20.c> DOSHashTableSize 3097 DOSPageCount 5 DOSSiteCount 100 DOSPageInterval 2 DOSSiteInterval 2 DOSBlockingPeriod 600 DOSEmailNotify deine@email-adresse.de </IfModule>

9. rcapache2 stop
10. rcapache2 start


Das war's dann auch schon. Nun einfach mal mit der mitgelieferten test.pl den Server versuchen zu "nuken":
Code:

cd /usr/src/mod_evasive perl test.pl

Am Anfang kommen HTTP OK und dann sollte es sich auf 403 Forbidden Antworten ändern. Geschieht dies, ist alles glatt gelaufen!
wenn ich so mache bekomme ich eine Fehlermeldung
/usr/local/src/mod_evasive # /usr/sbin/apxs2-prefork -cia mod_evasive20.c
/usr/share/apache2/build/libtool --silent --mode=compile gcc -prefer-pic -O2 -march=i586 -mcpu=i686 -fmessage-length=0 -Wall -g -fPIC -Wall -fno-strict-aliasing -D_LARGEFILE_SOURCE -DAP_HAVE_DESIGNATED_INITIALIZER -DLINUX=2 -D_REENTRANT -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE -DAP_DEBUG -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -pthread -I/usr/include/apache2-prefork -I/usr/include/apache2 -I/usr/include/apache2 -c -o mod_evasive20.lo mod_evasive20.c && touch mod_evasive20.slo
mod_evasive20.c: In function `access_checker':
mod_evasive20.c:212: warning: implicit declaration of function `getpid'
mod_evasive20.c:212: warning: long int format, int arg (arg 3)
mod_evasive20.c: At top level:
mod_evasive20.c:327: warning: no previous prototype for `ntt_node_create'
mod_evasive20.c: In function `destroy_hit_list':
mod_evasive20.c:301: warning: control reaches end of non-void function
mod_evasive20.c: In function `create_hit_list':
mod_evasive20.c:118: warning: control reaches end of non-void function
/usr/share/apache2/build/libtool --silent --mode=link gcc -o mod_evasive20.la -rpath /usr/lib/apache2-prefork -module -avoid-version mod_evasive20.lo
/usr/share/apache2/build/instdso.sh SH_LIBTOOL='/usr/share/apache2/build/libtool' mod_evasive20.la /usr/lib/apache2-prefork
/usr/share/apache2/build/libtool --mode=install cp mod_evasive20.la /usr/lib/apache2-prefork/
cp .libs/mod_evasive20.so /usr/lib/apache2-prefork/mod_evasive20.so
cp .libs/mod_evasive20.lai /usr/lib/apache2-prefork/mod_evasive20.la
cp .libs/mod_evasive20.a /usr/lib/apache2-prefork/mod_evasive20.a
ranlib /usr/lib/apache2-prefork/mod_evasive20.a
chmod 644 /usr/lib/apache2-prefork/mod_evasive20.a
PATH="$PATH:/sbin" ldconfig -n /usr/lib/apache2-prefork
----------------------------------------------------------------------
Libraries have been installed in:
/usr/lib/apache2-prefork

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-Wl,--rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
chmod 755 /usr/lib/apache2-prefork/mod_evasive20.so
apxs:Error: Config file /etc/apache2/httpd2-prefork.conf not found.
h897777:/usr/local/src/mod_evasive #
Ich habe auch schon über Google gesucht aber nichts brauchbares gefunden
$APACHE_ROOT/bin/apxs -i -a -c mod_evasive20.c versucht da kommt das gleiche :roll:

Re: mod_evasive installieren

Posted: 2006-11-15 17:53
by sledge0303
apache2 utils installiert?

Code: Select all

/usr/bin/apxs[2] -cia mod_evasive20.c 

http://httpd.apache.org/docs/2.0/programs/apxs.html

Re: mod_evasive installieren

Posted: 2006-11-15 18:13
by Anonymous
Glaube nicht kann es nicht finden :roll:

Re: mod_evasive installieren

Posted: 2006-11-15 18:18
by Joe User

Code: Select all

cd /etc/apache2 && ln -s httpd.conf httpd2-prefork.conf && cd

Re: mod_evasive installieren

Posted: 2006-11-16 04:39
by Anonymous
Das habe ich jetzt mal eingegeben da kommt dann :

cd /etc/apache2 && ln -s httpd.conf httpd2-prefork.conf && cd
ln: Erzeugen der symbolischen Verknüpfung „httpd2-prefork.conf" zu „httpd.conf": Die Datei existiert bereits
h89777:/etc/apache2 #

Re: mod_evasive installieren

Posted: 2006-11-18 14:21
by Anonymous
Hat niemand mehr eine Idee wie ich das Teil installieren könnte? :cry:

Re: mod_evasive installieren

Posted: 2006-11-18 23:16
by lucki2
das hast du auch schon gemacht oder?

Code: Select all

cd /etc/apache2 && ln -fs httpd.conf httpd2-prefork.conf && cd -
mach Dir evtl vorher ein Back von /etc/apache2/httpd2-prefork.conf

Re: mod_evasive installieren

Posted: 2006-11-18 23:59
by Joe User
Ein Backup vom Symlink? ;)

Re: mod_evasive installieren

Posted: 2006-11-19 01:00
by lucki2
Ja, soll keiner sagen das Ding wäre geschrottet, weil der Link umgebogen wurde. Deswegen.
[imho zeigt der mommentan sowieso ins Nirvana - aber ...]
achso wie`s geht?

Code: Select all

cp -a httpd2-prefork.conf httpd2-prefork.conf.bak
... überhaupt mache ich gerne baks bevor ich etwas ändere - auch wenn es "blos" Links sind - nachher weiß ich doch nicht mehr, wo die davor hinzeigten und dann darf ich suchen ...

Re: mod_evasive installieren

Posted: 2006-11-19 18:00
by Anonymous
Was löst der befehl aus ?
cd /etc/apache2 && ln -fs httpd.conf httpd2-prefork.conf && cd -

Re: mod_evasive installieren

Posted: 2006-11-19 18:01
by Joe User
man cd
man ln

Re: mod_evasive installieren

Posted: 2006-11-19 18:11
by lucki2
nichts, was Du nacher - dank bak - mit

Code: Select all

cp -a httpd2-prefork.conf.bak httpd2-prefork.conf
rückgängig machen könntest.

[@ju: beantworted Deine Frage oder?]

Re: mod_evasive installieren

Posted: 2006-11-19 18:12
by lucki2
doppel - sorry.(ich weiß jetzt woran es lag, hatte ^^ noch ein "nicht" eigefügt)

Re: mod_evasive installieren

Posted: 2006-11-19 18:22
by Anonymous
Muß ich dann nach dem Befehl die mod_evasive Installation wiederholen?

Re: mod_evasive installieren

Posted: 2006-11-19 18:30
by lucki2
Hands On!

Re: mod_evasive installieren

Posted: 2006-11-19 19:20
by Anonymous
hat leider nichts gebracht habe immer noch die gleiche Fehlermeldung :cry:

Re: mod_evasive installieren

Posted: 2006-11-19 19:48
by lucki2
Ok. Gibt es das überhaupt:

Code: Select all

ls -l /etc/apache2/httpd.conf
Frage an SuSE Admins: früher hatte SuSE das Teil immer unter /etc/httpd, ist das seit neuerem bei SuSE wirklich unter /etd/apache2 ?

Re: mod_evasive installieren

Posted: 2006-11-19 19:53
by Anonymous
Ja ist bei mir in /etc/apache2 ich habe Suse 9.3 und Apache/2.0.53

Re: mod_evasive installieren

Posted: 2006-11-19 20:21
by lucki2
Ratlosigkeit macht sich bei mir breit.
Deinen Bak von dem Link hast Du wahrscheinlich noch? Gut aufbewahren.

Dann Lösche den Link und mach statt dessen mal einen harten rein. Ich lache, wenn das hilft. Sonst muß ich passen.:(

Code: Select all

cd /etc/apache2
rm httpd2-prefork.conf;
ln httpd.conf httpd2-prefork.conf
cd -

Re: mod_evasive installieren

Posted: 2006-11-19 21:31
by Joe User
In welcher Datei werden die Apache-Module geladen? (modules.include.conf durch den Namen der Datei ersetzen):

Code: Select all

cd /etc/apache2 && ln -sf modules.include.conf httpd2-prefork.conf && cd ~