You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
2.3 KiB

  1. From a43420ba07645acb71f31e95b9c7b4e894794afd Mon Sep 17 00:00:00 2001
  2. From: Glenn Strauss <gstrauss@gluelogic.com>
  3. Date: Sun, 6 Dec 2020 22:50:49 -0500
  4. Subject: [PATCH] [mod_wolfssl] add complex preproc logic for SNI
  5. add complex preproc logic for SNI detection
  6. - HAVE_SNI is not sufficient
  7. - HAVE_LIGHTY is not sufficient (in wolfssl <= 4.5.0)
  8. Instead, use more complex logic wrapping calls to SNI_Callback()
  9. in wolfssl.
  10. x-ref:
  11. "[lighttpd] -mod-wolfssl inhibited by missing library functionality"
  12. https://github.com/openwrt/packages/issues/14142
  13. "put all SNI code behind simpler preprocessor directive HAVE_SNI"
  14. https://github.com/wolfSSL/wolfssl/pull/3538
  15. Signed-off-by: Glenn Strauss <gstrauss@gluelogic.com>
  16. ---
  17. src/mod_wolfssl.c | 15 ++++++++++++---
  18. 1 file changed, 12 insertions(+), 3 deletions(-)
  19. diff --git a/src/mod_wolfssl.c b/src/mod_wolfssl.c
  20. index a22b0ebe..70f7488b 100644
  21. --- a/src/mod_wolfssl.c
  22. +++ b/src/mod_wolfssl.c
  23. @@ -2041,13 +2041,22 @@ network_init_ssl (server *srv, plugin_config_socket *s, plugin_data *p)
  24. * && (HAVE_STUNNEL || WOLFSSL_NGINX || HAVE_LIGHTY)))
  25. * and sniRecvCb sniRecvCbArg are hidden by *different* set of defines
  26. * in wolfssl/internal.h)
  27. - * Note: SNI callbacks disabled if wolfSSL is not built OPENSSL_ALL ! */
  28. - #ifdef OPENSSL_ALL /* regretable */
  29. + * Note: wolfSSL SNI callbacks members not present unless wolfSSL is
  30. + * built OPENSSL_ALL or some additional combination of preprocessor
  31. + * defines. The following should work with more recent wolfSSL versions
  32. + * (and HAVE_LIGHTY is not sufficient in wolfssl <= 4.5.0) */
  33. + #if defined(OPENSSL_ALL) \
  34. + || (defined(OPENSSL_EXTRA) \
  35. + && (defined(HAVE_STUNNEL) \
  36. + || defined(WOLFSSL_NGINX) \
  37. + || defined(WOLFSSL_HAPROXY)))
  38. + #else
  39. + #undef HAVE_SNI
  40. + #endif
  41. #ifdef HAVE_SNI
  42. wolfSSL_CTX_set_servername_callback(
  43. s->ssl_ctx, network_ssl_servername_callback);
  44. wolfSSL_CTX_set_servername_arg(s->ssl_ctx, srv);
  45. - #endif /* regretable */
  46. #else
  47. log_error(srv->errh, __FILE__, __LINE__,
  48. "SSL: WARNING: SNI callbacks *crippled* in wolfSSL library build");
  49. --
  50. 2.28.0