freeswitch-stable: fix weak md in gentls_cert
[feed/telephony.git] / net / freeswitch-stable / patches / 040-gentls_cert_update_message_digest.patch
1 commit 70d1cbafe4ab0176cd9fc01f740e34cd1bae326b
2 Author: Sebastian Kemper <sebastian_ml@gmx.net>
3 Date: Wed Nov 13 20:29:50 2019 +0100
4
5 [gentls_cert] Update message digest
6
7 Debian Buster updated /etc/ssl/openssl.cnf to default to
8
9 MinProtocol = TLSv1.2
10 CipherString = DEFAULT@SECLEVEL=2
11
12 gentls_cert currently uses SHA1 as message digest. According to OpenSSL
13 documentation this only offers 80 bit of security. 80 bits is enough for
14 security level 1, but not 2.
15
16 The OpenSSL default MD nowadays is SHA256. This commit updates
17 gentls_cert to use it.
18
19 Issue was reported on the FS mailing list. The certificates created by
20 gentls_cert caused "md too weak" errors and clients were unable to
21 connect.
22
23 Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
24
25 diff --git a/scripts/gentls_cert.in b/scripts/gentls_cert.in
26 index 43aa8ac605..dd56c9f6dc 100644
27 --- a/scripts/gentls_cert.in
28 +++ b/scripts/gentls_cert.in
29 @@ -89,7 +89,7 @@ setup_ca() {
30
31 openssl req -out "${CONFDIR}/CA/cacert.pem" \
32 -new -x509 -keyout "${CONFDIR}/CA/cakey.pem" \
33 - -config "${TMPFILE}.cfg" -nodes -days ${DAYS} -sha1 >/dev/null || exit 1
34 + -config "${TMPFILE}.cfg" -nodes -days ${DAYS} -sha256 >/dev/null || exit 1
35 cat "${CONFDIR}/CA/cacert.pem" > "${CONFDIR}/cafile.pem"
36 cp $TMPFILE.cfg /tmp/ssl.cfg
37 rm "${TMPFILE}.cfg"
38 @@ -131,11 +131,11 @@ generate_cert() {
39
40 openssl req -new -out "${TMPFILE}.req" \
41 -newkey rsa:${KEY_SIZE} -keyout "${TMPFILE}.key" \
42 - -config "${TMPFILE}.cfg" -nodes -sha1 >/dev/null || exit 1
43 + -config "${TMPFILE}.cfg" -nodes -sha256 >/dev/null || exit 1
44
45 openssl x509 -req -CAkey "${CONFDIR}/CA/cakey.pem" -CA "${CONFDIR}/CA/cacert.pem" -CAcreateserial \
46 -in "${TMPFILE}.req" -out "${TMPFILE}.crt" -extfile "${TMPFILE}.cfg" \
47 - -extensions "${EXTENSIONS}" -days ${DAYS} -sha1 >/dev/null || exit 1
48 + -extensions "${EXTENSIONS}" -days ${DAYS} -sha256 >/dev/null || exit 1
49
50 cat "${TMPFILE}.crt" "${TMPFILE}.key" > "${CONFDIR}/${OUTFILE}"
51