Why is there NO way to use a self signed Cert by specifying a certificate file? #1277
Replies: 5 comments 2 replies
-
The The Rust SDK developer guide now has examples of providing a custom CA root: https://docs.aws.amazon.com/sdk-for-rust/latest/dg/http.html#customizeCertificatesTls |
Beta Was this translation helpful? Give feedback.
-
Thanks Aaron,
I will try this. I could find nothing, and after extensive Chat interactions, pointing it at Github examples, the Rust crates, the aws_sdk_s3, rustls, smithy-aws, etc. etc. I ended up with 40 sets of code, none of which would compile.
It would be nice to add something to the high level documentation pointing here also, because searching the docs for “CA” “Certs”, Custom, etc. all turned up nothing.
Regards,
—Russ
Russ Fellows
Senior Partner, Evaluator Group
***@***.***
… On Apr 11, 2025, at 12:20 PM, Aaron Todd ***@***.***> wrote:
The AWS_CA_BUNDLE is a CLI specific environment variable.
The Rust SDK developer guide now has examples of providing a custom CA root: https://docs.aws.amazon.com/sdk-for-rust/latest/dg/http.html#customizeCertificatesTls
—
Reply to this email directly, view it on GitHub <#1277 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AF64UJ5K4ND7RMHHAGW4O432ZABXRAVCNFSM6AAAAAB26WMOVKVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTEOBQG42DCNA>.
You are receiving this because you authored the thread.
|
Beta Was this translation helpful? Give feedback.
-
Sorry, that is not helpful. The code sample is WAY too minimal. If there are going to be examples, it needs to produce code that someone can actually run. The reference is a small code snipet which is useless without a lot more code. I am attaching a Rust program that "SHOULD" compile and create a useful example. Except of course it does not because there is not enough information in all the crates to create a working example. This is as close as I can come. If it were to compile, it would use environment variables for KEY_ID and SECRET_KEY along with URL to connect to S3 storage over TLS, and list the contents of a given bucket. Importantly, it should also allow the use of a custom certificate, via CLI or environment variable. Can ANYONE please correct this, and produce an actual working example? I STILL have NEVER seen a working example. Code attached: |
Beta Was this translation helpful? Give feedback.
-
Update. I have been reading docs, and "chatting" with the AI gods. The program example is now closer to compiling. I use the EXACT same function as specified by Aaron above. That code is fine, it's just that there are still no examples of how to use that to build an actual functional S3 client. Note the following version that reports two errors from "cargo build". I will also attach my Cargo.toml file. Cargo.toml:
Rust main.rs:
|
Beta Was this translation helpful? Give feedback.
-
Couple things stand out:
The developer guide provides the necessary code for all of these things. let http_client = Builder::new()
.tls_provider(tls::Provider::Rustls(CryptoMode::AwsLc))
.tls_context(tls_context_from_pem("my-custom-ca.pem"))
.build_https();
let sdk_config = aws_config::defaults(
aws_config::BehaviorVersion::latest()
)
.http_client(http_client)
.endpoint_url("https://localhost:9000")
.load()
.await;
// create client(s) using sdk_config
let s3_client = aws_sdk_s3::Client::new(&sdk_config);
// List objects in the specified bucket
list_bucket_objects(&s3_client, bucket).await; |
Beta Was this translation helpful? Give feedback.
-
In general, this SDK is great. I have a created an S3 client, and am able to do GET, PUT, DELETE, LIST, and other necessary operations. Great, BUT... so far is has proven impossible to specify a CA bundle to support self signed certificates. Has ANYONE done this? Where are examples or documentation? It doesn't exist as far as I can find.
Ideally, it would be great to support operations EXACTLY as the "aws s3" cli does, but doing it at all would be a great start. For example the following method of specifying a ca_bundle:
aws s3 ca_bundle = /path/to/cabundle-2019mar05.pem ls s3://my-bucket
This is documented here: [(https://docs.aws.amazon.com/cli/v1/userguide/cli-configure-files.html)]
However, there is no documented method, or code that supports this in the Rust aws_sdk_s3
Note: The setting an environment variable with this SDK, as is documented with aws cli does NOT work:
AWS_CA_BUNDLE=/path/to/ca-cert/cacert.pem
Beta Was this translation helpful? Give feedback.
All reactions