summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetr Štetiar <ynezz@true.cz>2020-12-10 10:58:55 +0100
committerPetr Štetiar <ynezz@true.cz>2020-12-11 11:17:22 +0100
commit073f89f567c04ee0e5df235051cb8d4c93dbcbea (patch)
tree3ba7d7cfb6fa19fe395ef417f9621c7fb4eff20e
parent086c292160ace27274b47a7c37e22fd173b2da9b (diff)
downloaduclient-073f89f567c04ee0e5df235051cb8d4c93dbcbea.tar.gz
uclient-fetch: wolfSSL: fix certificate validation
Currently wolfSSL doesn't validate any certificates, quoting from README: wolfSSL takes a different approach to certificate verification than OpenSSL does. The default policy for the client is to verify the server, this means that if you don't load CAs to verify the server you'll get a connect error, no signer error to confirm failure (-188). If you want to mimic OpenSSL behavior of having SSL_connect succeed even if verifying the server fails and reducing security you can do this by calling: wolfSSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, 0); before calling wolfSSL_new();. Though it's not recommended. wolfSSL simply behaves differently then OpenSSL so once you set SSL_VERIFY_NONE wolfSSL doesn't care about the certificates anymore so every call to SSL_get_verify_result() is going to succeed (returns X509_V_OK) even for invalid certificates and current OpenSSL based post connection verification logic thus doesn't work. So in order to get the validation working we need to use SSL_VERIFY_PEER for wolfSSL by default and allow disabling it explicitly by new `context_set_require_validation()` call. Fixes: FS#3465 Signed-off-by: Petr Štetiar <ynezz@true.cz>
-rw-r--r--uclient-fetch.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/uclient-fetch.c b/uclient-fetch.c
index bbf5eec..958f756 100644
--- a/uclient-fetch.c
+++ b/uclient-fetch.c
@@ -591,6 +591,8 @@ int main(int argc, char **argv)
switch (longopt_idx) {
case L_NO_CHECK_CERTIFICATE:
verify = false;
+ if (ssl_ctx)
+ ssl_ops->context_set_require_validation(ssl_ctx, verify);
break;
case L_CA_CERTIFICATE:
has_cert = true;