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