[OE-core] [PATCH] dropbear: new feature: disable-weak-ciphers

Joseph Reynolds jrey at linux.ibm.com
Thu Jun 20 21:29:15 UTC 2019


dropbear: new feature: disable-weak-ciphers

Enhances dropbear with a new feature "disable-weak-ciphers", on by 
default.
This feature disables all CBC, SHA1, and diffie-hellman group1 ciphers 
in
the dropbear ssh server and client.

Disable this feature if you need to connect to the ssh server from older
clients.  Additional customization can be done with local_options.h as 
usual.

Tested: On dropbear_2019.78.

Upstream-Status: Inappropriate [configuration]

Signed-off-by: Joseph Reynolds <joseph.reynolds1 at ibm.com>
---
  meta/recipes-core/dropbear/dropbear.inc            |  6 ++--
  .../dropbear/dropbear-disable-weak-ciphers.patch   | 37 
++++++++++++++++++++++
  2 files changed, 41 insertions(+), 2 deletions(-)
  create mode 100644 
meta/recipes-core/dropbear/dropbear/dropbear-disable-weak-ciphers.patch

diff --git a/meta/recipes-core/dropbear/dropbear.inc 
b/meta/recipes-core/dropbear/dropbear.inc
index b74d186..dcbda74 100644
--- a/meta/recipes-core/dropbear/dropbear.inc
+++ b/meta/recipes-core/dropbear/dropbear.inc
@@ -20,7 +20,8 @@ SRC_URI = 
"http://matt.ucc.asn.au/dropbear/releases/dropbear-${PV}.tar.bz2 \
             file://dropbear@.service \
             file://dropbear.socket \
             file://dropbear.default \
-           ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 
'${PAM_SRC_URI}', '', d)} "
+           ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 
'${PAM_SRC_URI}', '', d)} \
+           ${@bb.utils.contains('PACKAGECONFIG', 
'disable-weak-ciphers', 'file://dropbear-disable-weak-ciphers.patch', 
'', d)} "

  PAM_SRC_URI = "file://0005-dropbear-enable-pam.patch \
                 file://0006-dropbear-configuration-file.patch \
@@ -46,8 +47,9 @@ SBINCOMMANDS = "dropbear dropbearkey dropbearconvert"
  BINCOMMANDS = "dbclient ssh scp"
  EXTRA_OEMAKE = 'MULTI=1 SCPPROGRESS=1 PROGRAMS="${SBINCOMMANDS} 
${BINCOMMANDS}"'

-PACKAGECONFIG ?= ""
+PACKAGECONFIG ?= "disable-weak-ciphers"
  PACKAGECONFIG[system-libtom] = 
"--disable-bundled-libtom,--enable-bundled-libtom,libtommath 
libtomcrypt"
+PACKAGECONFIG[disable-weak-ciphers] = ""

  EXTRA_OECONF += "\
   ${@bb.utils.contains('DISTRO_FEATURES', 'pam', '--enable-pam', 
'--disable-pam', d)}"
diff --git 
a/meta/recipes-core/dropbear/dropbear/dropbear-disable-weak-ciphers.patch 
b/meta/recipes-core/dropbear/dropbear/dropbear-disable-weak-ciphers.patch
new file mode 100644
index 0000000..764aebd
--- /dev/null
+++ 
b/meta/recipes-core/dropbear/dropbear/dropbear-disable-weak-ciphers.patch
@@ -0,0 +1,37 @@
+diff --git a/default_options.h b/default_options.h
+index 9000fcc..bfb8a8f 100644
+--- a/default_options.h
++++ b/default_options.h
+@@ -91,7 +91,7 @@ IMPORTANT: Some options will require "make clean" 
after changes */
+
+ /* Enable CBC mode for ciphers. This has security issues though
+  * is the most compatible with older SSH implementations */
+-#define DROPBEAR_ENABLE_CBC_MODE 1
++#define DROPBEAR_ENABLE_CBC_MODE 0
+
+ /* Enable "Counter Mode" for ciphers. This is more secure than
+  * CBC mode against certain attacks. It is recommended for security
+@@ -101,7 +101,7 @@ IMPORTANT: Some options will require "make clean" 
after changes */
+ /* Message integrity. sha2-256 is recommended as a default,
+    sha1 for compatibility */
+ #define DROPBEAR_SHA1_HMAC 1
+-#define DROPBEAR_SHA1_96_HMAC 1
++#define DROPBEAR_SHA1_96_HMAC 0
+ #define DROPBEAR_SHA2_256_HMAC 1
+
+ /* Hostkey/public key algorithms - at least one required, these are 
used
+@@ -149,12 +149,12 @@ IMPORTANT: Some options will require "make clean" 
after changes */
+  * Small systems should generally include either curve25519 or ecdh 
for performance.
+  * curve25519 is less widely supported but is faster
+  */
+-#define DROPBEAR_DH_GROUP14_SHA1 1
++#define DROPBEAR_DH_GROUP14_SHA1 0
+ #define DROPBEAR_DH_GROUP14_SHA256 1
+ #define DROPBEAR_DH_GROUP16 0
+ #define DROPBEAR_CURVE25519 1
+ #define DROPBEAR_ECDH 1
+-#define DROPBEAR_DH_GROUP1 1
++#define DROPBEAR_DH_GROUP1 0
+
+ /* When group1 is enabled it will only be allowed by Dropbear client
+ not as a server, due to concerns over its strength. Set to 0 to allow
-- 
1.8.3.1



More information about the Openembedded-core mailing list