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