1 %define mod_name cloudflare
2 %define apxs %{_sbindir}/apxs
3 Summary: Apache module to show true visitor IPs in logs for domains using CloudFlare
4 Name: apache-mod_%{mod_name}
8 Group: Networking/Daemons/HTTP
9 Source0: https://github.com/cloudflare/mod_cloudflare/archive/98ab38a/mod_%{mod_name}-%{version}.tar.gz
10 # Source0-md5: d618e95ba37e48139858ebadc908b142
12 URL: https://github.com/cloudflare/mod_cloudflare
13 BuildRequires: apache-devel >= 2.2
14 BuildRequires: rpmbuild(macros) >= 1.268
15 Requires: apache(modules-api) = %apache_modules_api
16 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
18 %define _pkglibdir %(%{apxs} -q LIBEXECDIR 2>/dev/null)
19 %define _sysconfdir %(%{apxs} -q SYSCONFDIR 2>/dev/null)/conf.d
22 CloudFlare acts as a proxy, which means that your visitors are routed
23 through the CloudFlare network and you do not see their original IP
26 This module uses HTTP headers provided by the CloudFlare proxy to log
27 the real IP address of the visitor. Based on mod_remoteip.c, this
28 apache extension will replace the remote_ip variable in user's logs
29 with the correct remote_ip sent from CloudFlare. This also does
30 authentication, only performing the switch for requests originating
35 mv mod_cloudflare-*/* .
39 version=$MAJOR.$MINOR.$BUILD
40 test "$version" = %{version}
42 %{apxs} -c mod_%{mod_name}.c
45 rm -rf $RPM_BUILD_ROOT
46 install -d $RPM_BUILD_ROOT{%{_pkglibdir},%{_sysconfdir}}
48 %{apxs} -i -S LIBEXECDIR=$RPM_BUILD_ROOT%{_pkglibdir} -n 'mod_cloudflare' mod_cloudflare.la
50 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/90_mod_%{mod_name}.conf
53 rm -rf $RPM_BUILD_ROOT
56 %service -q httpd restart
59 if [ "$1" = "0" ]; then
60 %service -q httpd restart
64 %defattr(644,root,root,755)
66 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*_mod_%{mod_name}.conf
67 %attr(755,root,root) %{_pkglibdir}/mod_%{mod_name}.so