remove dead links in /etc/openssl/certs when uninstalling update
[packages/ca-certificates.git] / ca-certificates.spec
CommitLineData
8b300985 1# TODO
7d6b3825
JR
2# - https://bugzilla.mozilla.org/show_bug.cgi?id=549701 and
3# http://groups.google.com/group/mozilla.dev.security.policy/browse_thread/thread/b6493a285ba79998#
8afb3237
ER
4# - make amsn use system certs
5# - make pidgin use system certs
354e0f44 6# - swap %{certsdir}/ca-certificates.crt /etc/pki/tls/certs/ca-bundle.crt regards file vs symlink
7d6b3825 7#
460ad8a7
JB
8# Conditional build:
9%bcond_without tests # skip duplicates check
9a2204c0 10
8bb152c1 11Summary: Common CA Certificates PEM files
500a6231 12Summary(pl.UTF-8): Pliki PEM popularnych certyfikatów CA
8bb152c1 13Name: ca-certificates
cf6c55ff 14%define ver_date 20200601
2615c0a7 15Version: %{ver_date}
8acd65db 16Release: 1
c26c6065 17License: GPL v2 (scripts), MPL v2 (mozilla certs), distributable (other certs)
9a2204c0 18Group: Base
2615c0a7 19Source0: http://ftp.debian.org/debian/pool/main/c/ca-certificates/%{name}_%{version}.tar.xz
cf6c55ff 20# Source0-md5: 9b37bd1bc002d9f041c0a811667cb65a
ed111db5
JR
21Source2: http://www.certum.pl/keys/CA.pem
22# Source2-md5: 35610177afc9c64e70f1ce62c1885496
23Source3: http://www.certum.pl/keys/level1.pem
24# Source3-md5: ba2d2e234ef9cfd2e6e5f810c964862e
25Source4: http://www.certum.pl/keys/level2.pem
26# Source4-md5: d06578a04e8cb23071f3870430ea0cf0
27Source5: http://www.certum.pl/keys/level3.pem
28# Source5-md5: 47b67c63a52236576fc0d1150327c962
29Source6: http://www.certum.pl/keys/level4.pem
30# Source6-md5: f1f8a65d177745311a1e99f029ae5d71
31Source7: http://www.certum.pl/keys/vs.pem
32# Source7-md5: 8da19ffc48c5dcc2868b1aa55f1d5983
33Source8: http://www.certum.pl/keys/na.pem
34# Source8-md5: ba571cb35e7672ff7ae95132ac1bfec4
35Source9: http://www.certum.pl/keys/tsa.pem
36# Source9-md5: 1a7b3faf8ed00f4d80297de74862e102
37Source10: http://www.certum.pl/keys/class1.pem
38# Source10-md5: 058436b132ea2df6972821f546104a16
39Source11: http://www.certum.pl/keys/class2.pem
40# Source11-md5: 5caf7fe99b1fc6e63c40b3d081711d1b
41Source12: http://www.certum.pl/keys/class3.pem
42# Source12-md5: 07bc97e21da092ba53535c7379e1b58b
43Source13: http://www.certum.pl/keys/class4.pem
44# Source13-md5: 99ef61d509539af89f1c025b67245965
a4e3ff05
AZ
45Source14: http://www.certum.pl/CTNCA.pem
46# Source14-md5: 231b5b8bf05c5e93a9b2ebc4186eb6f7
47Source15: http://repository.certum.pl/class1casha2.pem
48# Source15-md5: b52dde6e2618a21965afbe6d6676d09f
49Source16: http://repository.certum.pl/dvcasha2.pem
50# Source16-md5: 88ce64a84375c95ab6f7c8515dd2a117
51Source17: http://repository.certum.pl/ovcasha2.pem
52# Source17-md5: 3149c923bd23469d6b14caa6334f8b63
53Source18: http://repository.certum.pl/evcasha2.pem
54# Source18-md5: ac54dc6cf3af7e243879b1c8b4aca8a3
55#Source19: http://repository.certum.pl/dvcasha2.pem
56## Source19-md5: 88ce64a84375c95ab6f7c8515dd2a117
57Source20: http://repository.certum.pl/gscasha2.pem
58# Source20-md5: a29d37f95dafc08cef36015922e3b0d3
59Source21: http://crt.tcs.terena.org/TERENASSLCA.crt
60# Source21-md5: f62cd1546a8ef14e31ba1ce8eecd234a
61Source22: http://crt.tcs.terena.org/TERENAeScienceSSLCA.crt
62# Source22-md5: 5feea35ab01a373f115219706f1f57bd
63Source23: http://crt.tcs.terena.org/TERENAPersonalCA.crt
64# Source23-md5: 53eaa497c8fb0b79f14fe9f69693689a
65Source24: http://crt.tcs.terena.org/TERENAeSciencePersonalCA.crt
66# Source24-md5: e25cc655d3ebe920ca9c187e3dde9191
67Source25: http://crt.tcs.terena.org/TERENACodeSigningCA.crt
68# Source25-md5: 74c9f511ab03a4e6b7462e310abfa89b
69Source26: http://www.sk.ee/upload/files/JUUR-SK.PEM.cer
70# Source26-md5: 805784c06c9eff3771a4b9bd631cd3f5
71Source27: http://www.sk.ee/upload/files/ESTEID-SK.PEM.cer
72# Source27-md5: 387beee5b8539ab7d91628f486295899
73Source28: http://www.sk.ee/upload/files/ESTEID-SK%202007.PEM.cer?/ESTEID-SK_2007.PEM.cer
74# Source28-md5: 2b1a2a77f565d68fdf5f19f6cc3a5600
75Source29: http://www.sk.ee/upload/files/ESTEID-SK%202011.pem.cer?/ESTEID-SK_2011.pem.cer
76# Source29-md5: cfcc1e592cb0ff305158a7e32730546c
a0243bec
AO
77Source30: http://www.terena.org/activities/tcs/repository/sha2/TERENA_SSL_CA_2.pem
78# Source30-md5: 96700974350cecfcfbd904d52c3a3942
79Source31: http://www.terena.org/activities/tcs/repository/sha2/TERENA_Personal_CA_2.pem
80# Source31-md5: d40e5c821f8559faf5bcd55eac5e1371
81Source32: http://www.terena.org/activities/tcs/repository/sha2/TERENA_Code_Signing_CA_2.pem
82# Source32-md5: 69ff653e730adf87ff59bf373950b357
83Source33: http://www.terena.org/activities/tcs/repository-g3/TERENA_SSL_CA_3.pem
84# Source33-md5: b22ed904900ed6b3bc129f9a35ba5a66
85Source34: http://www.terena.org/activities/tcs/repository-g3/TERENA_Personal_CA_3.pem
86# Source34-md5: eb5ddefe94750c2f8d4f11cb1f3af911
87Source35: http://www.terena.org/activities/tcs/repository-g3/TERENA_Code_Signing_CA_3.pem
88# Source35-md5: 43375a208fba0a5e73f1912faa4db86d
89Source36: http://www.terena.org/activities/tcs/repository-g3/TERENA_SSL_High_Assurance_CA_3.pem
90# Source36-md5: 6e00d9ede4460e739eb285ea023299f0
4619b3d9 91Patch0: %{name}-undebianize.patch
ed111db5 92Patch1: %{name}-more-certs.patch
c7360e68 93Patch2: %{name}-etc-certs.patch
0e9b9979 94
93ad0ea1
JR
95Patch5: %{name}-DESTDIR.patch
96Patch6: %{name}.d.patch
ad8e5716 97Patch7: no-openssl-rehash.patch
4d7c72ae 98URL: https://packages.debian.org/sid/ca-certificates
c3918bf2 99BuildRequires: openssl-tools
d75b32da 100BuildRequires: python >= 1:2.6
65bcbc85 101BuildRequires: python-modules
9af0daca 102BuildRequires: rpm >= 4.4.9-56
55905e01 103BuildRequires: sed >= 4.0
fba66a45 104BuildRequires: tar >= 1:1.22
ed111db5 105BuildRequires: unzip
fba66a45 106BuildRequires: xz
ed111db5 107Obsoletes: certificates
5352fc69 108BuildArch: noarch
8bb152c1
ER
109BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
110
850133d0 111%define certsdir /etc/certs
94338ec5 112%define openssldir /etc/openssl/certs
850133d0 113
8bb152c1 114%description
500a6231
JB
115Common CA Certificates PEM files.
116
117%description -l pl.UTF-8
118Pliki PEM popularnych certyfikatów CA.
8bb152c1 119
302ace1c
JR
120%package update
121Summary: Script for updating CA Certificates database
122Summary(pl.UTF-8): Skrypt do odświeżania bazy certyfikatów CA
123Group: Libraries
6c894e75 124Requires: %{name} = %{version}-%{release}
74154eae 125Requires: mktemp
9af0daca 126%if "%{pld_release}" == "ac"
9b4bd725 127Requires: openssl-tools >= 0.9.7m-6.3
9af0daca 128%else
c3918bf2 129Requires: openssl-tools >= 0.9.8i-3
9af0daca 130%endif
302ace1c
JR
131
132%description update
133Script and data for updating CA Certificates database.
134
6c894e75 135%description update -l pl.UTF-8
302ace1c
JR
136Skrypt i dane do odświeżania bazy certyfikatów CA.
137
8bb152c1 138%prep
cf6c55ff
JP
139%setup -qc
140cd work
ed111db5
JR
141%patch0 -p1
142%patch1 -p1
c7360e68 143%patch2 -p1
0e9b9979 144
835b9580 145%patch5 -p1
94338ec5 146%patch6 -p1
ad8e5716 147%patch7 -p1
ed111db5 148
9af0daca
ER
149%{__sed} -i -e 's,@openssldir@,%{openssldir},' sbin/update-ca-certificates*
150
ed111db5 151install -d certum
1180a18f
ER
152cp -pi %{SOURCE2} certum
153cp -pi %{SOURCE3} certum
154cp -pi %{SOURCE4} certum
155cp -pi %{SOURCE5} certum
156cp -pi %{SOURCE6} certum
157cp -pi %{SOURCE7} certum
158cp -pi %{SOURCE8} certum
159cp -pi %{SOURCE9} certum
160cp -pi %{SOURCE10} certum
161cp -pi %{SOURCE11} certum
162cp -pi %{SOURCE12} certum
163cp -pi %{SOURCE13} certum
a4e3ff05
AZ
164cp -pi %{SOURCE14} certum
165cp -pi %{SOURCE15} certum
166cp -pi %{SOURCE16} certum
167cp -pi %{SOURCE17} certum
168cp -pi %{SOURCE18} certum
169#cp -pi %{SOURCE19} certum
170cp -pi %{SOURCE20} certum
ebf0e82f 171for a in certum/*.pem; do
ca146b29 172 mv -i "$a" "${a%.pem}.crt"
ed111db5
JR
173done
174
1180a18f
ER
175# http://www.sk.ee/en/Repository/certs/rootcertificates
176# JUUR-SK, ESTEID-SK and ESTEID-SK 2007, ESTEID-SK 2011
2190f9b1 177install -d esteid
a4e3ff05
AZ
178cp -pi %{SOURCE26} esteid
179cp -pi %{SOURCE27} esteid
180cp -pi %{SOURCE28} esteid/ESTEID-SK_2007.crt
181cp -pi %{SOURCE29} esteid/ESTEID-SK_2011.crt
2190f9b1 182for a in esteid/*.PEM.cer; do
ca146b29 183 mv -i "$a" "${a%.PEM.cer}.crt"
2190f9b1
ER
184done
185
ed111db5 186%build
cf6c55ff 187cd work
277121c2 188install -d terena
a4e3ff05
AZ
189openssl x509 -inform DER -in %{SOURCE21} -outform PEM -out terena/$(basename %{SOURCE21})
190openssl x509 -inform DER -in %{SOURCE22} -outform PEM -out terena/$(basename %{SOURCE22})
191openssl x509 -inform DER -in %{SOURCE23} -outform PEM -out terena/$(basename %{SOURCE23})
192openssl x509 -inform DER -in %{SOURCE24} -outform PEM -out terena/$(basename %{SOURCE24})
193openssl x509 -inform DER -in %{SOURCE25} -outform PEM -out terena/$(basename %{SOURCE25})
a0243bec
AO
194cp %{SOURCE30} terena/$(basename %{SOURCE30} .pem).crt
195cp %{SOURCE31} terena/$(basename %{SOURCE31} .pem).crt
196cp %{SOURCE32} terena/$(basename %{SOURCE32} .pem).crt
197sed 's/\r//' %{SOURCE33} > terena/$(basename %{SOURCE33} .pem).crt
198sed 's/\r//' %{SOURCE34} > terena/$(basename %{SOURCE34} .pem).crt
199sed 's/\r//' %{SOURCE35} > terena/$(basename %{SOURCE35} .pem).crt
200sed 's/\r//' %{SOURCE36} > terena/$(basename %{SOURCE36} .pem).crt
277121c2 201
ed111db5
JR
202%{__make}
203
204# We have those and more in specific dirs
cf6c55ff 205%{__rm} mozilla/Certum*.crt
2e4da516 206
7d6b3825 207# See TODO
460ad8a7 208# %{__rm} mozilla/RSA_Security_1024_v3.crt
7d6b3825 209
8bb152c1
ER
210%install
211rm -rf $RPM_BUILD_ROOT
cf6c55ff 212cd work
354e0f44 213install -d $RPM_BUILD_ROOT{%{_datadir}/%{name},%{_sbindir},%{certsdir},/etc/pki/tls/certs,%{_sysconfdir}/ca-certificates.d}
8bb152c1
ER
214%{__make} install \
215 DESTDIR=$RPM_BUILD_ROOT
216
55905e01
JR
217find $RPM_BUILD_ROOT%{_datadir}/ca-certificates -name '*.crt' -exec sed -i -e 's/\r$//' {} \;
218
8bb152c1
ER
219(
220cd $RPM_BUILD_ROOT%{_datadir}/ca-certificates
221find . -name '*.crt' | sort | cut -b3-
222) > $RPM_BUILD_ROOT%{_sysconfdir}/ca-certificates.conf
223
94338ec5
ER
224# build %{certsdir}/ca-certificates.crt
225install -d $RPM_BUILD_ROOT%{openssldir}
226./sbin/update-ca-certificates --destdir $RPM_BUILD_ROOT
227rm -rf $RPM_BUILD_ROOT%{openssldir}
8bb152c1 228
354e0f44
ER
229ln -s %{certsdir}/ca-certificates.crt $RPM_BUILD_ROOT/etc/pki/tls/certs/ca-bundle.crt
230
2e4da516
AM
231%if %{with tests}
232install -d pld-tests
233cd pld-tests
234
235# check for duplicates (to avoid X509_STORE_add_cert "cert already in hash table" problem)
cf6c55ff 236cat $RPM_BUILD_ROOT%{certsdir}/ca-certificates.crt | awk '/^-+BEGIN/ { i++; } /^-+BEGIN/, /^-+END/ { print > i ".extracted.crt" }'
2e4da516
AM
237for cert in *.extracted.crt; do
238 openssl x509 -in "$cert" -noout -sha1 -fingerprint > "$cert.fingerprint"
239done
240DUPLICATES=$(sort *.fingerprint | uniq -c | sort -nr | awk ' { if ($1 != 1) { print $0; } } ')
241if [ -n "$DUPLICATES" ]; then
242 echo -e "\n\nFound duplicates for certificates (count, type, fingerprint):\n\n$DUPLICATES\n\nFailing..."
243 exit 1
244fi
245cd ..
246%endif
247
f1df9d48
JK
248# The Debian path might be hard-coded in some binaries we cannot fix
249# like the Steam client
0923a3c6
JK
250install -d $RPM_BUILD_ROOT/etc/ssl/certs
251ln -s %{certsdir}/ca-certificates.crt $RPM_BUILD_ROOT/etc/ssl/certs
f1df9d48 252
8bb152c1
ER
253%clean
254rm -rf $RPM_BUILD_ROOT
255
302ace1c 256%post update
ed9496cb 257%{_sbindir}/update-ca-certificates --fresh || :
8bb152c1 258
6587a0f2
JP
259%postun update
260/usr/bin/find "%{openssldir}" -xtype l -delete || :
261
8bb152c1
ER
262%files
263%defattr(644,root,root,755)
cf6c55ff 264%doc work/debian/{README.Debian,changelog}
a4417de9 265%dir /etc/pki/tls
354e0f44 266%dir /etc/pki/tls/certs
f1df9d48 267%dir /etc/ssl
0923a3c6
JK
268%dir /etc/ssl/certs
269/etc/ssl/certs/ca-certificates.crt
354e0f44 270%config(noreplace) %verify(not md5 mtime size) /etc/pki/tls/certs/ca-bundle.crt
850133d0 271%config(noreplace) %verify(not md5 mtime size) %{certsdir}/ca-certificates.crt
302ace1c
JR
272
273%files update
274%defattr(644,root,root,755)
8bb152c1 275%attr(755,root,root) %{_sbindir}/update-ca-certificates
302ace1c 276%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/ca-certificates.conf
53d36f70 277%dir %{_sysconfdir}/ca-certificates.d
8bb152c1 278%{_datadir}/ca-certificates
This page took 0.561503 seconds and 5 git commands to generate.