4 |
|
|
5 |
%define name phpki-ng |
%define name phpki-ng |
6 |
%define version 0.84 |
%define version 0.84 |
7 |
%define release 1 |
%define release 16 |
8 |
Summary: Phpki is a simple certificate management suite |
Summary: Phpki is a simple certificate management suite |
9 |
Name: %{name} |
Name: %{name} |
10 |
Version: %{version} |
Version: %{version} |
14 |
Group: SMEserver/addon |
Group: SMEserver/addon |
15 |
#wget http://www.fooweb.com/downloads/foo-3.6.431.tar.gz |
#wget http://www.fooweb.com/downloads/foo-3.6.431.tar.gz |
16 |
Source: %{name}-%{version}.tar.gz |
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 |
|
Patch7: phpki-ng-0.84-fix-html-syntax-in-help.patch |
24 |
|
Patch8: phpki-ng-0.84-fix-final-redirect.patch |
25 |
|
Patch9: phpki-ng-bz12272-bz12273-crl-whitespacepass.patch |
26 |
|
Patch10: phpki-ng-bz12274-regex-secu.patch |
27 |
|
|
28 |
BuildArch: noarch |
BuildArch: noarch |
29 |
BuildRoot: /var/tmp/%{name}-%{version} |
BuildRoot: /var/tmp/%{name}-%{version} |
30 |
|
|
31 |
BuildRequires: e-smith-devtools |
BuildRequires: e-smith-devtools |
32 |
|
|
33 |
Requires: e-smith-release >= 9.0 |
Requires: e-smith-release >= 10.0 |
34 |
Requires: php |
Requires: php74-php-fpm |
35 |
Requires: openssl |
Requires: openssl |
36 |
Requires: openvpn |
Requires: openvpn |
37 |
Conflicts: phpki |
Conflicts: phpki |
40 |
%description |
%description |
41 |
http://sourceforge.net/projects/phpki/ |
http://sourceforge.net/projects/phpki/ |
42 |
https://github.com/radicand/phpki |
https://github.com/radicand/phpki |
43 |
|
https://github.com/reetp/phpki |
44 |
PHPki is an Open Source Web application for managing a multi-agency PKI for HIPAA compliance. |
PHPki is an Open Source Web application for managing a multi-agency PKI for HIPAA compliance. |
45 |
With it, you may create and centrally manage X.509 certificates for use with S/MIME enabled |
With it, you may create and centrally manage X.509 certificates for use with S/MIME enabled |
46 |
e-mail clients, SSL servers, and VPN applications. |
e-mail clients, SSL servers, and VPN applications. |
47 |
|
|
48 |
%changelog |
%changelog |
49 |
|
* Sat Dec 17 2022 Jean-Philippe Pialasse <tests@pialasse.com> 0.84-16.sme |
50 |
|
- add dl_crl_pem.php [SME: 12272] |
51 |
|
|
52 |
|
* Wed Dec 14 2022 Jean-Philippe Pialasse <tests@pialasse.com> 0.84-15.sme |
53 |
|
- fix regex and potential code injection [SME: 12274] |
54 |
|
|
55 |
|
* Wed Dec 14 2022 Jean-Philippe Pialasse <tests@pialasse.com> 0.84-14.sme |
56 |
|
- add easy and safe access to crl download [SME: 12272] |
57 |
|
- fix revoke certificate failing on whitespace pass [SME: 12273] |
58 |
|
- fix missing default_md in config.php from previous versions [SME: 12267] |
59 |
|
- updated scriptlet to ease backup and restore |
60 |
|
|
61 |
|
* Fri Nov 18 2022 Jean-Philippe Pialasse <tests@pialasse.com> 0.84-13.sme |
62 |
|
- remove extra space in URL in search.php [SME: 12232] |
63 |
|
|
64 |
|
* Thu Sep 30 2021 John Crisp <jcrisp@safeandsoundit.co.uk> 0.84-12.sme |
65 |
|
- Attempt to fix the final reload after CA creation [SME: 11192] |
66 |
|
|
67 |
|
* Thu Aug 05 2021 John Crisp <jcrisp@safeandsoundit.co.uk> 0.84-11.sme |
68 |
|
- Fix html syntax error in help - Thanks Mauro De Carolis [SME: 11688] |
69 |
|
|
70 |
|
* Tue Apr 06 2021 John Crisp <jcrisp@safeandsoundit.co.uk> 0.84-10.sme |
71 |
|
- And tidy up the copying wording. [SME: 11192] |
72 |
|
- Credit to Terry Fage for persisting with testing |
73 |
|
|
74 |
|
* Mon Apr 05 2021 John Crisp <jcrisp@safeandsoundit.co.uk> 0.84-9.sme |
75 |
|
- Really fix the copy this time [SME: 11192] |
76 |
|
|
77 |
|
* Sat Apr 03 2021 John Crisp <jcrisp@safeandsoundit.co.uk> 0.84-8.sme |
78 |
|
- copy phpki-store as a backup instead of move [SME: 11192] |
79 |
|
|
80 |
|
* Thu Apr 01 2021 John Crisp <jcrisp@safeandsoundit.co.uk> 0.84-7.sme |
81 |
|
- Fix broken Download Certificate in Cert generation [SME: 11513] |
82 |
|
|
83 |
|
* Thu Mar 18 2021 John Crisp <jcrisp@safeandsoundit.co.uk> 0.84-6.sme |
84 |
|
- Update html header info [SME: 11192] |
85 |
|
- Remove obsolete align |
86 |
|
- Remove accidentally duplicated html |
87 |
|
- Fix typo |
88 |
|
- Fix directory check |
89 |
|
- move function flush_exec to functions file |
90 |
|
|
91 |
|
* Tue Mar 09 2021 John Crisp <jcrisp@safeandsoundit.co.uk> 0.84-5.sme |
92 |
|
- Fix missing / [SME:11435] |
93 |
|
- Update cert type detection for renew [SME: 11436] |
94 |
|
- Code formatting |
95 |
|
|
96 |
|
* Mon Mar 08 2021 John Crisp <jcrisp@safeandsoundit.co.uk> 0.84-4.sme |
97 |
|
- Fix crl creation [SME: 11141] |
98 |
|
- Extra notes in setup page |
99 |
|
|
100 |
|
* Mon Mar 08 2021 John Crisp <jcrisp@safeandsoundit.co.uk> 0.84-3.sme |
101 |
|
- Fix Typo in certificate password [SME: 11435] |
102 |
|
- Fix typos and preg_match issues [SME: 11436] |
103 |
|
- Add Certificate creation notification [SME: 11437] |
104 |
|
- Bit of file formatting |
105 |
|
|
106 |
|
* Wed Mar 03 2021 John Crisp <jcrisp@safeandsoundit.co.uk> 0.84-2.sme |
107 |
|
- Change version to 0.84 |
108 |
|
- Fix undefined constant errors [SME: 11397] |
109 |
|
- fix tempdir [SME: 11398] |
110 |
|
- update code to be PHP 7.4+ compliant |
111 |
|
- format with CodeSniff to PSR2 |
112 |
|
|
113 |
* Wed Apr 01 2020 John Crisp <jcrisp@safeandsoundit.co.uk> 0.84-1.sme |
* Wed Apr 01 2020 John Crisp <jcrisp@safeandsoundit.co.uk> 0.84-1.sme |
114 |
- Rename to php-ng 0.84 |
- Rename to php-ng 0.84 [SME: 11192] |
115 |
- Fix date sorting in certificates |
- Fix date sorting in certificates |
116 |
|
|
117 |
* Thu Mar 19 2020 John Crisp <jcrisp@safeandsoundit.co.uk> 0.83-9.sme |
* Thu Mar 19 2020 John Crisp <jcrisp@safeandsoundit.co.uk> 0.83-9.sme |
143 |
* Fri Feb 28 2020 John Crisp <jcrisp@safeandsoundit.co.uk> 0.83-1.sme |
* Fri Feb 28 2020 John Crisp <jcrisp@safeandsoundit.co.uk> 0.83-1.sme |
144 |
- Update to 0.83 |
- Update to 0.83 |
145 |
|
|
146 |
* Sat Nov 17 2018 Terry Fage <tfage@yahoo.com.au> |
* Sat Nov 17 2018 Terry Fage <tfage@yahoo.com.au> 0.82-19.sme |
147 |
- Fix preg_match warnings [SME:10622] |
- Fix preg_match warnings [SME:10622] |
148 |
|
|
149 |
* Mon Oct 8 2018 Daniel B. <daniel@firewall-services.com> 0.82-18.sme |
* Mon Oct 8 2018 Daniel B. <daniel@firewall-services.com> 0.82-18.sme |
215 |
|
|
216 |
%prep |
%prep |
217 |
%setup -c -n %{name} |
%setup -c -n %{name} |
218 |
|
%patch1 -p1 |
219 |
|
%patch2 -p1 |
220 |
|
%patch3 -p1 |
221 |
|
%patch4 -p1 |
222 |
|
%patch5 -p1 |
223 |
|
%patch6 -p1 |
224 |
|
%patch7 -p1 |
225 |
|
%patch8 -p1 |
226 |
|
%patch9 -p1 |
227 |
|
%patch10 -p1 |
228 |
|
|
229 |
%build |
%build |
230 |
%{__mkdir_p} root/opt/phpki/html |
%{__mkdir_p} root/opt/phpki/html |
239 |
#!/bin/bash |
#!/bin/bash |
240 |
|
|
241 |
cd /opt/phpki/bin |
cd /opt/phpki/bin |
242 |
php ./gen_crl.php 2>&1 > /dev/null |
/usr/bin/php74 ./gen_crl.php 2>&1 > /dev/null |
243 |
|
|
244 |
HERE |
HERE |
245 |
|
|
274 |
rm -rf $RPM_BUILD_ROOT |
rm -rf $RPM_BUILD_ROOT |
275 |
|
|
276 |
%pre |
%pre |
277 |
|
if ! /usr/bin/id phpki &>/dev/null; then |
278 |
|
echo "Creating phpki user" |
279 |
|
/usr/sbin/useradd -c 'Phpki User' -s /sbin/nologin -r -d /opt/phpki/phpki-store phpki &>/dev/null || \ |
280 |
|
%logmsg "Unexpected error adding user \"phpki\". Abort installation." |
281 |
|
fi |
282 |
|
|
283 |
echo "******************************************************" |
echo "******************************************************" |
284 |
echo "* " |
echo "* " |
285 |
echo "* !!! IMPORTANT - READ THIS NOW !!! " |
echo "* !!! IMPORTANT - READ THIS NOW !!! " |
288 |
echo "* This contrib now has higher levels of encryption" |
echo "* This contrib now has higher levels of encryption" |
289 |
echo "* " |
echo "* " |
290 |
echo "* We cannot upgrade your existing certificates" |
echo "* We cannot upgrade your existing certificates" |
291 |
|
echo "* existing certificates from SME9 or below have either " |
292 |
|
echo "* md5WithRSAEncryption sha1WithRSAEncryption" |
293 |
|
echo "* as Signature Algorithm (weak)." |
294 |
|
echo "* only way to update to sha256 or sha512 is to " |
295 |
|
echo "* start from scratch." |
296 |
echo "* " |
echo "* " |
297 |
echo "* If we detect an existing certificate store" |
echo "* If you have existing certificates you want to use" |
298 |
echo "* we are going to move it" |
echo "* then start with a new CA, backup up, and then restore" |
299 |
|
echo "* your phpki-store directory in /opt/phpki" |
300 |
echo "* " |
echo "* " |
|
echo "* You can then start with a new CA and certificates" |
|
301 |
echo "******************************************************" |
echo "******************************************************" |
302 |
echo "" |
echo "" |
303 |
|
|
304 |
if [ -d /opt/phpki/phpki-store ] ; then |
if [ -d /opt/phpki/phpki-store ] ; then |
305 |
echo "Backing up your /opt/phpki/phpki-store" |
echo "Backing up your /opt/phpki/phpki-store" |
306 |
RANDOM=$$ |
today=$(date "+%Y%m%d%H%M") |
307 |
PHPKIDIR=$(( 1 + $RANDOM%99999 )) |
echo "Copying from /opt/phpki/phpki-store to /opt/phpki/phpki-store.$today" |
308 |
echo "Number is $PHPKIDIR" |
/bin/cp -pr /opt/phpki/phpki-store "/opt/phpki/phpki-store.$today" |
309 |
echo "moving from /opt/phpki/phpki-store to /opt/phpki/phpki-store.$PHPKIDIR" |
echo "Directory copied... continuing to install" |
310 |
mv /opt/phpki/phpki-store "/opt/phpki/phpki-store.$PHPKIDIR" |
# fix missing md_default |
311 |
echo "Directory moved...continuing installaton" |
if ( grep default_md /opt/phpki/phpki-store/config/config.php -q ); then |
312 |
|
echo "md_default OK" |
313 |
|
else |
314 |
|
echo "default_md missing in /opt/phpki/phpki-store/config/config.php" |
315 |
|
echo "getting value from /opt/phpki/phpki-store/config/openssl.cnf" |
316 |
|
# it could ba acceptable to hash sha256 a certificate from a root with sha1. |
317 |
|
defaultmd=$(awk '/^default_md/{print $NF}' /opt/phpki/phpki-store/config/openssl.cnf || echo "sha512") |
318 |
|
echo "inserting $defaultmd default_md at end of /opt/phpki/phpki-store/config/config.php" |
319 |
|
sed -i '/\?>/i \ |
320 |
|
# Define default md \ |
321 |
|
\$config['default_md'] = "'$defaultmd'";' /opt/phpki/phpki-store/config/config.php |
322 |
|
echo "Done... continuing to install" |
323 |
|
fi |
324 |
else |
else |
325 |
echo "No directory detected...continuing installaton" |
echo "No directory detected... continuing to install" |
326 |
fi |
fi |
327 |
|
|
|
echo "Creating phpki user" |
|
|
|
|
|
if ! /usr/bin/id phpki &>/dev/null; then |
|
|
/usr/sbin/useradd -c 'Phpki User' -s /sbin/nologin -r -d /opt/phpki/phpki-store phpki &>/dev/null || \ |
|
|
%logmsg "Unexpected error adding user \"phpki\". Abort installation." |
|
|
fi |
|
328 |
|
|
329 |
%preun |
%preun |
330 |
|
|
332 |
%post |
%post |
333 |
# First install, point index.php to setup.php |
# First install, point index.php to setup.php |
334 |
if [ $1 == 1 ]; then |
if [ $1 == 1 ]; then |
335 |
|
#do not do if there is already a CA (restore from backup)) |
336 |
|
if [ ! -f /opt/phpki/phpki-store/config/config.php ] ; then |
337 |
%{__ln_s} /opt/phpki/html/setup.php-presetup /opt/phpki/html/index.php |
%{__ln_s} /opt/phpki/html/setup.php-presetup /opt/phpki/html/index.php |
338 |
%{__ln_s} /opt/phpki/html/setup.php-presetup /opt/phpki/html/setup.php |
%{__ln_s} /opt/phpki/html/setup.php-presetup /opt/phpki/html/setup.php |
339 |
echo "<?php |
fi |
340 |
|
echo "<?php |
341 |
header(\"Location: ./../index.php\"); |
header(\"Location: ./../index.php\"); |
342 |
?> |
?> |
343 |
" > /opt/phpki/html/ca/index.php |
" > /opt/phpki/html/ca/index.php |