logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Third-party Modules View previous topic :: View next topic
Reply to topic   Topic: Mod_Evasive for Apache 2.4.X on Windows?
Author
own3mall



Joined: 09 Jun 2013
Posts: 9

PostPosted: Sun 09 Jun '13 20:58    Post subject: Mod_Evasive for Apache 2.4.X on Windows? Reply with quote

I found an Apache 2.2.X mod_evasive module on this site for Windows, but I haven't found one for Apache 2.4.X.

Is there a Windows version of mod_evasive for Apache 2.4.X anywhere? Please let me know, as my Linux servers have been under DDoS attack, and I'm just trying to take preventative measures on my Windows server as well.

Thanks!
Back to top
kenw232



Joined: 12 Jun 2013
Posts: 3
Location: Toronto

PostPosted: Thu 13 Jun '13 5:53    Post subject: Reply with quote

This might help you here:
http://sites.extremehosting.ca/mod_evasive24/
Back to top
own3mall



Joined: 09 Jun 2013
Posts: 9

PostPosted: Thu 13 Jun '13 9:00    Post subject: Reply with quote

Does the module have to be built in Windows for the Windows version, or can I build it in Linux and copy it over?

I've got Visual Studio, but I'm not sure how to compile it. Is there a guide somewhere?

The ReadMe states:

Quote:

1. Extract this archive

2. Run $APACHE_ROOT/bin/apxs -i -a -c mod_evasive20.c

3. The module will be built and installed into $APACHE_ROOT/modules, and loaded into your httpd.conf

4. Restart Apache


If it's that easy in Windows, could I build it and release the built module?
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7288
Location: Germany, Next to Hamburg

PostPosted: Fri 14 Jun '13 15:30    Post subject: Reply with quote

own3mall wrote:
Does the module have to be built in Windows for the Windows version, or can I build it in Linux and copy it over?


it has to be done on windows. Linux and windows binaries are not compatible.

