# - make pidgin use system certs
# - swap %{certsdir}/ca-certificates.crt /etc/pki/tls/certs/ca-bundle.crt regards file vs symlink
#
+# Conditional build:
+%bcond_without tests # skip duplicates check
+
Summary: Common CA Certificates PEM files
Summary(pl.UTF-8): Pliki PEM popularnych certyfikatów CA
Name: ca-certificates
-Version: 20150426
+%define ver_date 20170717
+Version: %{ver_date}
Release: 2
License: GPL v2 (scripts), MPL v2 (mozilla certs), distributable (other certs)
-Group: Libraries
-Source0: ftp://ftp.debian.org/debian/pool/main/c/ca-certificates/%{name}_%{version}.tar.xz
-# Source0-md5: 717455f13fb31fd014a11a468ea3895d
-Source1: https://www.verisign.com/support/thawte-roots.zip
-# Source1-md5: 21a284ebdc6e8f4178d5cc10fb9e1ef2
+Group: Base
+Source0: http://ftp.debian.org/debian/pool/main/c/ca-certificates/%{name}_%{version}.tar.xz
+# Source0-md5: 55a6bb6b98afb16b3cde8e3ad1e262eb
Source2: http://www.certum.pl/keys/CA.pem
# Source2-md5: 35610177afc9c64e70f1ce62c1885496
Source3: http://www.certum.pl/keys/level1.pem
Patch3: %{name}-c_rehash.sh.patch
Patch5: %{name}-DESTDIR.patch
Patch6: %{name}.d.patch
-URL: http://www.cacert.org/
+URL: https://packages.debian.org/sid/ca-certificates
BuildRequires: openssl-tools
-BuildRequires: python
+BuildRequires: python >= 1:2.6
BuildRequires: python-modules
BuildRequires: rpm >= 4.4.9-56
BuildRequires: sed >= 4.0
Skrypt i dane do odświeżania bazy certyfikatów CA.
%prep
-%setup -q
+%setup -q -n %{name}
%patch0 -p1
%patch1 -p1
%patch2 -p1
%{__sed} -i -e 's,@openssldir@,%{openssldir},' sbin/update-ca-certificates*
-%{__unzip} -qq %{SOURCE1} -d thawte
-
-find thawte/ -name *.pem -o -name *.txt| while read f ; do
- if (file "$f" | grep -q "PEM"); then
- ff=$(echo $f | sed -e 's|[ ,]|_|g' -e 's|[()]|=|g')
- nname=$(basename "$ff" .pem)
- nname=$(basename "$nname" .txt)
- nname=$(basename "$nname" _b64)
- cp -pi "$f" "thawte/${nname}.crt"
- else
- echo "Skipping $f, doesn't look like PEM CERT"
- fi
-done
-
install -d certum
cp -pi %{SOURCE2} certum
cp -pi %{SOURCE3} certum
%{__make}
# We have those and more in specific dirs
-rm mozilla/{thawte,Certum,IGC_A,Deutsche_Telekom_Root_CA_2,Juur-SK}*.crt
+%{__rm} mozilla/{Certum,Deutsche_Telekom_Root_CA_2}*.crt
# See TODO
-# rm mozilla/RSA_Security_1024_v3.crt
+# %{__rm} mozilla/RSA_Security_1024_v3.crt
%install
rm -rf $RPM_BUILD_ROOT
ln -s %{certsdir}/ca-certificates.crt $RPM_BUILD_ROOT/etc/pki/tls/certs/ca-bundle.crt
+%if %{with tests}
+install -d pld-tests
+cd pld-tests
+
+# check for duplicates (to avoid X509_STORE_add_cert "cert already in hash table" problem)
+cat $RPM_BUILD_ROOT%{certsdir}/ca-certificates.crt | awk '/BEGIN/ { i++; } /BEGIN/, /END/ { print > i ".extracted.crt" }'
+for cert in *.extracted.crt; do
+ openssl x509 -in "$cert" -noout -sha1 -fingerprint > "$cert.fingerprint"
+done
+DUPLICATES=$(sort *.fingerprint | uniq -c | sort -nr | awk ' { if ($1 != 1) { print $0; } } ')
+if [ -n "$DUPLICATES" ]; then
+ echo -e "\n\nFound duplicates for certificates (count, type, fingerprint):\n\n$DUPLICATES\n\nFailing..."
+ exit 1
+fi
+cd ..
+%endif
+
%clean
rm -rf $RPM_BUILD_ROOT