4 |
|
|
5 |
%define name phpki-ng |
%define name phpki-ng |
6 |
%define version 0.84 |
%define version 0.84 |
7 |
%define release 8 |
%define release 14 |
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} |
20 |
Patch4: phpki-ng-0.84-fix-missing-slash-certtype-detection.patch |
Patch4: phpki-ng-0.84-fix-missing-slash-certtype-detection.patch |
21 |
Patch5: phpki-ng-0.84-fix-html-directory-check.patch |
Patch5: phpki-ng-0.84-fix-html-directory-check.patch |
22 |
Patch6: phpki-ng-0.84-fix-download-cert.patch |
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 |
|
|
27 |
BuildArch: noarch |
BuildArch: noarch |
28 |
BuildRoot: /var/tmp/%{name}-%{version} |
BuildRoot: /var/tmp/%{name}-%{version} |
45 |
e-mail clients, SSL servers, and VPN applications. |
e-mail clients, SSL servers, and VPN applications. |
46 |
|
|
47 |
%changelog |
%changelog |
48 |
* Sat Apr 03 2021 John Crisp <jcrisp@safeandsoundit.co.uk> 0.84-7.sme |
* Wed Dec 14 2022 Jean-Philippe Pialasse <tests@pialasse.com> 0.84-14.sme |
49 |
- copy phpki-store as a backup instead of move |
- add easy and safe access to crl download [SME: 12272] |
50 |
|
- fix revoke certificate failing on whitespace pass [SME: 12273] |
51 |
|
- fix missing default_md in config.php from previous versions [SME: 12267] |
52 |
|
- updated scriptlet to ease backup and restore |
53 |
|
|
54 |
|
* Fri Nov 18 2022 Jean-Philippe Pialasse <tests@pialasse.com> 0.84-13.sme |
55 |
|
- remove extra space in URL in search.php [SME: 12232] |
56 |
|
|
57 |
|
* Thu Sep 30 2021 John Crisp <jcrisp@safeandsoundit.co.uk> 0.84-12.sme |
58 |
|
- Attempt to fix the final reload after CA creation [SME: 11192] |
59 |
|
|
60 |
|
* Thu Aug 05 2021 John Crisp <jcrisp@safeandsoundit.co.uk> 0.84-11.sme |
61 |
|
- Fix html syntax error in help - Thanks Mauro De Carolis [SME: 11688] |
62 |
|
|
63 |
|
* Tue Apr 06 2021 John Crisp <jcrisp@safeandsoundit.co.uk> 0.84-10.sme |
64 |
|
- And tidy up the copying wording. [SME: 11192] |
65 |
|
- Credit to Terry Fage for persisting with testing |
66 |
|
|
67 |
|
* Mon Apr 05 2021 John Crisp <jcrisp@safeandsoundit.co.uk> 0.84-9.sme |
68 |
|
- Really fix the copy this time [SME: 11192] |
69 |
|
|
70 |
|
* Sat Apr 03 2021 John Crisp <jcrisp@safeandsoundit.co.uk> 0.84-8.sme |
71 |
|
- copy phpki-store as a backup instead of move [SME: 11192] |
72 |
|
|
73 |
* Thu Apr 01 2021 John Crisp <jcrisp@safeandsoundit.co.uk> 0.84-7.sme |
* Thu Apr 01 2021 John Crisp <jcrisp@safeandsoundit.co.uk> 0.84-7.sme |
74 |
- Fix broken Download Certificate in Cert generation [SME: 11513] |
- Fix broken Download Certificate in Cert generation [SME: 11513] |
75 |
|
|
76 |
* Thu Mar 18 2021 John Crisp <jcrisp@safeandsoundit.co.uk> 0.84-6.sme |
* Thu Mar 18 2021 John Crisp <jcrisp@safeandsoundit.co.uk> 0.84-6.sme |
77 |
- Update html header info |
- Update html header info [SME: 11192] |
78 |
- Remove obsolete align |
- Remove obsolete align |
79 |
- Remove accidentally duplicated html |
- Remove accidentally duplicated html |
80 |
- Fix typo |
- Fix typo |
214 |
%patch4 -p1 |
%patch4 -p1 |
215 |
%patch5 -p1 |
%patch5 -p1 |
216 |
%patch6 -p1 |
%patch6 -p1 |
217 |
|
%patch7 -p1 |
218 |
|
%patch8 -p1 |
219 |
|
%patch9 -p1 |
220 |
|
|
221 |
%build |
%build |
222 |
%{__mkdir_p} root/opt/phpki/html |
%{__mkdir_p} root/opt/phpki/html |
274 |
echo "* This contrib now has higher levels of encryption" |
echo "* This contrib now has higher levels of encryption" |
275 |
echo "* " |
echo "* " |
276 |
echo "* We cannot upgrade your existing certificates" |
echo "* We cannot upgrade your existing certificates" |
277 |
|
echo "* existing certificates from SME9 or below have either " |
278 |
|
echo "* md5WithRSAEncryption sha1WithRSAEncryption" |
279 |
|
echo "* as Signature Algorithm (weak)." |
280 |
|
echo "* only way to update to sha256 or sha512 is to " |
281 |
|
echo "* start from scratch." |
282 |
echo "* " |
echo "* " |
283 |
echo "* If you have existing certificates you want to use" |
echo "* If you have existing certificates you want to use" |
284 |
echo "* then start with a new CA, backup up, and then restore" |
echo "* then start with a new CA, backup up, and then restore" |
289 |
|
|
290 |
if [ -d /opt/phpki/phpki-store ] ; then |
if [ -d /opt/phpki/phpki-store ] ; then |
291 |
echo "Backing up your /opt/phpki/phpki-store" |
echo "Backing up your /opt/phpki/phpki-store" |
292 |
RANDOM=$$ |
today=$(date "+%Y%m%d%H%M") |
293 |
PHPKIDIR=$(( 1 + $RANDOM%99999 )) |
echo "Copying from /opt/phpki/phpki-store to /opt/phpki/phpki-store.$today" |
294 |
echo "Number is $PHPKIDIR" |
/bin/cp -pr /opt/phpki/phpki-store "/opt/phpki/phpki-store.$today" |
295 |
echo "moving from /opt/phpki/phpki-store to /opt/phpki/phpki-store.$PHPKIDIR" |
echo "Directory copied... continuing to install" |
296 |
mv /opt/phpki/phpki-store "/opt/phpki/phpki-store.$PHPKIDIR" |
# fix missing md_default |
297 |
echo "Directory moved...continuing installaton" |
if ( grep default_md /opt/phpki/phpki-store/config/config.php -q ); then |
298 |
|
echo "md_default OK" |
299 |
|
else |
300 |
|
echo "default_md missing in /opt/phpki/phpki-store/config/config.php" |
301 |
|
echo "getting value from /opt/phpki/phpki-store/config/openssl.cnf" |
302 |
|
# it could ba acceptable to hash sha256 a certificate from a root with sha1. |
303 |
|
defaultmd=$(awk '/^default_md/{print $NF}' /opt/phpki/phpki-store/config/openssl.cnf || echo "sha512") |
304 |
|
echo "inserting $defaultmd default_md at end of /opt/phpki/phpki-store/config/config.php" |
305 |
|
sed -i '/\?>/i \ |
306 |
|
# Define default md \ |
307 |
|
\$config['default_md'] = "'$defaultmd'";' /opt/phpki/phpki-store/config/config.php |
308 |
|
echo "Done... continuing to install" |
309 |
|
fi |
310 |
else |
else |
311 |
echo "No directory detected...continuing installaton" |
echo "No directory detected... continuing to install" |
312 |
fi |
fi |
313 |
|
|
314 |
echo "Creating phpki user" |
|
315 |
|
|
316 |
if ! /usr/bin/id phpki &>/dev/null; then |
if ! /usr/bin/id phpki &>/dev/null; then |
317 |
/usr/sbin/useradd -c 'Phpki User' -s /sbin/nologin -r -d /opt/phpki/phpki-store phpki &>/dev/null || \ |
echo "Creating phpki user" |
318 |
|
/usr/sbin/useradd -c 'Phpki User' -s /sbin/nologin -r -d /opt/phpki/phpki-store phpki &>/dev/null || \ |
319 |
%logmsg "Unexpected error adding user \"phpki\". Abort installation." |
%logmsg "Unexpected error adding user \"phpki\". Abort installation." |
320 |
fi |
fi |
321 |
|
|
325 |
%post |
%post |
326 |
# First install, point index.php to setup.php |
# First install, point index.php to setup.php |
327 |
if [ $1 == 1 ]; then |
if [ $1 == 1 ]; then |
328 |
|
#do not do if there is already a CA (restore from backup)) |
329 |
|
if [ ! -f /opt/phpki/phpki-store/config/config.php ] ; then |
330 |
%{__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 |
331 |
%{__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 |
332 |
echo "<?php |
fi |
333 |
|
echo "<?php |
334 |
header(\"Location: ./../index.php\"); |
header(\"Location: ./../index.php\"); |
335 |
?> |
?> |
336 |
" > /opt/phpki/html/ca/index.php |
" > /opt/phpki/html/ca/index.php |