-
Notifications
You must be signed in to change notification settings - Fork 4k
ARROW-10206: [C++][Python][FlightRPC] Allow disabling server validation #8325
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
Conversation
|
Hey James, I'll review this later today hopefully, but just to answer a few questions
|
|
Actually, it seems the relevant changes have been there since early this year. It may be OK to switch fully. |
lidavidm
left a comment
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.
Looks good to me as a start. Can unit tests be added? There are already tests set up to use (self-signed) certs that could serve as a starting point.
70029e3 to
3146745
Compare
Hi @lidavidm .
|
|
@kszucs - are we ok to bump the gRPC versions like this? |
67ba576 to
cff2212
Compare
dd8664a to
981281f
Compare
a516c3c to
d054783
Compare
Co-authored-by: Uwe L. Korn <[email protected]>
Also revert manylinux builds to use gRPC 1.29.1 instead of 1.32 as they were using previously.
Detect which namespace, if any that TlsCredentialsOptions is in, and conditionally compile the Flight client code to use that. If TlsCredentialsOptions is not available, or doesn't let you specify server verification options then disallow support for using disable server verification on the client.
|
There's some broken stuff for me locally with clang-8, I'm trying to fix |
The files in try_compile shouldn't be built as part of the project -- they should only be invoked by CMake for assessing grpc-cpp version information. |
Right, but the CMAKE_CXX_FLAGS set at that point are passed along, including |
Thanks for fixing that Wes. |
lidavidm
left a comment
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.
LGTM. I'll follow up on the ML.
cpp/src/arrow/flight/client.cc
Outdated
| // requires root CA certs, even if you are skipping server | ||
| // verification. | ||
| #if defined(GRPC_NAMESPACE_FOR_TLS_CREDENTIALS_OPTIONS) | ||
| const char BLANK_ROOT_PEM[] = |
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.
nit: constexpr? or static.
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.
Made a constexpr
|
|
||
| class ARROW_FLIGHT_EXPORT FlightClientOptions { | ||
| public: | ||
| FlightClientOptions(); |
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.
there shouldn't be two ways of getting the default values. If there needs to be another constructor that takes credentials, then use the static factory pattern.
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.
The default constructor was already there prior to this patch, it was just being implicitly defined instead of explicitly. I agree in principle that the Defaults() method should be used, however the constructor has already been public and I'm not sure it's worth breaking existing application code.
We're not really consistent about this internally either.
The C++ unit tests make use of both the public constructor and Defaults() method. The Python wrapper uses the public constructor.
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.
Given there's already code using the default constructor, I think we can remove it separately: https://issues.apache.org/jira/browse/ARROW-10250
cpp/src/arrow/flight/client.cc
Outdated
| if (options.disable_server_verification) { | ||
| #if !defined(GRPC_NAMESPACE_FOR_TLS_CREDENTIALS_OPTIONS) | ||
| return Status::NotImplemented( | ||
| "Using encryption with server verification is unsupported."); |
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.
Mention the reason in the error message?
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.
Done.
| std::make_shared<NoOpTlsAuthorizationCheck>()); | ||
| auto materials_config = std::make_shared<ge::TlsKeyMaterialsConfig>(); | ||
| materials_config->set_pem_root_certs(BLANK_ROOT_PEM); | ||
| ge::TlsCredentialsOptions tls_options( |
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.
So gRPC has both TlsCredentialsOptions and SslCredentialOptions?
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.
Yes, but they aren't interchangeable. One works against TlsCredentials and one works against SslCredentials. TlsCredentials is a newer, currently experimental API that can do everything SslCredentials can do and more, such as do certificate reloading and supplying custom callbacks for cert verification.
|
Waiting for CI here... |
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.
Ok, looks like the MacOS build is failing due to an unrelated reason (Cython not being found) and other PRs (and master) are failing in the same way. (Travis still pending...)
|
|
||
| class ARROW_FLIGHT_EXPORT FlightClientOptions { | ||
| public: | ||
| FlightClientOptions(); |
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.
Given there's already code using the default constructor, I think we can remove it separately: https://issues.apache.org/jira/browse/ARROW-10250
|
thanks everyone |
| # way to pass -isystem $GRPC_INCLUDE_DIR instead of -I$GRPC_INCLUDE_DIR | ||
| set(CMAKE_CXX_FLAGS_BACKUP "${CMAKE_CXX_FLAGS}") | ||
| string(REPLACE "/WX" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") | ||
| string(REPLACE "-Werror" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") |
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.
This doesn't work with -Werror=SOMETHING: #8419
…efaults This is a small follow up from PR #8325 to encourage always using a Defaults() method to avoid accidentally leaving fields uninitialized. Closes #9728 from lidavidm/arrow-10250 Authored-by: David Li <[email protected]> Signed-off-by: Yibo Cai <[email protected]>
@lidavidm WIP: