AWS

[AWS][Azure] Azure AD와 AWS 연동 시 사용자 행위 로그 추적

Always-Try 2022. 2. 7. 19:29

2022.02.07 - [AWS] - [AWS][Azure] Azure AD와 AWS 연동 을 통해 Azure AD 계정과 AWS IAM 연동을 했다.
이번 포스팅에서는 이와 같은 환경에서도 IAM 감사가 가능한지에 대해 살펴보겠다.

 

1. AWS 로그인에 대한 기록

  • Azure Active Directory > 엔터프라이즈 애플리케이션 > AWS > 활동 > 로그인 로그 
  • AWS > 버지니아 북부(us-east-1) > CloudTrail > 이벤트 기록

 

2. AWS 로그인 이후 행위 로그

  • Azure에서는 보이지 않음
  • AWS > 본인의 Region > aCloudTrail에서 확인 가능
  • AWS > Athena 쿼리로 조회 가능
    SELECT from_iso8601_timestamp(eventTime) AS "Time", useridentity.arn AS "Identity ARN", eventID AS "Event ID",
             eventsource AS "Service", eventname AS "Action", errorCode AS "Error", errorMessage AS "Message"
    FROM Your_Table_Name
    WHERE from_iso8601_timestamp(eventtime) >= from_iso8601_timestamp('2022-02-07T08:30:00Z')
            AND from_iso8601_timestamp(eventtime) < from_iso8601_timestamp('2022-02-08T23:00:00Z')
            AND userIdentity.sessionCOntext.sessionIssuer.userName = 'SupportUserRole(Your_Role_Name)'
    ORDER BY eventTime desc​
     
    참고로 Athena 쿼리의 조건절에 들어가는 변수들은 Athena 테이블 보다는 Cloudtrail 상세로그에서 확인하면 더 쉽다.


     
  • Federated user 관련 유사 내용 참고: https://aws.amazon.com/ko/blogs/security/how-to-easily-identify-your-federated-users-by-using-aws-cloudtrail/  

3. 미사용 권한 확인 (IAM에 대해 마지막으로 액세스한 정보 보기)

  • https://docs.aws.amazon.com/ko_kr/IAM/latest/UserGuide/access_policies_access-advisor-view-data.html
  • 사용자 관점 (AWS > IAM > 사용자 > 액세스 관리자/Access Advisor)
  • 사용자 그룹 관점 (AWS > IAM > 사용자 그룹 > 액세스 관리자/Access Advisor)

    참고로 마지막 '액세스 날짜에 추적 기간이 액세스되지 않음'으로 표시되는 것은 한번도 사용하지 않았다는 의미이다.

  • 역할 관점 (AWS > IAM > 역할 > 액세스 관리자/Access Advisor)
  • 역할 관점 (AWS > IAM > 정책 > 액세스 관리자/Access Advisor)