Skip to content
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

OpenSSL updates: allow to configure or skip verification #152

Merged
merged 1 commit into from
Feb 15, 2022

Conversation

Enmk
Copy link
Collaborator

@Enmk Enmk commented Feb 9, 2022

Added ClientOptions:

  • skip_verification - to skip all verification
  • host_flags - to set hostname verification mode
  • configuration - to configure SSL connection

Updated and refactored tests.
Updated tests/simple/main.cpp to reuse so utility code from unit-tests.

Closes: #142

}
// Host name verification is done by OpenSSL itself, however if we are connecting to an ip-address,
// no verification is made, so we have to do it manually.
// Just in case if this is ever required, leave it here commented out.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, makes sense to have some safe defaults

@@ -143,42 +178,42 @@ SSLSocket::SSLSocket(const NetworkAddress& addr, const SSLParams & ssl_params, S
if (!ssl)
throw std::runtime_error("Failed to create SSL instance");

std::unique_ptr<ASN1_OCTET_STRING, decltype(&ASN1_OCTET_STRING_free)> ip_addr(a2i_IPADDRESS(addr.Host().c_str()), &ASN1_OCTET_STRING_free);

HANDLE_SSL_ERROR(ssl, SSL_set_fd(ssl, handle_));
if (ssl_params.use_SNI)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sidenote: maybe that is not needed at all, it sounds safe to call SSL_set_tlsext_host_name always.

/** Mode of verifying host ssl certificate against name of the host, set with SSL_set_hostflags.
* For details see https://www.openssl.org/docs/man1.1.1/man3/SSL_set_hostflags.html
*/
DECLARE_FIELD(host_flags, int, SetHostVerifyFlags, DEFAULT_VALUE);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test? For example maybe we can trigger X509_CHECK_FLAG_NO_WILDCARDS? I guess it should make the github.demo.trial.altinity.cloud stop working, because it uses wildcard cert:

depth=0 CN = *.demo.trial.altinity.cloud

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rn, it is too hard to set up any complex tests with the tools we have

But I already asked QA team to do the in-depth tests with various tricky ssl (mis)configurations. They'll do it once they have resources.

@Enmk Enmk force-pushed the openssl_allow_skip_verification branch from 219cff8 to d2f589a Compare February 14, 2022 09:31
Added ClientOptions:
  - skip_verification - to skip all verification
  - host_flags - to set hostname verification mode
  - configuration - to configure SSL connection

Updated and refactored tests.
Updated tests/simple/main.cpp to reuse so utility code from unit-tests.
@Enmk Enmk force-pushed the openssl_allow_skip_verification branch from d2f589a to 257909b Compare February 15, 2022 09:05
@Enmk Enmk merged commit 4b38dd4 into master Feb 15, 2022
@Enmk Enmk deleted the openssl_allow_skip_verification branch February 16, 2022 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Setting to skip certificate checks (for self-signed certificates / tests)
2 participants