1 |
# $Id: phpki-ng.spec,v 1.4 2018/11/17 13:20:42 jcrisp Exp $ |
2 |
# Authority: vip-ire |
3 |
# Name: Daniel Berteaud |
4 |
|
5 |
%define name phpki-ng |
6 |
%define version 0.84 |
7 |
%define release 12 |
8 |
Summary: Phpki is a simple certificate management suite |
9 |
Name: %{name} |
10 |
Version: %{version} |
11 |
Release: %{release}%{?dist} |
12 |
License: GNU GPL version 2 |
13 |
URL: http://sourceforge.net/projects/phpki/ |
14 |
Group: SMEserver/addon |
15 |
#wget http://www.fooweb.com/downloads/foo-3.6.431.tar.gz |
16 |
Source: %{name}-%{version}.tar.gz |
17 |
Patch1: phpki-ng-0.84-fix-for-php74-code-tidy.patch |
18 |
Patch2: phpki-ng-0.84-fix-pregmatch-revoke-certs.patch |
19 |
Patch3: phpki-ng-0.84-fix-crl.patch |
20 |
Patch4: phpki-ng-0.84-fix-missing-slash-certtype-detection.patch |
21 |
Patch5: phpki-ng-0.84-fix-html-directory-check.patch |
22 |
Patch6: phpki-ng-0.84-fix-download-cert.patch |
23 |
Patch7: phpki-ng-0.84-fix-html-syntax-in-help.patch |
24 |
Patch8: phpki-ng-0.84-fix-final-redirect.patch |
25 |
|
26 |
|
27 |
BuildArch: noarch |
28 |
BuildRoot: /var/tmp/%{name}-%{version} |
29 |
|
30 |
BuildRequires: e-smith-devtools |
31 |
|
32 |
Requires: e-smith-release >= 10.0 |
33 |
Requires: php74-php-fpm |
34 |
Requires: openssl |
35 |
Requires: openvpn |
36 |
Conflicts: phpki |
37 |
AutoReqProv: no |
38 |
|
39 |
%description |
40 |
http://sourceforge.net/projects/phpki/ |
41 |
https://github.com/radicand/phpki |
42 |
https://github.com/reetp/phpki |
43 |
PHPki is an Open Source Web application for managing a multi-agency PKI for HIPAA compliance. |
44 |
With it, you may create and centrally manage X.509 certificates for use with S/MIME enabled |
45 |
e-mail clients, SSL servers, and VPN applications. |
46 |
|
47 |
%changelog |
48 |
* Thu Sep 30 2021 John Crisp <jcrisp@safeandsoundit.co.uk> 0.84-12.sme |
49 |
- Attempt to fix the final reload after CA creation [SME: 11192] |
50 |
|
51 |
* Thu Aug 05 2021 John Crisp <jcrisp@safeandsoundit.co.uk> 0.84-11.sme |
52 |
- Fix html syntax error in help - Thanks Mauro De Carolis [SME: 11688] |
53 |
|
54 |
* Tue Apr 06 2021 John Crisp <jcrisp@safeandsoundit.co.uk> 0.84-10.sme |
55 |
- And tidy up the copying wording. [SME: 11192] |
56 |
- Credit to Terry Fage for persisting with testing |
57 |
|
58 |
* Mon Apr 05 2021 John Crisp <jcrisp@safeandsoundit.co.uk> 0.84-9.sme |
59 |
- Really fix the copy this time [SME: 11192] |
60 |
|
61 |
* Sat Apr 03 2021 John Crisp <jcrisp@safeandsoundit.co.uk> 0.84-8.sme |
62 |
- copy phpki-store as a backup instead of move [SME: 11192] |
63 |
|
64 |
* Thu Apr 01 2021 John Crisp <jcrisp@safeandsoundit.co.uk> 0.84-7.sme |
65 |
- Fix broken Download Certificate in Cert generation [SME: 11513] |
66 |
|
67 |
* Thu Mar 18 2021 John Crisp <jcrisp@safeandsoundit.co.uk> 0.84-6.sme |
68 |
- Update html header info [SME: 11192] |
69 |
- Remove obsolete align |
70 |
- Remove accidentally duplicated html |
71 |
- Fix typo |
72 |
- Fix directory check |
73 |
- move function flush_exec to functions file |
74 |
|
75 |
* Tue Mar 09 2021 John Crisp <jcrisp@safeandsoundit.co.uk> 0.84-5.sme |
76 |
- Fix missing / [SME:11435] |
77 |
- Update cert type detection for renew [SME: 11436] |
78 |
- Code formatting |
79 |
|
80 |
* Mon Mar 08 2021 John Crisp <jcrisp@safeandsoundit.co.uk> 0.84-4.sme |
81 |
- Fix crl creation [SME: 11141] |
82 |
- Extra notes in setup page |
83 |
|
84 |
* Mon Mar 08 2021 John Crisp <jcrisp@safeandsoundit.co.uk> 0.84-3.sme |
85 |
- Fix Typo in certificate password [SME: 11435] |
86 |
- Fix typos and preg_match issues [SME: 11436] |
87 |
- Add Certificate creation notification [SME: 11437] |
88 |
- Bit of file formatting |
89 |
|
90 |
* Wed Mar 03 2021 John Crisp <jcrisp@safeandsoundit.co.uk> 0.84-2.sme |
91 |
- Change version to 0.84 |
92 |
- Fix undefined constant errors [SME: 11397] |
93 |
- fix tempdir [SME: 11398] |
94 |
- update code to be PHP 7.4+ compliant |
95 |
- format with CodeSniff to PSR2 |
96 |
|
97 |
* Wed Apr 01 2020 John Crisp <jcrisp@safeandsoundit.co.uk> 0.84-1.sme |
98 |
- Rename to php-ng 0.84 [SME: 11192] |
99 |
- Fix date sorting in certificates |
100 |
|
101 |
* Thu Mar 19 2020 John Crisp <jcrisp@safeandsoundit.co.uk> 0.83-9.sme |
102 |
- Update DH to 2048 |
103 |
|
104 |
* Mon Mar 09 2020 John Crisp <jcrisp@safeandsoundit.co.uk> 0.83-8.sme |
105 |
- move warning and exit to %pre |
106 |
|
107 |
* Sat Mar 07 2020 John Crisp <jcrisp@safeandsoundit.co.uk> 0.83-7.sme |
108 |
- Lots of formatting - adding quotes to items and tidying up |
109 |
- set default md to 512 |
110 |
|
111 |
* Wed Mar 04 2020 John Crisp <jcrisp@safeandsoundit.co.uk> 0.83-6.sme |
112 |
- Fix renew-cert |
113 |
- revert DH setup so you can see progress |
114 |
|
115 |
* Wed Mar 04 2020 John Crisp <jcrisp@safeandsoundit.co.uk> 0.83-5.sme |
116 |
- Fix create cert without password |
117 |
|
118 |
* Wed Mar 04 2020 John Crisp <jcrisp@safeandsoundit.co.uk> 0.83-4.sme |
119 |
- Fix openvpn error |
120 |
|
121 |
* Tue Mar 03 2020 John Crisp <jcrisp@safeandsoundit.co.uk> 0.83-3.sme |
122 |
- more fixes |
123 |
|
124 |
* Sat Feb 29 2020 John Crisp <jcrisp@safeandsoundit.co.uk> 0.83-2.sme |
125 |
- small fixes |
126 |
|
127 |
* Fri Feb 28 2020 John Crisp <jcrisp@safeandsoundit.co.uk> 0.83-1.sme |
128 |
- Update to 0.83 |
129 |
|
130 |
* Sat Nov 17 2018 Terry Fage <tfage@yahoo.com.au> 0.82-19.sme |
131 |
- Fix preg_match warnings [SME:10622] |
132 |
|
133 |
* Mon Oct 8 2018 Daniel B. <daniel@firewall-services.com> 0.82-18.sme |
134 |
- Fix potential XSS with unsafe use of PHP_SELF [SME: 10626] |
135 |
|
136 |
* Thu Sep 6 2018 brian r. <brianr@bjsystems.co.uk> 0.82-17.sme |
137 |
- Replace use of ereg by preg_replace as per deprecated in php 5.3 and removed in 7.0 |
138 |
- [SME: 10622] |
139 |
|
140 |
* Mon Dec 12 2011 Daniel B. <daniel@firewall-services.com> 0.82-16.sme |
141 |
- Remove php-posix dependency (not available, nor needed on SME 7.x) [SME: 6805] |
142 |
|
143 |
* Wed Oct 26 2011 Daniel B. <daniel@firewall-services.com> 0.82-15.sme |
144 |
- Requires php-posix |
145 |
|
146 |
* Wed Jun 29 2011 Daniel B. <daniel@firewall-services.com> 0.82-14.sme |
147 |
- Don't check issuer (everyone allowed to access /ca can manage |
148 |
all the certificates, access to /ca is controlled by apache) |
149 |
|
150 |
* Tue Mar 15 2011 Daniel B. <daniel@firewall-services.com> 0.82-13.sme |
151 |
- Replace md5 with sha1 for signing |
152 |
|
153 |
* Fri May 28 2010 Daniel B. <daniel@firewall-services.com> [0.82-12] |
154 |
- Weekly update the CRL via cron so MS Crypto API will be happy |
155 |
|
156 |
* Thu Mar 18 2010 Daniel B. <daniel@firewall-services.com> [0.82-11] |
157 |
- Fixe empty password with PHP 5.2 (SME 8b5) |
158 |
|
159 |
* Wed Aug 26 2009 Daniel B. <daniel@firewall-services.com> [0.82-10] |
160 |
- Fixe links for CA help page |
161 |
|
162 |
* Mon Mar 23 2009 Daniel B. <daniel@firewall-services.com> [0.82-9] |
163 |
- Remove links after uninstall so you can easily re-install the contrib |
164 |
later [SME: 5091] |
165 |
|
166 |
* Tue Mar 03 2009 Daniel B. <daniel@firewall-services.com> [0.82-8] |
167 |
- Add e-smith-devtools as a dependencie |
168 |
|
169 |
* Tue Jan 20 2009 Daniel B. <daniel@firewall-services.com> [0.82-7] |
170 |
- Don't replace config file on upgrades |
171 |
|
172 |
* Wed Jan 07 2009 Daniel B. <daniel@firewall-services.com> [0.82-6] |
173 |
- Remove the email address from the file name during upload (in search page) |
174 |
- Remove secure.sh script |
175 |
|
176 |
* Tue Dec 16 2008 Daniel B. <daniel@firewall-services.com> [0.82-5] |
177 |
- Link index.php to setup-presetup.php |
178 |
|
179 |
* Mon Dec 08 2008 Daniel B. <daniel@firewall-services.com> [0.82-4] |
180 |
- Changes so certificates imported from openvpn-bridge are recognized |
181 |
- Configure default admin user to 'admin' |
182 |
- Create a static key for OpenVPN TLS auth (requires openvpn) |
183 |
- Add expirey values (3 Months, 6 Months) |
184 |
- Display or download takey.pem and dhparam1024.pem from |
185 |
the certificate management menue |
186 |
- Display the Root certificate in PEM format |
187 |
- Possibility to download the CRL in PEM format |
188 |
- Remove the email address from the file name during upload |
189 |
- Disable download of certificate after creating a new one |
190 |
- Remove security warning after setup |
191 |
|
192 |
* Fri Dec 05 2008 Daniel B. <daniel@firewall-services.com> [0.82-3] |
193 |
- Correct extension name for email_signing certificates |
194 |
- Remove links, and recreate them in the %post section so upgrade can be done smoothly |
195 |
|
196 |
* Wed Nov 26 2008 Daniel B. <daniel@firewall-services.com> [0.82-0] |
197 |
- initial release |
198 |
- builds from unchanged .tar.gz |
199 |
|
200 |
%prep |
201 |
%setup -c -n %{name} |
202 |
%patch1 -p1 |
203 |
%patch2 -p1 |
204 |
%patch3 -p1 |
205 |
%patch4 -p1 |
206 |
%patch5 -p1 |
207 |
%patch6 -p1 |
208 |
%patch7 -p1 |
209 |
%patch8 -p1 |
210 |
|
211 |
%build |
212 |
%{__mkdir_p} root/opt/phpki/html |
213 |
%{__mkdir_p} root/opt/phpki/phpki-store |
214 |
%{__mkdir_p} root/opt/phpki/bin |
215 |
%{__mkdir_p} root/%{_sysconfdir}/cron.weekly/ |
216 |
%{__mv} %{name}-%{version}/gen_crl.php root/opt/phpki/bin/ |
217 |
%{__mv} %{name}-%{version}/* root/opt/phpki/html/ |
218 |
|
219 |
|
220 |
cat <<"HERE" > root/%{_sysconfdir}/cron.weekly/phpki_update_crl |
221 |
#!/bin/bash |
222 |
|
223 |
cd /opt/phpki/bin |
224 |
/usr/bin/php74 ./gen_crl.php 2>&1 > /dev/null |
225 |
|
226 |
HERE |
227 |
|
228 |
|
229 |
# Remove links to setup page so upgrades can be done smoothly |
230 |
%{__rm} -f root/opt/phpki/html/index.php |
231 |
%{__rm} -f root/opt/phpki/html/ca/index.php |
232 |
%{__rm} -f root/opt/phpki/html/setup.php |
233 |
|
234 |
# This script shouldn't be here |
235 |
%{__rm} -f root/opt/phpki/html/secure.sh |
236 |
|
237 |
|
238 |
%install |
239 |
rm -rf $RPM_BUILD_ROOT |
240 |
(cd root ; find . -depth -print | cpio -dump $RPM_BUILD_ROOT) |
241 |
rm -f %{name}-%{version}-filelist |
242 |
/sbin/e-smith/genfilelist $RPM_BUILD_ROOT \ |
243 |
--file '/opt/phpki/html/config.php' 'attr(660,root,phpki) %config(noreplace)' \ |
244 |
--file '/opt/phpki/html/openssl.cnf' 'attr(660,root,phpki) %config(noreplace)' \ |
245 |
--file '%{_sysconfdir}/cron.weekly/phpki_update_crl' 'attr(744,root,root)' \ |
246 |
--dir '/opt/phpki/html' 'attr(770,root,phpki)' \ |
247 |
--dir '/opt/phpki/html/ca' 'attr(770,root,phpki)' \ |
248 |
--dir '/opt/phpki/phpki-store' 'attr(750,phpki,phpki)' \ |
249 |
> %{name}-%{version}-filelist |
250 |
|
251 |
%files -f %{name}-%{version}-filelist |
252 |
%defattr(-,root,root) |
253 |
|
254 |
%clean |
255 |
cd .. |
256 |
rm -rf $RPM_BUILD_ROOT |
257 |
|
258 |
%pre |
259 |
echo "******************************************************" |
260 |
echo "* " |
261 |
echo "* !!! IMPORTANT - READ THIS NOW !!! " |
262 |
echo "* " |
263 |
echo "******************************************************" |
264 |
echo "* This contrib now has higher levels of encryption" |
265 |
echo "* " |
266 |
echo "* We cannot upgrade your existing certificates" |
267 |
echo "* " |
268 |
echo "* If you have existing certificates you want to use" |
269 |
echo "* then start with a new CA, backup up, and then restore" |
270 |
echo "* your phpki-store directory in /opt/phpki" |
271 |
echo "* " |
272 |
echo "******************************************************" |
273 |
echo "" |
274 |
|
275 |
if [ -d /opt/phpki/phpki-store ] ; then |
276 |
echo "Backing up your /opt/phpki/phpki-store" |
277 |
RANDOM=$$ |
278 |
PHPKIDIR=$(( 1 + $RANDOM%99999 )) |
279 |
echo "Number is $PHPKIDIR" |
280 |
echo "Copying from /opt/phpki/phpki-store to /opt/phpki/phpki-store.$PHPKIDIR" |
281 |
/bin/cp -pr /opt/phpki/phpki-store "/opt/phpki/phpki-store.$PHPKIDIR" |
282 |
echo "Directory copied...continuing installaton" |
283 |
else |
284 |
echo "No directory detected...continuing installaton" |
285 |
fi |
286 |
|
287 |
|
288 |
|
289 |
if ! /usr/bin/id phpki &>/dev/null; then |
290 |
echo "Creating phpki user" |
291 |
/usr/sbin/useradd -c 'Phpki User' -s /sbin/nologin -r -d /opt/phpki/phpki-store phpki &>/dev/null || \ |
292 |
%logmsg "Unexpected error adding user \"phpki\". Abort installation." |
293 |
fi |
294 |
|
295 |
%preun |
296 |
|
297 |
|
298 |
%post |
299 |
# First install, point index.php to setup.php |
300 |
if [ $1 == 1 ]; then |
301 |
%{__ln_s} /opt/phpki/html/setup.php-presetup /opt/phpki/html/index.php |
302 |
%{__ln_s} /opt/phpki/html/setup.php-presetup /opt/phpki/html/setup.php |
303 |
echo "<?php |
304 |
header(\"Location: ./../index.php\"); |
305 |
?> |
306 |
" > /opt/phpki/html/ca/index.php |
307 |
fi |
308 |
|
309 |
|
310 |
%postun |
311 |
# Remove the links to index.php after uninstall |
312 |
if [ $1 == 0 ]; then |
313 |
%{__rm} -f /opt/phpki/html/index.php |
314 |
%{__rm} -f /opt/phpki/html/setup.php |
315 |
%{__rm} -f /opt/phpki/html/ca/index.php |
316 |
fi |
317 |
|
318 |
true |