Amazon ECS Service Connect에 TLS가 활성화되어 있는지 확인
Service Connect는 Service Connect 에이전트에서 TLS를 시작하고 대상 에이전트에서 종료합니다. 따라서 애플리케이션 코드에서는 TLS 상호 작용을 확인할 수 없습니다. 다음 단계에 따라 TLS가 활성화되어 있는지 확인합니다.
-
애플리케이션 이미지에
opensslCLI를 포함합니다. -
서비스에서 ECS Exec를 활성화하여 SSM을 통해 작업에 연결합니다. 또는 서비스와 동일한 Amazon VPC에서 Amazon EC2 인스턴스를 시작할 수 있습니다.
-
확인하려는 서비스에서 작업의 IP와 포트를 검색합니다. AWS Cloud Map 콘솔에서 작업 IP 주소를 검색할 수 있습니다. 이 정보는 네임스페이스의 서비스 세부 정보 페이지에서 찾을 수 있습니다.
-
다음 예제와 같이
execute-command를 사용하여 태스크 중 하나에 로그온합니다. 또는 2단계에서 생성한 Amazon EC2 인스턴스에 로그온합니다.$ aws ecs execute-command --clustercluster-name\ --tasktask-id\ --containercontainer-name\ --interactive \ --command "/bin/sh"참고
DNS 이름을 직접 호출해도 인증서가 공개되지 않습니다.
-
연결된 쉘에서
opensslCLI를 사용하여 작업에 연결된 인증서를 확인하고 조회합니다.예제:
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>