2

I'm trying to install mod_evasive and mod_security vainly, with httpd24 under Cenots 6.10.

I have tried this solution : https://github.com/shivaas/mod_evasive, downloaded : mod_evasive24.c $APACHE_ROOT/bin/apxs -i -a -c mod_evasive24.c

i got that message :

/usr/lib64/apr-1/build/libtool --silent --mode=compile gcc -prefer-pic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -Wformat-security -fno-strict-aliasing -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -pthread -I/usr/include/httpd -I/usr/include/apr-1 -I/usr/include/apr-1 -c -o mod_evasive24.lo mod_evasive24.c && touch mod_evasive24.slo mod_evasive24.c: In function âcreate_hit_listâ: mod_evasive24.c:122: warning: no return statement in function returning non-void mod_evasive24.c: In function âaccess_checkerâ: mod_evasive24.c:146: error: ârequest_recâ has no member named âuseragent_ipâ mod_evasive24.c:150: error: ârequest_recâ has no member named âuseragent_ipâ mod_evasive24.c:162: error: ârequest_recâ has no member named âuseragent_ipâ mod_evasive24.c:169: error: ârequest_recâ has no member named âuseragent_ipâ mod_evasive24.c:184: error: ârequest_recâ has no member named âuseragent_ipâ mod_evasive24.c:191: error: ârequest_recâ has no member named âuseragent_ipâ mod_evasive24.c:212: error: ârequest_recâ has no member named âuseragent_ipâ mod_evasive24.c:219: error: ârequest_recâ has no member named âuseragent_ipâ mod_evasive24.c:225: error: ârequest_recâ has no member named âuseragent_ipâ mod_evasive24.c:226: error: ârequest_recâ has no member named âuseragent_ipâ mod_evasive24.c:232: error: ârequest_recâ has no member named âuseragent_ipâ mod_evasive24.c:233: warning: ignoring return value of âsystemâ, declared with attribute warn_unused_result mod_evasive24.c: In function âdestroy_hit_listâ: mod_evasive24.c:305: warning: no return statement in function returning non-void apxs:Error: Command failed with rc=65536

  • Note for future questions: please try not making several questions at once. – Rui F Ribeiro Feb 27 at 9:25
3

Since CentOS 6 is a bit on the old side, in my opinion, the best course of action is upgrading it to CentOS 7. You seem to be suffering of using Apache 2.2 tools with Apache 2.4.

Addressing several concerns on your question:

  • If you are using CentOS 6, I would advise upgrading it to 7;
  • As for mod_evasive, there are packages for that;
  • About mod_security, the difficult part is not installing it, but configuring it properly, without it interfering with your current site/solution.

For installing mod_evasive and mod_security in CentOS 7, you need to enable the EPEL repositories first:

wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo rpm -Uvh epel-release-7*.rpm

and then do:

sudo yum --enablerepo=epel install mod_evasive  mod_security mod_security_crs

For configuring mod_evasive, see: Using a load balancer instead of Apache to throttle transactions from specific IP's

About mod_security, by default it only logs events. For making it active, after installing it, you have to edit /etc/httpd/conf.d/mod_security.conf and change SecRuleEngine to On and restart Apache.

However, I advise against enabling SecRuleEngine to On, if you are not prepared to:

  • debug mod_security on your own;
  • understand why some parts of your web site might stop working;
  • correcting / tracking down the corresponding rules to disable, on the default mod_security config.
  • Thank you for your reply, i tried to to install both mod_evasive and mod_security using epel repository, but there is no version available for httpd24, with your command, it install for httpd 2.2 only – Naima Feb 27 at 11:10
  • Thanks, changed the answer. I guess I did not recall how long CentOS 6 has been out; your problems in compiling can also be from mixing of Apache 2.4 with 2.2 tools. – Rui F Ribeiro Feb 27 at 11:14
  • Exactly, i had Apache 2.2 on my machine, but i've installed and switched to Apache 2.4. To protect my machine from DDos i have to install these 2 modules, but as you saw, i'm blocked – Naima Feb 27 at 15:41
  • @Naima It would have helped writing that from the beginning...that explains very well your problem, mix of Apache 2.4 and Apache 2.2 tools – Rui F Ribeiro Feb 27 at 15:43
  • what can you suggest me beside upgrading to Centos7? – Naima Feb 27 at 15:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.