* [Buildroot] [PATCH 2/3] dropbear: Add configuration options for security features
2018-04-18 14:24 [Buildroot] [PATCH 1/3] dropbear: Use macro to set options Stefan Sørensen
@ 2018-04-18 14:24 ` Stefan Sørensen
2018-04-18 15:10 ` Thomas Petazzoni
2018-04-18 21:58 ` Arnout Vandecappelle
2018-04-18 14:24 ` [Buildroot] [PATCH 3/3] dropbear: Disable insecure options Stefan Sørensen
` (2 subsequent siblings)
3 siblings, 2 replies; 10+ messages in thread
From: Stefan Sørensen @ 2018-04-18 14:24 UTC (permalink / raw)
To: buildroot
The dropbear server provides no runtime configuration of ciphers, key
exchange algorithms, etc., but must rather be configured compile time.
With no configurability the default settings will be use which may not
be desired in all scenearios.
These new options allow the selection of
Ciphers (AES128, AES256, 3DES, BLowfish, Twofish128, Twofish256)
Cipher modes (CBC, CTR)
Integrity algorithms (SHA1, SHA1-96, SHA2-256, SHA2-512, MD5)
Key exchange algorithms (RSA, DSS, ECDSA, Curve25519, ECDH)
Authenticaton types (Password, Pubkey)
No defaults are changed.
Signed-off-by: Stefan S?rensen <stefan.sorensen@spectralink.com>
---
package/dropbear/Config.in | 163 +++++++++++++++++++++++++++++++++++
package/dropbear/dropbear.mk | 25 +++++-
2 files changed, 185 insertions(+), 3 deletions(-)
diff --git a/package/dropbear/Config.in b/package/dropbear/Config.in
index 6700778161..441c521d18 100644
--- a/package/dropbear/Config.in
+++ b/package/dropbear/Config.in
@@ -55,4 +55,167 @@ config BR2_PACKAGE_DROPBEAR_LASTLOG
Enable logging of dropbear access to lastlog. Notice that
Buildroot does not generate lastlog by default.
+menu "Dropbear ciphers"
+
+config BR2_PACKAGE_DROPBEAR_CIPHER_AES128
+ bool "AES128"
+ default y
+ help
+ Enable the AES128 cipher
+
+config BR2_PACKAGE_DROPBEAR_CIPHER_AES256
+ bool "AES256"
+ default y
+ help
+ Enable the AES256 cipher
+
+config BR2_PACKAGE_DROPBEAR_CIPHER_3DES
+ bool "3DES"
+ default y
+ help
+ Enable the 3DES cipher
+
+config BR2_PACKAGE_DROPBEAR_CIPHER_BLOWFISH
+ bool "Blowfish"
+ default y if !BR2_PACKAGE_DROPBEAR_SMALL
+ help
+ Enable the Blowfish cipher
+
+config BR2_PACKAGE_DROPBEAR_CIPHER_TWOFISH128
+ bool "Twofish128"
+ default y if !BR2_PACKAGE_DROPBEAR_SMALL
+ help
+ Enable the Twofish128 cipher
+
+config BR2_PACKAGE_DROPBEAR_CIPHER_TWOFISH256
+ bool "Twofish256"
+ default y if !BR2_PACKAGE_DROPBEAR_SMALL
+ help
+ Enable the Twofish256 cipher
+
+endmenu
+
+menu "Dropbear cipher modes"
+
+config BR2_PACKAGE_DROPBEAR_CIPHER_MODE_CBC
+ bool "CBC"
+ default y
+ help
+ Enable CBC mode for ciphers. This has security issues though
+ is the most compatible with older SSH implementations
+
+config BR2_PACKAGE_DROPBEAR_CIPHER_MODE_CTR
+ bool "CTR"
+ default y
+ help
+ Enable "Counter Mode" for ciphers. This is more secure than
+ normal CBC mode against certain attacks. It is recommended
+ for security and forwards compatibility
+
+endmenu
+
+menu "Dropbear integrity algorithms"
+
+config BR2_PACKAGE_DROPBEAR_HMAC_SHA1
+ bool "SHA1"
+ default y
+ help
+ Enable SHA1 integrity algorithm
+
+config BR2_PACKAGE_DROPBEAR_HMAC_SHA1_96
+ bool "SHA1-96"
+ default y
+ help
+ Enable SHA1-96 integrity algorithm
+
+config BR2_PACKAGE_DROPBEAR_HMAC_SHA2_256
+ bool "SHA2-256"
+ default y
+ help
+ Enable SHA2-256 integrity algorithm
+
+config BR2_PACKAGE_DROPBEAR_HMAC_SHA2_512
+ bool "SHA2-512"
+ default y
+ help
+ Enable SHA2-512 integrity algorithm
+
+config BR2_PACKAGE_DROPBEAR_HMAC_MD5
+ bool "MD5"
+ default y
+ help
+ Enable MD5 integrity algorithm. If you disable MD5, Dropbear
+ will fall back to SHA1 fingerprints, which are not the
+ standard form
+
+endmenu
+
+menu "Dropbear key exchange algorithms"
+
+config BR2_PACKAGE_DROPBEAR_KEX_RSA
+ bool "RSA"
+ default y
+ help
+ Enable RSA key exchange algorithm.
+
+config BR2_PACKAGE_DROPBEAR_KEX_DSS
+ bool "DSS"
+ default y
+ help
+ Enable DSS key exchange algorithm. SSH2 RFC Draft requires
+ DSS.
+
+config BR2_PACKAGE_DROPBEAR_KEX_ECDSA
+ bool "ECDSA"
+ default y
+ help
+ Enable Curve25519 for key exchange. ECDSA is significantly
+ faster than RSA or DSS. Compiling in ECC code (either ECDSA
+ or ECDH) increases binary size - around 30kB on x86-64
+
+config BR2_PACKAGE_DROPBEAR_KEX_CURVE25519
+ bool "Curve25519"
+ default y
+ help
+ Enable Curve25519 for key exchange. This is another elliptic
+ curve method with good security properties
+
+config BR2_PACKAGE_DROPBEAR_KEX_ECDH
+ bool "ECDH"
+ default y
+ help
+ Enable elliptic curve Diffie Hellman key exchange algorithm
+
+config BR2_PACKAGE_DROPBEAR_KEX_DH_GROUP1
+ bool "DH Group1"
+ default y
+ help
+ Enable DH Group1 key exchange algorithm. Group1 is less
+ secure (1024 bit) than Group14 though is the only option for
+ interoperability with some older SSH programs
+
+config BR2_PACKAGE_DROPBEAR_KEX_DH_GROUP14
+ bool "DH Group14"
+ default y
+ help
+ Enable DH Group14 key exchange algorithm
+
+endmenu
+
+menu "Dropbear authenticaton types"
+
+config BR2_PACKAGE_DROPBEAR_AUTH_TYPE_PASSWORD
+ bool "Password"
+ default y
+ help
+ Enable password based authentication
+
+config BR2_PACKAGE_DROPBEAR_AUTH_TYPE_PUBKEY
+ bool "Public key"
+ default y
+ help
+ Enable public key based authentication
+
+endmenu
+
endif
diff --git a/package/dropbear/dropbear.mk b/package/dropbear/dropbear.mk
index dc1fee207f..cdbb77d5c3 100644
--- a/package/dropbear/dropbear.mk
+++ b/package/dropbear/dropbear.mk
@@ -45,9 +45,28 @@ define DROPBEAR_SET_OPTIONS
$(call DROPBEAR_SET_OPT,NO_FAST_EXPTMOD,$(BR2_PACKAGE_DROPBEAR_SMALL))
$(call DROPBEAR_SET_OPT,DO_HOST_LOOKUP,$(BR2_PACKAGE_DROPBEAR_ENABLE_REVERSE_DNS))
$(call DROPBEAR_SET_OPT,NON_INETD_MODE,$(BR2_USE_MMU))
- $(call DROPBEAR_SET_OPT,DROPBEAR_BLOWFISH,!$(BR2_PACKAGE_DROPBEAR_SMALL))
- $(call DROPBEAR_SET_OPT,DROPBEAR_TWOFISH128,!$(BR2_PACKAGE_DROPBEAR_SMALL))
- $(call DROPBEAR_SET_OPT,DROPBEAR_TWOFISH256,!$(BR2_PACKAGE_DROPBEAR_SMALL))
+ $(call DROPBEAR_SET_OPT,DROPBEAR_AES128,$(BR2_PACKAGE_DROPBEAR_CIPHER_AES128))
+ $(call DROPBEAR_SET_OPT,DROPBEAR_AES256,$(BR2_PACKAGE_DROPBEAR_CIPHER_AES256))
+ $(call DROPBEAR_SET_OPT,DROPBEAR_3DES,$(BR2_PACKAGE_DROPBEAR_CIPHER_3DES))
+ $(call DROPBEAR_SET_OPT,DROPBEAR_BLOWFISH,$(BR2_PACKAGE_DROPBEAR_CIPHER_BLOWFISH))
+ $(call DROPBEAR_SET_OPT,DROPBEAR_TWOFISH128,$(BR2_PACKAGE_DROPBEAR_CIPHER_TWOFISH128))
+ $(call DROPBEAR_SET_OPT,DROPBEAR_TWOFISH256,$(BR2_PACKAGE_DROPBEAR_CIPHER_TWOFISH256))
+ $(call DROPBEAR_SET_OPT,DROPBEAR_ENABLE_CBC_MODE,$(BR2_PACKAGE_DROPBEAR_CIPHER_MODE_CBC))
+ $(call DROPBEAR_SET_OPT,DROPBEAR_ENABLE_CTR_MODE,$(BR2_PACKAGE_DROPBEAR_CIPHER_MODE_CTR))
+ $(call DROPBEAR_SET_OPT,DROPBEAR_SHA1_HMAC,$(BR2_PACKAGE_DROPBEAR_HMAC_SHA1))
+ $(call DROPBEAR_SET_OPT,DROPBEAR_SHA1_96_HMAC,$(BR2_PACKAGE_DROPBEAR_HMAC_SHA1_96))
+ $(call DROPBEAR_SET_OPT,DROPBEAR_SHA2_256_HMAC,$(BR2_PACKAGE_DROPBEAR_HMAC_SHA2_256))
+ $(call DROPBEAR_SET_OPT,DROPBEAR_SHA2_512_HMAC,$(BR2_PACKAGE_DROPBEAR_HMAC_SHA2_512))
+ $(call DROPBEAR_SET_OPT,DROPBEAR_MD5_HMAC,$(BR2_PACKAGE_DROPBEAR_HMAC_MD5))
+ $(call DROPBEAR_SET_OPT,DROPBEAR_RSA,$(BR2_PACKAGE_DROPBEAR_KEX_RSA))
+ $(call DROPBEAR_SET_OPT,DROPBEAR_DSS,$(BR2_PACKAGE_DROPBEAR_KEX_DSS))
+ $(call DROPBEAR_SET_OPT,DROPBEAR_ECDSA,$(BR2_PACKAGE_DROPBEAR_KEX_ECDSA))
+ $(call DROPBEAR_SET_OPT,DROPBEAR_CURCE25519,$(BR2_PACKAGE_DROPBEAR_KEX_CURVE25519))
+ $(call DROPBEAR_SET_OPT,DROPBEAR_ECDH,$(BR2_PACKAGE_DROPBEAR_KEX_ECDH))
+ $(call DROPBEAR_SET_OPT,DROPBEAR_DH_GROUP1,$(BR2_PACKAGE_DROPBEAR_KEX_DH_GROUP1))
+ $(call DROPBEAR_SET_OPT,DROPBEAR_DH_GROUP14,$(BR2_PACKAGE_DROPBEAR_KEX_DH_GROUP14))
+ $(call DROPBEAR_SET_OPT,ENABLE_SVR_PASSWORD_AUTH,$(BR2_PACKAGE_DROPBEAR_AUTH_TYPE_PASSWORD))
+ $(call DROPBEAR_SET_OPT,ENABLE_SVR_PUBKEY_AUTH,$(BR2_PACKAGE_DROPBEAR_AUTH_TYPE_PUBKEY))
endef
DROPBEAR_POST_EXTRACT_HOOKS += DROPBEAR_SET_OPTIONS
--
2.17.0
^ permalink raw reply related [flat|nested] 10+ messages in thread* [Buildroot] [PATCH 3/3] dropbear: Disable insecure options
2018-04-18 14:24 [Buildroot] [PATCH 1/3] dropbear: Use macro to set options Stefan Sørensen
2018-04-18 14:24 ` [Buildroot] [PATCH 2/3] dropbear: Add configuration options for security features Stefan Sørensen
@ 2018-04-18 14:24 ` Stefan Sørensen
2018-04-18 15:11 ` Thomas Petazzoni
2018-04-20 3:45 ` [Buildroot] [PATCH 1/3] dropbear: Use macro to set options François Perrad
2018-04-28 15:51 ` Thomas Petazzoni
3 siblings, 1 reply; 10+ messages in thread
From: Stefan Sørensen @ 2018-04-18 14:24 UTC (permalink / raw)
To: buildroot
The default dropbear configuration includes a number of features no longer
considered secure, so disable
3DES cipher
MD5 integrity algorithm
SHA1-96 integrity algorithm
DSS key exchange algorithm
DH Group1 key exchange algorithm
Signed-off-by: Stefan S?rensen <stefan.sorensen@spectralink.com>
---
package/dropbear/Config.in | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/package/dropbear/Config.in b/package/dropbear/Config.in
index 441c521d18..c5acd333a8 100644
--- a/package/dropbear/Config.in
+++ b/package/dropbear/Config.in
@@ -71,7 +71,7 @@ config BR2_PACKAGE_DROPBEAR_CIPHER_AES256
config BR2_PACKAGE_DROPBEAR_CIPHER_3DES
bool "3DES"
- default y
+ default n
help
Enable the 3DES cipher
@@ -99,7 +99,7 @@ menu "Dropbear cipher modes"
config BR2_PACKAGE_DROPBEAR_CIPHER_MODE_CBC
bool "CBC"
- default y
+ default n
help
Enable CBC mode for ciphers. This has security issues though
is the most compatible with older SSH implementations
@@ -124,7 +124,7 @@ config BR2_PACKAGE_DROPBEAR_HMAC_SHA1
config BR2_PACKAGE_DROPBEAR_HMAC_SHA1_96
bool "SHA1-96"
- default y
+ default n
help
Enable SHA1-96 integrity algorithm
@@ -142,7 +142,7 @@ config BR2_PACKAGE_DROPBEAR_HMAC_SHA2_512
config BR2_PACKAGE_DROPBEAR_HMAC_MD5
bool "MD5"
- default y
+ default n
help
Enable MD5 integrity algorithm. If you disable MD5, Dropbear
will fall back to SHA1 fingerprints, which are not the
@@ -160,7 +160,7 @@ config BR2_PACKAGE_DROPBEAR_KEX_RSA
config BR2_PACKAGE_DROPBEAR_KEX_DSS
bool "DSS"
- default y
+ default n
help
Enable DSS key exchange algorithm. SSH2 RFC Draft requires
DSS.
@@ -188,7 +188,7 @@ config BR2_PACKAGE_DROPBEAR_KEX_ECDH
config BR2_PACKAGE_DROPBEAR_KEX_DH_GROUP1
bool "DH Group1"
- default y
+ default n
help
Enable DH Group1 key exchange algorithm. Group1 is less
secure (1024 bit) than Group14 though is the only option for
--
2.17.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [Buildroot] [PATCH 1/3] dropbear: Use macro to set options
2018-04-18 14:24 [Buildroot] [PATCH 1/3] dropbear: Use macro to set options Stefan Sørensen
2018-04-18 14:24 ` [Buildroot] [PATCH 2/3] dropbear: Add configuration options for security features Stefan Sørensen
2018-04-18 14:24 ` [Buildroot] [PATCH 3/3] dropbear: Disable insecure options Stefan Sørensen
@ 2018-04-20 3:45 ` François Perrad
2018-04-28 15:51 ` Thomas Petazzoni
3 siblings, 0 replies; 10+ messages in thread
From: François Perrad @ 2018-04-20 3:45 UTC (permalink / raw)
To: buildroot
2018-04-18 16:24 GMT+02:00 Stefan S?rensen <stefan.sorensen@spectralink.com>
:
> Introduce a macro for editing options.h according to the Buildroot
> configuration, replacing individual sed scripts.
>
>
with dropbear 2018.76, any customised options should be put in
localoptions.h,
instead of patching options.h
Fran?ois
> Signed-off-by: Stefan S?rensen <stefan.sorensen@spectralink.com>
> ---
> package/dropbear/dropbear.mk | 37 +++++++++++++++---------------------
> 1 file changed, 15 insertions(+), 22 deletions(-)
>
> diff --git a/package/dropbear/dropbear.mk b/package/dropbear/dropbear.mk
> index 01a1a07b76..dc1fee207f 100644
> --- a/package/dropbear/dropbear.mk
> +++ b/package/dropbear/dropbear.mk
> @@ -32,24 +32,25 @@ endef
>
> DROPBEAR_POST_EXTRACT_HOOKS += DROPBEAR_FIX_XAUTH
>
> -define DROPBEAR_ENABLE_REVERSE_DNS
> - $(SED) 's:.*\(#define DO_HOST_LOOKUP\).*:\1:' $(@D)/options.h
> +define DROPBEAR_SET_OPT # (define, option)
> + if [ 'x$(2)' = 'xy' -o 'x$(2)' = 'x!' ]; then \
> + $(SED) 's:.*\(#define $(1)\)\([^A-Z0-9_]\|$$\).*:\1 1:'
> $(@D)/options.h; \
> + else \
> + $(SED) 's:.*\(#define $(1)\)\([^A-Z0-9_]\|$$\).*:/*\1*/:'
> $(@D)/options.h; \
> + fi
> endef
>
> -define DROPBEAR_BUILD_SMALL
> - $(SED) 's:.*\(#define NO_FAST_EXPTMOD\).*:\1:' $(@D)/options.h
> +define DROPBEAR_SET_OPTIONS
> + $(call DROPBEAR_SET_OPT,DROPBEAR_SMALL_CODE,$(BR2_PACKAGE_
> DROPBEAR_SMALL))
> + $(call DROPBEAR_SET_OPT,NO_FAST_EXPTMOD,$(BR2_PACKAGE_
> DROPBEAR_SMALL))
> + $(call DROPBEAR_SET_OPT,DO_HOST_LOOKUP,$(BR2_PACKAGE_DROPBEAR_
> ENABLE_REVERSE_DNS))
> + $(call DROPBEAR_SET_OPT,NON_INETD_MODE,$(BR2_USE_MMU))
> + $(call DROPBEAR_SET_OPT,DROPBEAR_BLOWFISH,!$(BR2_PACKAGE_
> DROPBEAR_SMALL))
> + $(call DROPBEAR_SET_OPT,DROPBEAR_TWOFISH128,!$(BR2_PACKAGE_
> DROPBEAR_SMALL))
> + $(call DROPBEAR_SET_OPT,DROPBEAR_TWOFISH256,!$(BR2_PACKAGE_
> DROPBEAR_SMALL))
> endef
>
> -define DROPBEAR_BUILD_FEATURED
> - $(SED) 's:^#define DROPBEAR_SMALL_CODE::' $(@D)/options.h
> - $(SED) 's:.*\(#define DROPBEAR_BLOWFISH\).*:\1:' $(@D)/options.h
> - $(SED) 's:.*\(#define DROPBEAR_TWOFISH128\).*:\1:' $(@D)/options.h
> - $(SED) 's:.*\(#define DROPBEAR_TWOFISH256\).*:\1:' $(@D)/options.h
> -endef
> -
> -define DROPBEAR_DISABLE_STANDALONE
> - $(SED) 's:\(#define NON_INETD_MODE\):/*\1 */:' $(@D)/options.h
> -endef
> +DROPBEAR_POST_EXTRACT_HOOKS += DROPBEAR_SET_OPTIONS
>
> define DROPBEAR_INSTALL_INIT_SYSTEMD
> $(INSTALL) -D -m 644 package/dropbear/dropbear.service \
> @@ -64,19 +65,11 @@ define DROPBEAR_INSTALL_INIT_SYSV
> $(INSTALL) -D -m 755 package/dropbear/S50dropbear \
> $(TARGET_DIR)/etc/init.d/S50dropbear
> endef
> -else
> -DROPBEAR_POST_EXTRACT_HOOKS += DROPBEAR_DISABLE_STANDALONE
> -endif
> -
> -ifeq ($(BR2_PACKAGE_DROPBEAR_DISABLE_REVERSEDNS),)
> -DROPBEAR_POST_EXTRACT_HOOKS += DROPBEAR_ENABLE_REVERSE_DNS
> endif
>
> ifeq ($(BR2_PACKAGE_DROPBEAR_SMALL),y)
> -DROPBEAR_POST_EXTRACT_HOOKS += DROPBEAR_BUILD_SMALL
> DROPBEAR_CONF_OPTS += --disable-zlib
> else
> -DROPBEAR_POST_EXTRACT_HOOKS += DROPBEAR_BUILD_FEATURED
> DROPBEAR_DEPENDENCIES += zlib
> endif
>
> --
> 2.17.0
>
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20180420/866efc7b/attachment.html>
^ permalink raw reply [flat|nested] 10+ messages in thread