Amazon ECS Service Connect에 TLS가 활성화되어 있는지 확인
Service Connect는 Service Connect 에이전트에서 TLS를 시작하고 대상 에이전트에서 종료합니다. 따라서 애플리케이션 코드에서는 TLS 상호 작용을 확인할 수 없습니다. 다음 단계에 따라 TLS가 활성화되어 있는지 확인합니다.
-
애플리케이션 이미지에
openssl
CLI가 있는지 확인합니다. -
서비스에서 ECS Exec를 활성화하여 SSM을 통해 작업에 연결합니다. 또는 서비스와 동일한 Amazon VPC에서 Amazon EC2 인스턴스를 시작할 수 있습니다.
-
확인하려는 서비스에서 작업의 IP와 포트를 검색합니다. 예를 들어,
redis
서비스에 TLS가 켜져 있는 경우 AWS Cloud Map으로 이동하고 해당 서비스를 찾아 한 인스턴스의 IP 및 포트를 조회하여 해당 작업 IP를 검색할 수 있습니다. -
다음 예제와 같이
execute-command
를 사용하여 태스크 중 하나에 로그온합니다. 또는 2단계에서 생성한 Amazon EC2 인스턴스에 로그온합니다.$ aws ecs execute-command --cluster cluster-name \ --task < TASK_ID> \ --container app \ --interactive \ --command "/bin/sh"
참고
DNS 이름을 직접 호출해도 인증서가 공개되지 않습니다.
-
연결된 쉘에서
openssl
CLI를 사용하여 작업에 연결된 인증서를 확인하고 조회합니다.예제
openssl s_client -connect 10.0.147.43:6379 < /dev/null 2> /dev/null \ | openssl x509 -noout -text
응답의 예:
Certificate: Data: Version: 3 (0x2) Serial Number: <serial-number> Signature Algorithm: ecdsa-with-SHA256 Issuer: <issuer> Validity Not Before: Jan 23 21:38:12 2024 GMT Not After : Jan 30 22:38:12 2024 GMT Subject: <subject> Subject Public Key Info: Public Key Algorithm: id-ecPublicKey Public-Key: (256 bit) pub: <pub> ASN1 OID: prime256v1 NIST CURVE: P-256 X509v3 extensions: X509v3 Subject Alternative Name: DNS:redis.yelb-cftc X509v3 Basic Constraints: CA:FALSE X509v3 Authority Key Identifier: keyid:<key-id> X509v3 Subject Key Identifier: 1D:<id> X509v3 Key Usage: critical Digital Signature, Key Encipherment X509v3 Extended Key Usage: TLS Web Server Authentication, TLS Web Client Authentication Signature Algorithm: ecdsa-with-SHA256 <hash>