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