Skip to content

schannel: allow verifyhost independently of verifypeer - #3285

Closed
bagder wants to merge 1 commit into
masterfrom
bagder/schannel-verifyhost
Closed

bagder wants to merge 1 commit into
masterfrom
bagder/schannel-verifyhost

Conversation

@bagder

@bagder bagder commented Nov 17, 2018

Copy link
Copy Markdown
Member

As documented and as working in other TLS backends.

Fixes #3284

@bagder bagder added the TLS label Nov 17, 2018
@bagder bagder changed the title schannel: allow verifhost independently of verifypeer schannel: allow verifyhost independently of verifypeer Nov 17, 2018
@bagder
bagder force-pushed the bagder/schannel-verifyhost branch from dca765d to 5b190ed Compare November 17, 2018 17:23
@bagder
bagder force-pushed the bagder/schannel-verifyhost branch from 5b190ed to 7ef6f3b Compare November 17, 2018 17:46
bagder added a commit that referenced this pull request Nov 17, 2018
@bagder

bagder commented Nov 17, 2018

Copy link
Copy Markdown
Member Author

I could use a review from someone who actually use or develop on Windows before I merge this. It is written completely "blind" as I don't have windows dev setup.

@jay

jay commented Nov 18, 2018

Copy link
Copy Markdown
Member

This would need to be changed to account for when HAS_MANUAL_VERIFY_API is not available. We should be able to verify the host without that. Perhaps so that the certificate function does not verify the host or check if verifypeer is enabled. In other words split it into Curl_verify_peer and Curl_verify_host and they both do exactly that, then check verifypeer or verifyhost before calling them. I will write up an alternate proposal.

jay added a commit to jay/curl that referenced this pull request Nov 19, 2018
Prior to this change if the user disabled the verify peer check then no
host check was done. Empirical testing shows
SCH_CRED_MANUAL_CRED_VALIDATION, which we use when peer verification is
disabled, also disables hostname verification.

In Windows < 8 our manual host verification check (ie the check used
when CA info is specified, or peer verification is disabled, or WinCE is
the OS) for schannel continues to only check the first subject alternate
name, and not all the names, since there is no easy way supported by the
API. It looks possible to do just more work, and should be addressed
separately.

Assisted-by: Daniel Stenberg
Reported-by: Martin Galvan

Fixes curl#3284
Closes curl#3285
Closes #xxxx
@jay

jay commented Nov 19, 2018

Copy link
Copy Markdown
Member

See https://github.com/curl/curl/compare/master...jay:winssl_verifyhost_fix1?expand=1&w=1
Many of the changes are whitespace changes so I turned on the whitespace filter w=1 but a lot of them are still showing up. Also I noticed the verify host function only checks all the dNSNames in Windows 8 or later, due to a limitation in the API (no CERT_NAME_SEARCH_ALL_NAMES_FLAG) and it doesn't look like it does any iPAddress checking. It is probably possible for us to support that and Windows 7 by iterating through CERT_ALT_NAME_INFO instead, but I think that should be addressed separately.

@bagder

bagder commented Nov 19, 2018 •

Copy link
Copy Markdown
Member Author

@jay: please, feel free to push/rebase that into this branch if you want. I have a bigger trust in your code than in mine for this (or create a separate PR of your own) so that we can get it through the CI and have the code easier to review!

@jay
jay force-pushed the bagder/schannel-verifyhost branch from 7ef6f3b to 5ad4285 Compare November 20, 2018 06:40
@bagder

bagder commented Nov 23, 2018

Copy link
Copy Markdown
Member Author

mingw seems to not like it:

vtls/schannel_verify.c: In function 'Curl_verify_host':
vtls/schannel_verify.c:85:16: error: 'CERT_NAME_DISABLE_IE4_UTF8_FLAG' undeclared (first use in this function)
   name_flags = CERT_NAME_DISABLE_IE4_UTF8_FLAG;
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vtls/schannel_verify.c:85:16: note: each undeclared identifier is reported only once for each function it appears in

Prior to this change if the user disabled the verify peer check then no
host check was done. Empirical testing shows
SCH_CRED_MANUAL_CRED_VALIDATION, which we use when peer verification is
disabled, also disables hostname verification.

In Windows < 8 our manual host verification check (ie the check used
when CA info is specified, or peer verification is disabled, or WinCE is
the OS) for schannel continues to only check the first subject alternate
name, and not all the names, since there is no easy way supported by the
API. It looks possible to do just more work, and should be addressed
separately.

Assisted-by: Daniel Stenberg
Reported-by: Martin Galvan

Fixes #3284
Closes #3285
Closes #xxxx
@jay
jay force-pushed the bagder/schannel-verifyhost branch from 5ad4285 to 8494374 Compare November 25, 2018 00:13
@bagder

bagder commented Feb 13, 2019

Copy link
Copy Markdown
Member Author

@jay what's the status on this PR? should we merge?

@bagder

bagder commented Mar 7, 2019

Copy link
Copy Markdown
Member Author

I take that as a no.

@bagder bagder closed this Mar 7, 2019
@lock lock Bot locked as resolved and limited conversation to collaborators Jun 5, 2019
@bagder
bagder deleted the bagder/schannel-verifyhost branch September 25, 2020 13:38
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Development

Successfully merging this pull request may close these issues.

Schannel can't disable only CURLOPT_SSL_VERIFYPEER and still verify the host name

2 participants