]>
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} | |
b11b0a63 | 5 | Version: 1.2.1 |
b4ff000f ER |
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 | |
b11b0a63 | 10 | # Source0-md5: b451823076713c1faa64c09e111a98b8 |
b4ff000f ER |
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 | |
b11b0a63 | 37 | %{apxs} -c mod_%{mod_name}.c |
b4ff000f ER |
38 | |
39 | %install | |
40 | rm -rf $RPM_BUILD_ROOT | |
41 | install -d $RPM_BUILD_ROOT{%{_pkglibdir},%{_sysconfdir}} | |
b11b0a63 AM |
42 | |
43 | %{apxs} -i -S LIBEXECDIR=$RPM_BUILD_ROOT%{_pkglibdir} -n 'mod_cloudflare' mod_cloudflare.la | |
44 | ||
b4ff000f ER |
45 | cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/90_mod_%{mod_name}.conf |
46 | ||
47 | %clean | |
48 | rm -rf $RPM_BUILD_ROOT | |
49 | ||
50 | %post | |
51 | %service -q httpd restart | |
52 | ||
53 | %postun | |
54 | if [ "$1" = "0" ]; then | |
55 | %service -q httpd restart | |
56 | fi | |
57 | ||
58 | %files | |
59 | %defattr(644,root,root,755) | |
60 | %doc README.md | |
61 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*_mod_%{mod_name}.conf | |
62 | %attr(755,root,root) %{_pkglibdir}/mod_%{mod_name}.so |