-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[S3Crt] Unable to do getobject when explicit 'Aws::S3Crt::ClientConfiguration::ca_path' is set to default path #3007
Comments
Thanks for the detailed repro code and explanation. Looking into what might be causing this to fail. Here is what I'm seeing in the logs
|
It looks like Aws::String ca_file = ca_path + "/cert.pem";
config.caFile = Aws::String(ca_file); |
@jmklix It works fine when
Previously, we were setting only
and should be expected to work only setting directly in |
can you print out contents of your "/etc/pki/tls" folder? For context, s3 crt uses s2n on linux for tls support (https://github.com/aws/s2n-tls) and s2n just uses libcrypto's X509_STORE_load_locations under the covers to load all the certs. So somehow libcrypto is not able to load certs from that path. Im not super familiar with where RHEL expects to store certs, but initial guess is that certs are in a slightly different folder or process somehow is not able to access them |
Please see below |
And cert.pem has the root CA that covers s3 certs? Is it default RHEL's pem or is it custom one? I did a quick test on my AL2 machine and ca_path seems to work fine. |
With the same CA certs, S3 is working fine.
Also note that this behaviour has been observed since we upgraded to 1.11.313 from 1.11.100. |
Yes. This is root CA and default RHEL's PEM. We have custom self signed certs which we can not use. |
Openssl requires a very specific format for how CAPath should be specified. That format is described here https://www.openssl.org/docs/man3.0/man3/X509_LOOKUP_hash_dir.html under "Hashed Directory Method". So if directory contains just a single cert bundle, Openssl will not be able to use certs from that bundle. Since SDK is basically just wrapping that Openssl behavior, SDK requires the same directory format. I've tested 1.11.100 and a version before that and could not get it working. As far as i cant tell this has been the behavior for a really long time and there has not been any changes to it in the 1.11.x timeframe. Also as far as i can tell Curl built with Openssl will have exactly same behavior. So regular s3 client should have the same requirement. And from mine quick testing it does. Curl docs do mention that non-openssl based builds might have a different behavior, but i checked a couple other openssl like libs and they all seem to require same directory format. |
@DmitriyMusatkin thanks for the update. Yes, that behaviour for We were optimised these code by setting |
So to summarize, when you were setting ca path through So after some digging i think i know what the issue is. After the PR above, it now checks tls connection options on ClientConfig and then ca_file/ca_path ignoring the globally configured tls connection options. Something we should definitely fix. So i think whats happening in your case is that when you are providing a global tls connection options callback it currently gets ignored and none of the options you provide are applied. It worked because default options were used. But with setting config.ca_path it no longer works because ca_path is not in expected format. |
#3037 restored behavior to respect connection options specified globally. which would make your old sample work as before. |
This issue is now closed. Comments on closed issues are hard for our team to see. |
Describe the bug
Unable to do getobject when explicit 'Aws::S3Crt::ClientConfiguration::ca_path' is set to default path
Expected Behavior
Get Object should work as expected when ca_path is set explicitly.
When we don't set ca_path explicitly, it work fine.
Current Behavior
Receives the error message
GetObject error:TLS (SSL) negotiation failed (aws-c-io: AWS_IO_TLS_ERROR_NEGOTIATION_FAILURE)
Reproduction Steps
The issue is easily reproducible with below code snippet
Please note that
get_default_openssl_dir()
is evaluate to/etc/pki/tls
Possible Solution
NA
Additional Information/Context
Build Command:
g++ -std=c++20 -o <output> test_s3_crt_ca_path.cpp -I${AWS_INSTALL_PATH}/include -L${AWS_INSTALL_PATH}/lib64 -lcurl -lssl -lpthread -lcrypto -laws-cpp-sdk-s3-crt -laws-cpp-sdk-core
AWS CPP SDK version used
AWS SDK for C++ 1.11.351
Compiler and Version used
g++ (GCC) 13.2.0
Operating System and version
Red Hat Enterprise Linux 9.4 (Plow)
The text was updated successfully, but these errors were encountered: