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