%define apxs %{_sbindir}/apxs %define real_name mod_evasive Summary: Apache version 2.2.X Denial of Service evasion module Name: mod_evasive_ap22 Version: 1.10.1 Release: 1 Group: System Environment/Daemons License: GPLv2+ URL: http://www.zdziarski.com/projects/mod_evasive/ Source0: http://www.zdziarski.com/projects/mod_evasive/%{real_name}_%{version}.tar.gz Source1: %{real_name}.conf BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root BuildRequires: apr-devel >= 1.4.6-2 BuildRequires: apr-util-devel >= 1.3.10-3 BuildRequires: httpd-devel >= 2.2.27-2 BuildRequires: httpd-devel < 2.3 PreReq: apr >= 1.4.6-2 PreReq: apr-util >= 1.3.10-3 PreReq: httpd >= 2.2.27-2 PreReq: httpd < 2.3 Provides: %{real_name} %description mod_evasive is an evasive maneuvers module for Apache to provide evasive action in the event of an HTTP DoS or DDoS attack or brute force attack. It is also designed to be a detection and network management tool, and can be easily configured to talk to firewalls, routers, etc. mod_evasive presently reports abuses via email and syslog facilities. %prep %setup -q -n %{real_name} %build # compile apache httpd-2.2 version %{apxs} -Wc,"-qcpluscmt" -c mod_evasive20.c %install [ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT} mkdir -p ${RPM_BUILD_ROOT}%{_libdir}/httpd/modules chmod 0755 ${RPM_BUILD_ROOT}%{_libdir}/httpd/modules cp .libs/mod_evasive20.so ${RPM_BUILD_ROOT}%{_libdir}/httpd/modules/ chmod 0755 ${RPM_BUILD_ROOT}%{_libdir}/httpd/modules/* mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/httpd/conf/extra chmod 0755 ${RPM_BUILD_ROOT}%{_sysconfdir}/httpd/conf/extra cp %{SOURCE1} ${RPM_BUILD_ROOT}%{_sysconfdir}/httpd/conf/extra chmod 0644 ${RPM_BUILD_ROOT}%{_sysconfdir}/httpd/conf/extra/* %preun if [ "$1" = 0 ]; then cat %{_sysconfdir}/httpd/conf/httpd.conf | \ grep -v "# mod_evasive settings" | \ grep -v "Include conf/extra/mod_evasive.conf" \ > %{_sysconfdir}/httpd/conf/tmp_httpd.conf mv -f %{_sysconfdir}/httpd/conf/tmp_httpd.conf %{_sysconfdir}/httpd/conf/httpd.conf echo "Please restart your web server using: '/opt/freeware/sbin/apachectl restart'" fi %post cat %{_sysconfdir}/httpd/conf/httpd.conf | \ grep -v "# mod_evasive settings" | \ grep -v "Include conf/extra/mod_evasive.conf" \ > %{_sysconfdir}/httpd/conf/tmp_httpd.conf mv -f %{_sysconfdir}/httpd/conf/tmp_httpd.conf %{_sysconfdir}/httpd/conf/httpd.conf echo "# mod_evasive settings" >> %{_sysconfdir}/httpd/conf/httpd.conf echo "Include conf/extra/mod_evasive.conf" >> %{_sysconfdir}/httpd/conf/httpd.conf echo "Please restart your web server using: '/opt/freeware/sbin/apachectl restart'" %clean [ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT} %files %defattr(-,root,system,-) %doc README LICENSE CHANGELOG test.pl %config(noreplace) %{_sysconfdir}/httpd/conf/extra/*.conf %{_libdir}/httpd/modules/* %changelog * Thu Nov 13 2014 Michael Perzl - 1.10.1-1 - first version for AIX V5.1 and higher