]>
Commit | Line | Data |
---|---|---|
b4ff000f ER |
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} | |
5 | Version: 1.2.0 | |
6 | Release: 1 | |
7 | License: Apache v2.0 | |
8 | Group: Networking/Daemons/HTTP | |
9 | Source0: https://github.com/cloudflare/mod_cloudflare/archive/master/mod_%{mod_name}-%{version}.tar.gz | |
10 | # Source0-md5: d87e1c38dba2c282bfae9341e0f3c3e7 | |
11 | Source1: apache.conf | |
12 | BuildRequires: apache-devel >= 2.2 | |
13 | BuildRequires: rpmbuild(macros) >= 1.268 | |
14 | Requires: apache(modules-api) = %apache_modules_api | |
15 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
16 | ||
17 | %define _pkglibdir %(%{apxs} -q LIBEXECDIR 2>/dev/null) | |
18 | %define _sysconfdir %(%{apxs} -q SYSCONFDIR 2>/dev/null)/conf.d | |
19 | ||
20 | %description | |
21 | CloudFlare acts as a proxy, which means that your visitors are routed | |
22 | through the CloudFlare network and you do not see their original IP | |
23 | address. | |
24 | ||
25 | This module uses HTTP headers provided by the CloudFlare proxy to log | |
26 | the real IP address of the visitor. Based on mod_remoteip.c, this | |
27 | apache extension will replace the remote_ip variable in user's logs | |
28 | with the correct remote_ip sent from CloudFlare. This also does | |
29 | authentication, only performing the switch for requests originating | |
30 | from CloudFlare IPs. | |
31 | ||
32 | %prep | |
33 | %setup -qc | |
34 | mv mod_cloudflare-*/* . | |
35 | ||
36 | %build | |
37 | %{apxs} -c mod_%{mod_name}.c -o mod_%{mod_name}.so | |
38 | ||
39 | %install | |
40 | rm -rf $RPM_BUILD_ROOT | |
41 | install -d $RPM_BUILD_ROOT{%{_pkglibdir},%{_sysconfdir}} | |
42 | install -p mod_%{mod_name}.so $RPM_BUILD_ROOT%{_pkglibdir} | |
43 | cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/90_mod_%{mod_name}.conf | |
44 | ||
45 | %clean | |
46 | rm -rf $RPM_BUILD_ROOT | |
47 | ||
48 | %post | |
49 | %service -q httpd restart | |
50 | ||
51 | %postun | |
52 | if [ "$1" = "0" ]; then | |
53 | %service -q httpd restart | |
54 | fi | |
55 | ||
56 | %files | |
57 | %defattr(644,root,root,755) | |
58 | %doc README.md | |
59 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*_mod_%{mod_name}.conf | |
60 | %attr(755,root,root) %{_pkglibdir}/mod_%{mod_name}.so |