-
Notifications
You must be signed in to change notification settings - Fork 634
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use additional OpensslCredentials_t parameter for hostname checking. #1819
base: main
Are you sure you want to change the base?
Conversation
If certificate check fails, SSL_Connect will fail, thus the removed code will not run. It would only runs when successful. That function is meant to check the error code when there is a certificate validation issue. SSL_get_verify_result is being used incorrectly here; it is intended to get the validation error reason when SSL_Connect fails, and that failure is due to an invalid certificate.
59d62f0
to
dff1232
Compare
This reverts commit cd1b87b.
sslStatus = SSL_set1_host( pOpensslParams->pSsl, pServerInfo->pHostName ); | ||
|
||
if( sslStatus != 1 ) | ||
if( pOpensslCredentials->disableHostnameCheck == 0U ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer that we add a separate connect() function which takes a sockaddr_in rather than a hostname.
This would encourage the use of SNI whenever possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But I think just checking for pOpensslCredentials->sniHostName != NULL should be sufficient here.
@@ -118,6 +118,11 @@ typedef struct OpensslCredentials | |||
*/ | |||
const char * sniHostName; | |||
|
|||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sniHostName == NULL should result in SNI being disabled rather than an explicit disableHostnameCheck.
This will allow demos to disable hostname checking, allowing them to be used with Greengrass or other endpoints that do not have the hostname in their certificate subject.
By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.