[PATCH] dropbear: make rsa-sha2-256 pubkeys usable again
Petr Štetiar
ynezz at true.cz
Thu Jul 2 05:51:24 EDT 2020
Upstream in commit 972d723484d8 ("split signkey_type and signature_type
for RSA sha1 vs sha256") has added strict checking of pubkey algorithms
which made keys with SHA-256 hashing algorithm unusable as they still
reuse the `ssh-rsa` public key format. So fix this by disabling the
check for `rsa-sha2-256` pubkeys.
Ref: https://tools.ietf.org/html/rfc8332#section-3
Cc: Matt Johnston <matt at ucc.asn.au>
Fixes: d4c80f5b172e ("dropbear: bump to 2020.80")
Signed-off-by: Petr Štetiar <ynezz at true.cz>
---
I'm unable to connect with the latest Dropbear with my rsa-sha2-256:
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,ssh-rsa>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key: RSA SHA256:ZLONs7adjPBljemwKAX5dXDiKPDVh4fsStkqi2eJsiI cardno:000610530066
debug1: Server accepts key: pkalg rsa-sha2-256 blen 535
Connection closed by 192.168.1.1 port 22
Upstreamed in https://github.com/mkj/dropbear/pull/106
...nkey-fix-use-of-rsa-sha2-256-pubkeys.patch | 40 +++++++++++++++++++
1 file changed, 40 insertions(+)
create mode 100644 package/network/services/dropbear/patches/910-signkey-fix-use-of-rsa-sha2-256-pubkeys.patch
diff --git a/package/network/services/dropbear/patches/910-signkey-fix-use-of-rsa-sha2-256-pubkeys.patch b/package/network/services/dropbear/patches/910-signkey-fix-use-of-rsa-sha2-256-pubkeys.patch
new file mode 100644
index 000000000000..afa0ebb310c9
--- /dev/null
+++ b/package/network/services/dropbear/patches/910-signkey-fix-use-of-rsa-sha2-256-pubkeys.patch
@@ -0,0 +1,40 @@
+From 667d9b75df86ec9ee1205f9101beb8dbbe4a00ae Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20=C5=A0tetiar?= <ynezz at true.cz>
+Date: Wed, 1 Jul 2020 11:38:33 +0200
+Subject: [PATCH] signkey: fix use of rsa-sha2-256 pubkeys
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Commit 972d723484d8 ("split signkey_type and signature_type for RSA sha1
+vs sha256") has added strict checking of pubkey algorithms which made
+keys with SHA-256 hashing algorithm unusable as they still reuse the
+`ssh-rsa` public key format. So fix this by disabling the check for
+rsa-sha2-256 pubkeys.
+
+Ref: https://tools.ietf.org/html/rfc8332#section-3
+Fixes: 972d723484d8 ("split signkey_type and signature_type for RSA sha1 vs sha256")
+Signed-off-by: Petr Štetiar <ynezz at true.cz>
+---
+ signkey.c | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/signkey.c b/signkey.c
+index 92fe6a242cd0..d16ab174d83a 100644
+--- a/signkey.c
++++ b/signkey.c
+@@ -657,8 +657,12 @@ int buf_verify(buffer * buf, sign_key *key, enum signature_type expect_sigtype,
+ sigtype = signature_type_from_name(type_name, type_name_len);
+ m_free(type_name);
+
+- if (expect_sigtype != sigtype) {
+- dropbear_exit("Non-matching signing type");
++ if (sigtype == DROPBEAR_SIGNATURE_NONE) {
++ dropbear_exit("No signature type");
++ }
++
++ if ((expect_sigtype != DROPBEAR_SIGNATURE_RSA_SHA256) && (expect_sigtype != sigtype)) {
++ dropbear_exit("Non-matching signing type");
+ }
+
+ keytype = signkey_type_from_signature(sigtype);
More information about the openwrt-devel
mailing list