에서 최소 TLS 버전 적용 AWS SDK for Rust - AWS SDK for Rust

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

에서 최소 TLS 버전 적용 AWS SDK for Rust

는 AWS 서비스와 통신할 때 TLS를 AWS SDK for Rust 사용하여 보안을 강화합니다. SDK는 기본적으로 최소 TLS 버전 1.2를 적용합니다. 기본적으로 SDK는 클라이언트 애플리케이션과 서비스 모두에서 사용할 수 있는 최고 버전의 TLS도 협상합니다. 예를 들어 SDK는 TLS 1.3을 협상할 수 있습니다.

SDK가 사용하는 TCP 커넥터의 수동 구성을 제공하여 애플리케이션에서 특정 TLS 버전을 적용할 수 있습니다. 이를 설명하기 위해 다음 예제에서는 TLS 1.3을 적용하는 방법을 보여줍니다.

참고

일부 AWS 서비스는 아직 TLS 1.3을 지원하지 않으므로이 버전을 적용하면 SDK 상호 운용성에 영향을 미칠 수 있습니다. 프로덕션 배포 전에 각 서비스로이 구성을 테스트하는 것이 좋습니다.

pub async fn connect_via_tls_13() -> Result<(), Error> { println!("Attempting to connect to KMS using TLS 1.3: "); // Let webpki load the Mozilla root certificates. let mut root_store = RootCertStore::empty(); root_store.add_server_trust_anchors(webpki_roots::TLS_SERVER_ROOTS.0.iter().map(|ta| { rustls::OwnedTrustAnchor::from_subject_spki_name_constraints( ta.subject, ta.spki, ta.name_constraints, ) })); // The .with_protocol_versions call is where we set TLS1.3. You can add rustls::version::TLS12 or replace them both with rustls::ALL_VERSIONS let config = rustls::ClientConfig::builder() .with_safe_default_cipher_suites() .with_safe_default_kx_groups() .with_protocol_versions(&[&rustls::version::TLS13]) .expect("It looks like your system doesn't support TLS1.3") .with_root_certificates(root_store) .with_no_client_auth(); // Finish setup of the rustls connector. let rustls_connector = hyper_rustls::HttpsConnectorBuilder::new() .with_tls_config(config) .https_only() .enable_http1() .enable_http2() .build(); // See https://github.com/awslabs/smithy-rs/discussions/3022 for the HyperClientBuilder let http_client = HyperClientBuilder::new().build(rustls_connector); let shared_conf = aws_config::defaults(BehaviorVersion::latest()) .http_client(http_client) .load() .await; let kms_client = aws_sdk_kms::Client::new(&shared_conf); let response = kms_client.list_keys().send().await?; println!("{:?}", response); Ok(()) }