SSM 세션의 추가 KMS 암호화 설정 점검

Session Manager의 기본 TLS 보호와 추가 KMS 암호화 요구사항을 구분하세요.

설명

Session Manager는 기본적으로 세션 통신을 TLS로 암호화합니다. 지원되는 세션 유형에서 명령과 응답에 조직이 관리하는 키를 추가로 적용하려면 세션 문서에 kmsKeyId를 지정하세요.

잠재적 영향

키 권한이 부족하면 세션을 시작할 수 없습니다. 관리형 노드에 접속하고 명령을 실행할 수 있는 사용자도 별도로 제한하세요.

해결 방법

실제로 사용할 Session 문서의 inputs.kmsKeyId에 대칭 KMS 키를 지정하세요. 세션 시작 사용자에게 kms:GenerateDataKey, 관리형 노드 역할에 kms:Decrypt를 허용하세요. 지원되는 SSM Agent를 사용하고, 이 문서를 선택해 새 세션을 시작할 수 있는지 확인하세요.

예시

두 발췌는 test_document라는 사용자 정의 Standard_Stream 문서입니다. 두 번째는 var.kms_key_id로 키를 추가하며, 이 문서를 사용하는 세션에만 적용됩니다. 세션 로그를 보관하려면 암호화 플래그 외에 저장 대상도 지정하세요.

기본 TLS 보호

hcl
resource "aws_ssm_document" "example" {
  name          = "test_document"
  document_type = "Session"

  content = <<DOC
  {
    "schemaVersion": "1.0",
    "description": "세션 환경설정",
    "sessionType": "Standard_Stream",
    "inputs": {
      "s3EncryptionEnabled": true,
      "cloudWatchEncryptionEnabled": true,
      "cloudWatchStreamingEnabled": true,
      "runAsEnabled": false
    }
  }
DOC
}

추가 KMS 암호화

hcl
resource "aws_ssm_document" "example" {
  name          = "test_document"
  document_type = "Session"

  content = <<DOC
  {
    "schemaVersion": "1.0",
    "description": "세션 환경설정",
    "sessionType": "Standard_Stream",
    "inputs": {
      "s3EncryptionEnabled": true,
      "cloudWatchEncryptionEnabled": true,
      "cloudWatchStreamingEnabled": true,
      "runAsEnabled": false,
      "kmsKeyId": "${var.kms_key_id}"
    }
  }
DOC
}

참조