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