package/uacme: don't allow mbedtls with ualpn
PATCH v4 1/1 package/uacme: don't allow mbedtls with ualpn
ualpn with mbedtls requires the activation of MBEDTLS_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION on mbedtls which can be a security risk.
So let the user explicitly choose the crypto library by copy/pasting behavior of libssh and don't allow the user to select mbedtls with ualpn
Fixes:
- http://autobuild.buildroot.org/results/5d42189299549cd655218e9e7cfcfa63e79f74ec
---
Changes v3 -> v4:
- Fix commit title
Changes v2 -> v3 (after review of Yann E. Morin):
- Put back the option to select crypto backend and do not allow the user to select mbedtls with ualpn
Changes v1 -> v2 (after review of Thomas Petazzoni and Yann E. Morin):
- Do not use ualpn with mbedtls
package/uacme/Config.in | 24 ++++++++++++++++++++++++ package/uacme/uacme.mk | 6 +++--- 2 files changed, 27 insertions(+), 3 deletions(-)
package/uacme/Config.in +24 -0
@@ -16,6 +16,30 @@ config BR2_PACKAGE_UACME if BR2_PACKAGE_UACME +choice + prompt "Crypto Backend" + help + Select crypto library to be used in uacme. + +config BR2_PACKAGE_UACME_GNUTLS + bool "gnutls" + depends on BR2_PACKAGE_GNUTLS + +config BR2_PACKAGE_UACME_MBEDTLS + bool "mbedtls" + depends on BR2_PACKAGE_MBEDTLS + depends on !BR2_PACKAGE_UACME_UALPN + +comment "mbedtls crypto backend unavailable with ualpn" + depends on BR2_PACKAGE_MBEDTLS + depends on BR2_PACKAGE_UACME_UALPN + +config BR2_PACKAGE_UACME_OPENSSL + bool "openssl" + depends on BR2_PACKAGE_OPENSSL + +endchoice + config BR2_PACKAGE_UACME_UALPN bool "enable ualpn" depends on BR2_TOOLCHAIN_HAS_THREADS
package/uacme/uacme.mk +3 -3
@@ -15,13 +15,13 @@ UACME_DEPENDENCIES = libcurl UACME_CONF_ENV = ac_cv_prog_cc_c99='-std=gnu99' -ifeq ($(BR2_PACKAGE_GNUTLS),y) +ifeq ($(BR2_PACKAGE_UACME_GNUTLS),y) UACME_CONF_OPTS += --with-gnutls UACME_DEPENDENCIES += gnutls -else ifeq ($(BR2_PACKAGE_MBEDTLS),y) +else ifeq ($(BR2_PACKAGE_UACME_MBEDTLS),y) UACME_CONF_OPTS += --with-mbedtls UACME_DEPENDENCIES += mbedtls -else ifeq ($(BR2_PACKAGE_OPENSSL),y) +else ifeq ($(BR2_PACKAGE_UACME_OPENSSL),y) UACME_CONF_OPTS += --with-openssl UACME_DEPENDENCIES += openssl endif
Signature · 1 line
2.25.1
PATCH v4 1/1 package/uacme: don't allow mbedtls with ualpn
Fabrice, All,
On 2020-04-26 13:05 +0200, Fabrice Fontaine spake thusly:
Quoted 4 lines
ualpn with mbedtls requires the activation of
MBEDTLS_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSIONon mbedtls which can be a security risk.
Quoted 8 lines
So let the user explicitly choose the crypto library by copy/pasting behavior of libssh and don't allow the user to select mbedtls with ualpn
Fixes:
- http://autobuild.buildroot.org/results/5d42189299549cd655218e9e7cfcfa63e79f74ecSigned-off-by Fabrice Fontaine <[email protected]>---
[--SNIP--]
Quoted 21 lines
package/uacme/Config.in +13
-0@@ -16,6 +16,30 @@ config BR2_PACKAGE_UACME if BR2_PACKAGE_UACME +choice + prompt "Crypto Backend" + help + Select crypto library to be used in uacme. + +config BR2_PACKAGE_UACME_GNUTLS + bool "gnutls" + depends on BR2_PACKAGE_GNUTLS + +config BR2_PACKAGE_UACME_MBEDTLS + bool "mbedtls" + depends on BR2_PACKAGE_MBEDTLS + depends on !BR2_PACKAGE_UACME_UALPN
package/uacme/Config.in config BR2_PACKAGE_UACME · line 41
Quoted 10 lines
package/uacme/Config.in +10
-0+ +comment "mbedtls crypto backend unavailable with ualpn" + depends on BR2_PACKAGE_MBEDTLS + depends on BR2_PACKAGE_UACME_UALPN + +config BR2_PACKAGE_UACME_OPENSSL + bool "openssl" + depends on BR2_PACKAGE_OPENSSL + +endchoice
Sorry, but this is still not correct: enable mbedtls, then enable uacme and ualpn: there is no crypto backend selectable in the choice...
Regards,
Yann E. MORIN.
Quoted 31 lines
package/uacme/Config.in +0
-0config BR2_PACKAGE_UACME_UALPN bool "enable ualpn" depends on BR2_TOOLCHAIN_HAS_THREADSpackage/uacme/uacme.mk +3
-3@@ -15,13 +15,13 @@ UACME_DEPENDENCIES = libcurl UACME_CONF_ENV = ac_cv_prog_cc_c99='-std=gnu99' -ifeq ($(BR2_PACKAGE_GNUTLS),y) +ifeq ($(BR2_PACKAGE_UACME_GNUTLS),y) UACME_CONF_OPTS += --with-gnutls UACME_DEPENDENCIES += gnutls -else ifeq ($(BR2_PACKAGE_MBEDTLS),y) +else ifeq ($(BR2_PACKAGE_UACME_MBEDTLS),y) UACME_CONF_OPTS += --with-mbedtls UACME_DEPENDENCIES += mbedtls -else ifeq ($(BR2_PACKAGE_OPENSSL),y) +else ifeq ($(BR2_PACKAGE_UACME_OPENSSL),y) UACME_CONF_OPTS += --with-openssl UACME_DEPENDENCIES += openssl endifSignature · 6 lines
2.25.1 _______________________________________________ buildroot mailing list buildroot at busybox.net http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH v4 1/1 package/uacme: don't allow mbedtls with ualpn
Quoted 18 lines · On Sun, 26 Apr 2020 13:36:39 +0200 "Yann E. MORIN" <[email protected]>…
Quoted 18 lines
package/uacme/Config.in +18
-0+choice + prompt "Crypto Backend" + help + Select crypto library to be used in uacme. + +config BR2_PACKAGE_UACME_GNUTLS + bool "gnutls" + depends on BR2_PACKAGE_GNUTLS + +config BR2_PACKAGE_UACME_MBEDTLS + bool "mbedtls" + depends on BR2_PACKAGE_MBEDTLS + depends on !BR2_PACKAGE_UACME_UALPN + +comment "mbedtls crypto backend unavailable with ualpn" + depends on BR2_PACKAGE_MBEDTLS + depends on BR2_PACKAGE_UACME_UALPN +
Quoted 8 lines
package/uacme/Config.in config BR2_PACKAGE_UACME · line 41
Quoted 5 lines
package/uacme/Config.in +5
-0+config BR2_PACKAGE_UACME_OPENSSL + bool "openssl" + depends on BR2_PACKAGE_OPENSSL + +endchoiceSorry, but this is still not correct: enable mbedtls, then enable uacme and ualpn: there is no crypto backend selectable in the choice...
Do we need a choice in the first place ?
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH v4 1/1 package/uacme: don't allow mbedtls with ualpn
Le dim. 26 avr. 2020 ? 14:13, Thomas Petazzoni
<[email protected]> a ?crit :
Quoted 31 lines
Quoted 18 lines · On Sun, 26 Apr 2020 13:36:39 +0200 "Yann E. MORIN" <[email protected]>…
Quoted 18 lines
package/uacme/Config.in +18
-0+choice + prompt "Crypto Backend" + help + Select crypto library to be used in uacme. + +config BR2_PACKAGE_UACME_GNUTLS + bool "gnutls" + depends on BR2_PACKAGE_GNUTLS + +config BR2_PACKAGE_UACME_MBEDTLS + bool "mbedtls" + depends on BR2_PACKAGE_MBEDTLS + depends on !BR2_PACKAGE_UACME_UALPN + +comment "mbedtls crypto backend unavailable with ualpn" + depends on BR2_PACKAGE_MBEDTLS + depends on BR2_PACKAGE_UACME_UALPN +Quoted 8 lines
package/uacme/Config.in config BR2_PACKAGE_UACME · line 41
Quoted 5 lines
package/uacme/Config.in +5
-0+config BR2_PACKAGE_UACME_OPENSSL + bool "openssl" + depends on BR2_PACKAGE_OPENSSL + +endchoiceSorry, but this is still not correct: enable mbedtls, then enable uacme and ualpn: there is no crypto backend selectable in the choice...
Quoted 1 line
Do we need a choice in the first place ?
v2 didn't add a choice but it was a bit too confusing so I made v3/v4 upon Yann's request. I'll wait for your feedback before making a new iteration.
Quoted 6 lines
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Best Regards,
Fabrice
PATCH v4 1/1 package/uacme: don't allow mbedtls with ualpn
Quoted 4 lines · Fabrice Fontaine
Quoted 1 line
Do we need a choice in the first place ?
v2 didn't add a choice but it was a bit too confusing so I made v3/v4 upon Yann's request. I'll wait for your feedback before making a new iteration.
Hi Fabrice,
I think the idea of a backend choice menu is good, if you manage to sort out all the subtleties. There is a similar thing in libcurl which maybe you could have a look at:
https://git.busybox.net/buildroot/tree/package/libcurl/Config.in
As an aside, I filed a pull request with mbedTLS. If it gets accepted I'll be able to make ualpn work with mbedTLS without depending on MBEDTLS_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION:
https://github.com/ARMmbed/mbedtls/pull/3243
Take care,
Nicola
PATCH v4 1/1 package/uacme: don't allow mbedtls with ualpn
In reply to Fabrice FontaineFabrice, All,
On 2020-04-26 14:30 +0200, Fabrice Fontaine spake thusly:
Quoted 6 lines
Le dim. 26 avr. 2020 ? 14:13, Thomas Petazzoni
<[email protected]> a ?crit :Quoted 4 lines
Quoted 2 lines · On Sun, 26 Apr 2020 13:36:39 +0200 "Yann E. MORIN" <[email protected]>…
Quoted 2 lines
package/uacme/Config.in +2
-0+choice + prompt "Crypto Backend"
Note that a choice must define its type, so use 'bool', not 'prompt'.
Yes, I know we have a lot of choices that use 'prompt' and do not spcify their types. That's not a reason to continue begin wrong. ;-) We also have quite a few choices that correctly use 'bool', so that would not be a first either.
(Note: choices can be tristate, too, even if we don't use tristates in Buildroot, hence the reason to specify the type.)
Quoted 25 lines
Quoted 25 lines
Quoted 24 lines
Quoted 11 lines
package/uacme/Config.in +11
-0+ help + Select crypto library to be used in uacme. + +config BR2_PACKAGE_UACME_GNUTLS + bool "gnutls" + depends on BR2_PACKAGE_GNUTLS + +config BR2_PACKAGE_UACME_MBEDTLS + bool "mbedtls" + depends on BR2_PACKAGE_MBEDTLS + depends on !BR2_PACKAGE_UACME_UALPNpackage/uacme/Config.in config BR2_PACKAGE_UACME · line 41
Quoted 10 lines
package/uacme/Config.in +10
-0+ +comment "mbedtls crypto backend unavailable with ualpn" + depends on BR2_PACKAGE_MBEDTLS + depends on BR2_PACKAGE_UACME_UALPN + +config BR2_PACKAGE_UACME_OPENSSL + bool "openssl" + depends on BR2_PACKAGE_OPENSSL + +endchoiceSorry, but this is still not correct: enable mbedtls, then enable uacme and ualpn: there is no crypto backend selectable in the choice...
Quoted 4 lines
Quoted 1 line
Do we need a choice in the first place ?
v2 didn't add a choice but it was a bit too confusing so I made v3/v4 upon Yann's request. I'll wait for your feedback before making a new iteration.
For the record, v1 of the patchset had a choice. It was not the choice that propmpted a respin, but the way the patches were ordered (i.e. the fix was coming after the features).
It turns out that adding the choice can be both the fix (for the ualpn incompatibility with mbedtls) *and* the feature (choosing the crypto backend).
One way to solve the issue would be something like:
diff --git a/package/uacme/Config.in b/package/uacme/Config.in index 58b7c534e7..53a0ab4bf2 100644
--- a/package/uacme/Config.in
+++ b/package/uacme/Config.in
@@ -16,14 +16,36 @@ config BR2_PACKAGE_UACME
if BR2_PACKAGE_UACME
+choice
+ bool "crypto backend"
+
+config BR2_PACKAGE_UACME_CRYPTO_GNUTLS
+ bool "gnutls"
+ depends on BR2_PACKAGE_GNUTLS
+
+config BR2_PACKAGE_UACME_CRYPTO_MBEDTLS
+ bool "mbedtls"
+ depends on BR2_PACKAGE_MBEDTLS
+
+config BR2_PACKAGE_UACME_CRYPTO_OPENSSL
+ bool "openssl"
+ depends on BR2_PACKAGE_OPENSSL
+
+endchoice
+
config BR2_PACKAGE_UACME_UALPN
bool "enable ualpn"
depends on BR2_TOOLCHAIN_HAS_THREADS
+ depends on !BR2_PACKAGE_UACME_CRYPTO_MBEDTLS
select BR2_PACKAGE_LIBEV
help
Build and install ualpn, the transparent proxying tls-alpn-01 challenge responder.
+comment "ualpn incompatible with the mbedtls crypto backend"
+ depends on BR2_TOOLCHAIN_HAS_THREADS
+ depends on !BR2_PACKAGE_UACME_CRYPTO_MBEDTLS
+
comment "ualpn needs a toolchain w/ threads"
depends on !BR2_TOOLCHAIN_HAS_THREADS
Regards,
Yann E. MORIN.
Quoted 8 lines
Quoted 5 lines
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.comBest Regards,
Fabrice
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH v4 1/1 package/uacme: don't allow mbedtls with ualpn
In reply to Thomas PetazzoniThomas, All,
On 2020-04-26 14:13 +0200, Thomas Petazzoni spake thusly:
Quoted 28 lines
Quoted 17 lines · On Sun, 26 Apr 2020 13:36:39 +0200 "Yann E. MORIN" <[email protected]>…
Quoted 17 lines
package/uacme/Config.in +17
-0+choice + prompt "Crypto Backend" + help + Select crypto library to be used in uacme. + +config BR2_PACKAGE_UACME_GNUTLS + bool "gnutls" + depends on BR2_PACKAGE_GNUTLS + +config BR2_PACKAGE_UACME_MBEDTLS + bool "mbedtls" + depends on BR2_PACKAGE_MBEDTLS + depends on !BR2_PACKAGE_UACME_UALPN + +comment "mbedtls crypto backend unavailable with ualpn" + depends on BR2_PACKAGE_MBEDTLS + depends on BR2_PACKAGE_UACME_UALPNQuoted 8 lines
package/uacme/Config.in config BR2_PACKAGE_UACME · line 41
Quoted 6 lines
package/uacme/Config.in +6
-0+ +config BR2_PACKAGE_UACME_OPENSSL + bool "openssl" + depends on BR2_PACKAGE_OPENSSL + +endchoiceSorry, but this is still not correct: enable mbedtls, then enable uacme and ualpn: there is no crypto backend selectable in the choice...
Quoted 1 line
Do we need a choice in the first place ?
We already have a few packages (libcurl, libssh, libssh2) that have a choice for the crypto backend, so why not for uacme?
Yes, the above are all libraries, but that is not much different for an application I believe.
Regards,
Yann E. MORIN.
Quoted 5 lines
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH v4 1/1 package/uacme: don't allow mbedtls with ualpn
Quoted 6 lines · On Sun, 26 Apr 2020 21:21:30 +0200 "Yann E. MORIN" <[email protected]>…
Quoted 3 lines
Quoted 2 lines
Sorry, but this is still not correct: enable mbedtls, then enable uacme and ualpn: there is no crypto backend selectable in the choice...
Do we need a choice in the first place ?
We already have a few packages (libcurl, libssh, libssh2) that have a choice for the crypto backend, so why not for uacme?
Are they really needed? Don't we generally try to use automatic dependencies when possible?
We also have plenty of packages without any choice, for example:
ifeq ($(BR2_PACKAGE_GNUTLS),y)LIBNICE_CONF_OPTS += --with-crypto-library=gnutlsLIBNICE_DEPENDENCIES += gnutls
else
LIBNICE_CONF_OPTS += \
--with-crypto-library=openssl \
--with-openssl=$(STAGING_DIR)/usrLIBNICE_DEPENDENCIES += openssl
endif
ifeq ($(BR2_PACKAGE_GNUTLS),y)MSMTP_CONF_OPTS += --with-tls=gnutlsMSMTP_DEPENDENCIES += gnutls
else ifeq ($(BR2_PACKAGE_OPENSSL),y)MSMTP_CONF_OPTS += --with-tls=opensslMSMTP_DEPENDENCIES += openssl
elseMSMTP_CONF_OPTS += --with-tls=no
endif
etc, etc.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com