I would try (unpacked the tar.gz to C:\build\mod_evasive


Code:

SET APACHE=C:\Apache24

cl /nologo /MD /W3 /O2 /D WIN32 /D _WINDOWS /D NDEBUG -I"\build\mod_evasive" -I%APACHE%\include mod_evasive24.c

link kernel32.lib ws2_32.lib "%APACHE%\lib\libhttpd.lib" "%APACHE%\lib\libapr-1.lib" "%APACHE%\lib\libaprutil-1.lib" /nologo /subsystem:windows /dll /machine:I386 /out:mod_evasive24.so mod_evasive24.obj "\build\mod_evasive\*.obj"


That are 3 lines so I pasted it also on http://pastebin.com/raw.php?i=1wwRN57X

This is not tested (TM)
Back to top
own3mall



Joined: 09 Jun 2013
Posts: 9

PostPosted: Sat 15 Jun '13 19:44    Post subject: Reply with quote

Thanks, but where do I put these lines of code, and what am I using to execute them?

Also, shouldn't it be:

Code:

NODEBUG


Rather than:
Code:

NDEBUG


Couldn't I just do this?

http://woof.magicsplat.com/blog/build_apache_module_on_windows

::EDIT::

Installed Strawberry perl and tried compiling the module with the commands in the readme, but I get the following errors:

Code:

C:\zpanel\bin\apache\bin>C:\strawberry\perl\bin\perl.exe "C:\zpanel\bin\apache\b
in\apxs.pl" -i -a -c "C:\Download\mod_evasive_1.10.1_apache_2.4\mod_evasive24.c"

Use of assignment to $[ is deprecated at C:\zpanel\bin\apache\bin\apxs.pl line 1
07.
Use of uninitialized value $apr_ldflags in concatenation (.) or string at C:\zpa
nel\bin\apache\bin\apxs.pl line 471.
gcc  /nologo /MD /W3 /O2 /D WIN32 /D _WINDOWS /D NDEBUG    -I"C:\zpanel\bin\apac
he\include"  /c /FoC:\Download\mod_evasive_1.10.1_apache_2.4\mod_evasive24.lo C:
\Download\mod_evasive_1.10.1_apache_2.4\mod_evasive24.c
gcc: error: /nologo: No such file or directory
gcc: error: /MD: No such file or directory
gcc: error: /W3: No such file or directory
gcc: error: /O2: No such file or directory
gcc: error: /D: No such file or directory
gcc: error: WIN32: No such file or directory
gcc: error: /D: No such file or directory
gcc: error: _WINDOWS: No such file or directory
gcc: error: /D: No such file or directory
gcc: error: NDEBUG: No such file or directory
gcc: error: /c: No such file or directory
gcc: error: /FoC:\Download\mod_evasive_1.10.1_apache_2.4\mod_evasive24.lo: Inval
id argument
apxs:Error: Command failed with rc=65536
.
Back to top
Steffen
Moderator


Joined: 15 Oct 2005
Posts: 3049
Location: Hilversum, NL, EU

PostPosted: Sat 15 Jun '13 20:44    Post subject: Reply with quote

/D NDEBUG is correct, see http://msdn.microsoft.com/en-us/library/9sb57dw4(v=VS.71).aspx

James snippet is that you run CL /nologo /MD /W3 /O2 / ..... in a Visual Studio command window and not apxs.pl
Back to top
own3mall



Joined: 09 Jun 2013
Posts: 9

PostPosted: Sat 15 Jun '13 21:39    Post subject: Reply with quote

Ah, OK, but is it possible to compile it using the apxs.pl? This seems like it should be easier and more open (free)...

Just not sure what to do about the errors I received.
Back to top
Steffen
Moderator


Joined: 15 Oct 2005
Posts: 3049
Location: Hilversum, NL, EU

PostPosted: Sat 15 Jun '13 22:28    Post subject: Reply with quote

As I said/mean you run apxs with cl command line options.

See first the readme in the apxs package (download it from the Additional download page here). You should first configure it. After you configured it you can use apxs.bat with -i -a -c mod_evasive20.c

It is recommended/easy to use the snippet from James, build it in a visual studio window with cl.

For both cl and apxs first transform the LF's to CRLF's with lineends.pl (also on the download page here).
Back to top
glsmith
Moderator


Joined: 16 Oct 2007
Posts: 2268
Location: Sun Diego, USA

PostPosted: Mon 17 Jun '13 11:40    Post subject: Reply with quote

I looked over the mod_evasive24.c file. You are not going to be able to compile this on Windows without some modification. It will be minus some features but will still do it's basic job which IMO wouldn't stop a real DDOS attack against the server anyway. A few IPs fine, a botnet pointed your way and you'll still end up unreachable during the attack.
Back to top
own3mall



Joined: 09 Jun 2013
Posts: 9

PostPosted: Tue 18 Jun '13 5:46    Post subject: Reply with quote

Do you know what needs to be modified so that it will compile? Any chance you could compile it and redistribute it?

I know mod_evasive isn't that great, but it sort of helps a little. How about mod_evasive paired with mod_qos? But then again... I wouldn't know how to compile that for Windows either.
Back to top
glsmith
Moderator


Joined: 16 Oct 2007
Posts: 2268
Location: Sun Diego, USA

PostPosted: Wed 19 Jun '13 6:20    Post subject: Reply with quote

I guess so

https://www.apachehaus.net/modules/
Back to top
own3mall



Joined: 09 Jun 2013
Posts: 9

PostPosted: Wed 26 Jun '13 8:13    Post subject: Reply with quote

Thanks. Any chance you might be able to compile mod_qos for Windows too?
Back to top
glsmith
Moderator


Joined: 16 Oct 2007
Posts: 2268
Location: Sun Diego, USA

PostPosted: Wed 26 Jun '13 10:51    Post subject: Reply with quote

No, that's a can of worms I do not want to open.
Back to top
spitzerspace



Joined: 24 Dec 2014
Posts: 7

PostPosted: Wed 24 Dec '14 20:59    Post subject: Reply with quote

glsmith wrote:
I guess so

https://www.apachehaus.net/modules/


Any interest in recompiling mod evasive for VC11 builds on Win64?
Back to top
glsmith
Moderator


Joined: 16 Oct 2007
Posts: 2268
Location: Sun Diego, USA

PostPosted: Thu 25 Dec '14 4:57    Post subject: Reply with quote

Sure, done, Merry Christmas.
Back to top
spitzerspace



Joined: 24 Dec 2014
Posts: 7

PostPosted: Thu 25 Dec '14 7:36    Post subject: Reply with quote

Aw, yeah! Spent so much time google searching LNK1112 errors in VS 2012. I'm definitely a noob.

Thanks and Merry Christmas!
Back to top


Reply to topic   Topic: Mod_Evasive for Apache 2.4.X on Windows? View previous topic :: View next topic
Post new topic   Forum Index -> Third-party Modules