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