| 1 | #
|
|---|
| 2 | # YD must point to local java installation!
|
|---|
| 3 | %define java_dir d:/os2/java160
|
|---|
| 4 |
|
|---|
| 5 | # certdata.txt is generated by extracting it from Mozilla HG.
|
|---|
| 6 | # This is done by downloading latest certdata.txt from:
|
|---|
| 7 | #
|
|---|
| 8 | # https://hg.mozilla.org/releases/mozilla-release/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt
|
|---|
| 9 |
|
|---|
| 10 | %define pkidir %{_sysconfdir}/pki
|
|---|
| 11 |
|
|---|
| 12 | Summary: The Mozilla CA root certificate bundle
|
|---|
| 13 | Name: ca-certificates
|
|---|
| 14 | Version: 2016.06
|
|---|
| 15 | Release: 1%{?dist}
|
|---|
| 16 | License: Public Domain
|
|---|
| 17 | Group: System Environment/Base
|
|---|
| 18 | URL: http://www.mozilla.org/
|
|---|
| 19 |
|
|---|
| 20 | Source0: ca-certificates.zip
|
|---|
| 21 |
|
|---|
| 22 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
|
|---|
| 23 | #BuildRequires: java-openjdk, rcs
|
|---|
| 24 | BuildRequires: perl, python
|
|---|
| 25 | BuildArch: noarch
|
|---|
| 26 |
|
|---|
| 27 | %description
|
|---|
| 28 | This package contains the set of CA certificates chosen by the
|
|---|
| 29 | Mozilla Foundation for use with the Internet PKI.
|
|---|
| 30 |
|
|---|
| 31 | %prep
|
|---|
| 32 | %setup -c
|
|---|
| 33 | mkdir certs java
|
|---|
| 34 |
|
|---|
| 35 | %build
|
|---|
| 36 |
|
|---|
| 37 | cp certdata.txt certs
|
|---|
| 38 | cp blacklist.txt certs
|
|---|
| 39 | cd certs
|
|---|
| 40 | python ../certdata2pem.py
|
|---|
| 41 | cd ..
|
|---|
| 42 |
|
|---|
| 43 | (
|
|---|
| 44 | cat <<EOF
|
|---|
| 45 | # This is a bundle of X.509 certificates of public Certificate
|
|---|
| 46 | # Authorities. It was generated from the Mozilla root CA list.
|
|---|
| 47 | #
|
|---|
| 48 | # Source: mozilla/security/nss/lib/ckfw/builtins/certdata.txt
|
|---|
| 49 | #
|
|---|
| 50 | # Generated from:
|
|---|
| 51 | EOF
|
|---|
| 52 | ident -q certdata.txt | sed '1d;s/^/#/';
|
|---|
| 53 | echo '#';
|
|---|
| 54 | ) > ca-bundle.crt
|
|---|
| 55 | (
|
|---|
| 56 | cat <<EOF
|
|---|
| 57 | # This is a bundle of X.509 certificates of public Certificate
|
|---|
| 58 | # Authorities. It was generated from the Mozilla root CA list.
|
|---|
| 59 | # These certificates are in the OpenSSL "TRUSTED CERTIFICATE"
|
|---|
| 60 | # format and have trust bits set accordingly.
|
|---|
| 61 | #
|
|---|
| 62 | # Source: mozilla/security/nss/lib/ckfw/builtins/certdata.txt
|
|---|
| 63 | #
|
|---|
| 64 | # Generated from:
|
|---|
| 65 | EOF
|
|---|
| 66 | ident -q certdata.txt | sed '1d;s/^/#/';
|
|---|
| 67 | echo '#';
|
|---|
| 68 | ) > ca-bundle.trust.crt
|
|---|
| 69 | for f in certs/*.crt; do
|
|---|
| 70 | tbits=`sed -n '/^# openssl-trust/{s/^.*=//;p;}' $f`
|
|---|
| 71 | case $tbits in
|
|---|
| 72 | *serverAuth*) openssl x509 -text -in "$f" >> ca-bundle.crt ;;
|
|---|
| 73 | esac
|
|---|
| 74 | if [ -n "$tbits" ]; then
|
|---|
| 75 | targs=""
|
|---|
| 76 | for t in $tbits; do
|
|---|
| 77 | targs="${targs} -addtrust $t"
|
|---|
| 78 | done
|
|---|
| 79 | openssl x509 -text -in "$f" -trustout $targs >> ca-bundle.trust.crt
|
|---|
| 80 | fi
|
|---|
| 81 | done
|
|---|
| 82 |
|
|---|
| 83 | export PATH="%{java_dir}/bin${PATH:+;$PATH}"
|
|---|
| 84 | export BEGINLIBPATH="%{java_dir}/bin${BEGINLIBPATH:+;$BEGINLIBPATH}"
|
|---|
| 85 |
|
|---|
| 86 | cd java
|
|---|
| 87 | test -s ../ca-bundle.crt || exit 1
|
|---|
| 88 | %{__perl} ../generate-cacerts.pl %{java_dir}/bin/keytool.exe ../ca-bundle.crt
|
|---|
| 89 | touch -r ../certdata.txt cacerts
|
|---|
| 90 | cd ..
|
|---|
| 91 |
|
|---|
| 92 | %install
|
|---|
| 93 | rm -rf $RPM_BUILD_ROOT
|
|---|
| 94 |
|
|---|
| 95 | mkdir -p $RPM_BUILD_ROOT%{pkidir}/tls/certs
|
|---|
| 96 | mkdir -p $RPM_BUILD_ROOT%{pkidir}/java
|
|---|
| 97 |
|
|---|
| 98 | install -p -m 644 ca-bundle.crt $RPM_BUILD_ROOT%{pkidir}/tls/certs/ca-bundle.crt
|
|---|
| 99 | install -p -m 644 ca-bundle.trust.crt $RPM_BUILD_ROOT%{pkidir}/tls/certs/ca-bundle.trust.crt
|
|---|
| 100 | ln -s certs/ca-bundle.crt $RPM_BUILD_ROOT%{pkidir}/tls/cert.pem
|
|---|
| 101 | touch -r certdata.txt $RPM_BUILD_ROOT%{pkidir}/tls/certs/ca-bundle.crt
|
|---|
| 102 | touch -r certdata.txt $RPM_BUILD_ROOT%{pkidir}/tls/certs/ca-bundle.trust.crt
|
|---|
| 103 |
|
|---|
| 104 | # Install Java cacerts file.
|
|---|
| 105 | mkdir -p -m 700 $RPM_BUILD_ROOT%{pkidir}/java
|
|---|
| 106 | install -p -m 644 java/cacerts $RPM_BUILD_ROOT%{pkidir}/java/
|
|---|
| 107 |
|
|---|
| 108 | # /etc/ssl/certs symlink for 3rd-party tools
|
|---|
| 109 | mkdir -p -m 755 $RPM_BUILD_ROOT%{_sysconfdir}/ssl
|
|---|
| 110 | ln -s ../pki/tls/certs $RPM_BUILD_ROOT%{_sysconfdir}/ssl/certs
|
|---|
| 111 |
|
|---|
| 112 | %clean
|
|---|
| 113 | rm -rf $RPM_BUILD_ROOT
|
|---|
| 114 |
|
|---|
| 115 | %files
|
|---|
| 116 | %defattr(-,root,root,-)
|
|---|
| 117 | %dir %{pkidir}/java
|
|---|
| 118 | %config(noreplace) %{pkidir}/java/cacerts
|
|---|
| 119 | %dir %{pkidir}/tls
|
|---|
| 120 | %dir %{pkidir}/tls/certs
|
|---|
| 121 | %config(noreplace) %{pkidir}/tls/certs/ca-bundle.*crt
|
|---|
| 122 | %{pkidir}/tls/cert.pem
|
|---|
| 123 | %dir %{_sysconfdir}/ssl
|
|---|
| 124 | %{_sysconfdir}/ssl/certs
|
|---|
| 125 |
|
|---|
| 126 | %changelog
|
|---|
| 127 | * Tue Jun 14 2016 yd <yd@os2power.com> 2016.06-1
|
|---|
| 128 | - update with latest certificates from Mozilla.
|
|---|
| 129 |
|
|---|
| 130 | * Thu Jan 5 2012 yd
|
|---|
| 131 | - initial build
|
|---|