]>
Commit | Line | Data |
---|---|---|
2459bb24 AG |
1 | # |
2 | # Available build options: | |
2f710cc9 | 3 | %bcond_with checkpath # enable check if php execution is within DOCUMENT_ROOT of the vhost |
2459bb24 AG |
4 | # |
5 | %define mod_name suphp | |
6 | %define apxs /usr/sbin/apxs1 | |
7 | Summary: Apache module: suPHP - execute PHP scripts with the permissions of their owners | |
626f4d51 | 8 | Summary(pl.UTF-8): Moduł do apache: suPHP - uruchamianie skryptów PHP z uprawnieniami ich właścicieli |
2459bb24 | 9 | Name: apache1-mod_%{mod_name} |
d9dee5ee JB |
10 | Version: 0.6.1 |
11 | Release: 1 | |
2459bb24 AG |
12 | License: GPL |
13 | Group: Networking/Daemons | |
2f710cc9 | 14 | Source0: http://www.suphp.org/download/%{mod_name}-%{version}.tar.gz |
2459bb24 | 15 | # Source0-md5: 337909e87027af124052baddddbd2994 |
d9dee5ee JB |
16 | Source1: %{name}.logrotate |
17 | Source2: %{name}.conf | |
18 | Source2: %{name}-suphp.conf | |
19 | Patch0: %{name}-apr.patch | |
20 | Patch1: %{name}-notallowed.patch | |
2459bb24 | 21 | URL: http://www.suphp.org/ |
d9dee5ee | 22 | BuildRequires: %{apxs} |
2f710cc9 | 23 | BuildRequires: apache1-devel >= 1.3.33-2 |
2459bb24 AG |
24 | BuildRequires: autoconf |
25 | BuildRequires: automake | |
d9dee5ee JB |
26 | BuildRequires: libstdc++-devel |
27 | BuildRequires: rpmbuild(macros) >= 1.268 | |
2f710cc9 ER |
28 | Requires(triggerpostun): %{apxs} |
29 | Requires(triggerpostun): grep | |
30 | Requires(triggerpostun): sed >= 4.0 | |
d9dee5ee | 31 | Requires: apache1 |
2459bb24 AG |
32 | Requires: php-cgi |
33 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
34 | ||
2f710cc9 ER |
35 | %define _pkglibdir %(%{apxs} -q LIBEXECDIR 2>/dev/null) |
36 | %define _sysconfdir %(%{apxs} -q SYSCONFDIR 2>/dev/null) | |
2459bb24 AG |
37 | |
38 | %description | |
2f710cc9 ER |
39 | suPHP is a tool for executing PHP scripts with the permissions of |
40 | their owners. It consists of an Apache module (mod_suphp) and a setuid | |
41 | root binary (suphp) that is called by the Apache module to change the | |
42 | uid of the process executing the PHP interpreter. | |
2459bb24 | 43 | |
2ae448b3 JR |
44 | %description -l pl.UTF-8 |
45 | suPHP jest narzędziem pozwalającym na wykonywanie skryptów w PHP z | |
46 | uprawnieniami ich właścicieli. Składa się z modułu (mod_suphp) oraz | |
47 | programu (suphp) z ustawionym bitem suid, który uruchamiany jest przez | |
48 | moduł w celu zmiany uid procesu uruchamiającego interpreter PHP. | |
2459bb24 AG |
49 | |
50 | %prep | |
51 | %setup -q -n %{mod_name}-%{version} | |
d9dee5ee JB |
52 | %patch0 -p1 |
53 | %patch1 -p1 | |
89962859 | 54 | |
2459bb24 AG |
55 | %build |
56 | %{__aclocal} | |
57 | %{__autoconf} | |
58 | %{__autoheader} | |
d9dee5ee JB |
59 | %{__automake} |
60 | export APACHE_VERSION=$(rpm -q --qf '%%{version}' apache1-apxs) | |
2459bb24 AG |
61 | %configure \ |
62 | %{?with_checkpath: --enable-checkpath} \ | |
63 | %{!?with_checkpath: --disable-checkpath} \ | |
64 | --with-apache-user=http \ | |
65 | --with-min-uid=500 \ | |
66 | --with-min-gid=1000 \ | |
67 | --with-apxs=%{apxs} \ | |
68 | --disable-checkuid \ | |
d9dee5ee JB |
69 | --disable-checkgid \ |
70 | --with-setid-mode=owner \ | |
71 | --with-logfile=/var/log/apache/suphp_log | |
2459bb24 AG |
72 | |
73 | %{__make} | |
74 | ||
75 | %install | |
76 | rm -rf $RPM_BUILD_ROOT | |
2f710cc9 | 77 | install -d $RPM_BUILD_ROOT{%{_sbindir},%{_pkglibdir},%{_sysconfdir}/conf.d} |
2459bb24 AG |
78 | |
79 | install src/suphp $RPM_BUILD_ROOT%{_sbindir} | |
d9dee5ee JB |
80 | install src/apache/.libs/mod_%{mod_name}.so $RPM_BUILD_ROOT%{_pkglibdir} |
81 | install %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/conf.d/90_mod_%{mod_name}.conf | |
82 | install %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/%{mod_name}.conf | |
2459bb24 AG |
83 | |
84 | install -d $RPM_BUILD_ROOT/etc/logrotate.d | |
2f710cc9 | 85 | # TODO: apache1-mod_suphp + trigger |
d9dee5ee | 86 | install %{SOURCE1} $RPM_BUILD_ROOT/etc/logrotate.d/apache-mod_suphp |
2459bb24 AG |
87 | |
88 | %clean | |
89 | rm -rf $RPM_BUILD_ROOT | |
90 | ||
91 | %post | |
bc1164b7 | 92 | %service -q apache restart |
2459bb24 | 93 | |
f75a3dad | 94 | %postun |
2459bb24 | 95 | if [ "$1" = "0" ]; then |
bc1164b7 | 96 | %service -q apache restart |
2459bb24 AG |
97 | fi |
98 | ||
2f710cc9 ER |
99 | # TODO remove the trigger, if no longer needed |
100 | %triggerpostun -- %{name} <= 0.5.2-1 | |
101 | if grep -q '^Include conf\.d' /etc/apache/apache.conf; then | |
102 | %{apxs} -e -A -n %{mod_name} %{_pkglibdir}/mod_%{mod_name}.so 1>&2 | |
103 | sed -i -e ' | |
104 | /^Include.*mod_%{mod_name}\.conf/d | |
105 | ' /etc/apache/apache.conf | |
2da50204 | 106 | |
bc1164b7 | 107 | %service -q apache restart |
2f710cc9 ER |
108 | fi |
109 | ||
2459bb24 AG |
110 | %files |
111 | %defattr(644,root,root,755) | |
d9dee5ee | 112 | %doc AUTHORS ChangeLog README doc |
2459bb24 | 113 | %attr(4755,root,root) %{_sbindir}/suphp |
d9dee5ee | 114 | %attr(755,root,root) %{_pkglibdir}/*.so |
2f710cc9 ER |
115 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/* |
116 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/*_mod_%{mod_name}.conf | |
d9dee5ee | 117 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{mod_name}.conf |