aws-remediate-cis-securityhub/cft/aws-cis-securityhubactions.yml [1370:1424]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                      DocumentVersion='1', # default
                      Parameters={
                          'username': [ username ],
                          'findingid': [Id]
                      }
                  )
              except Exception as e:
                  print(e)
                  print("SSM automation execution error")
                  raise

  IAMUserPolicyDetachEnabledLambdaRole:
    Type: AWS::IAM::Role
    Properties:
      Policies:
      - PolicyName: IAMUserPolicyDetachEnabledLambdaPolicy
        PolicyDocument:
          Version: 2012-10-17
          Statement:
          - Effect: Allow
            Action:
            - cloudwatch:PutMetricData
            - iam:*
            Resource: '*'
          - Effect: Allow
            Action:
            - ssm:StartAutomationExecution
            - logs:CreateLogGroup
            - logs:CreateLogStream
            - logs:PutLogEvents
            - logs:DescribeLogGroups
            - iam:PassRole
            Resource: '*'
          - Effect: Allow
            Action:
            - cloudtrail:UpdateTrail
            - securityhub:UpdateFindings
            Resource: '*'
      AssumeRolePolicyDocument:
        Version: 2012-10-17
        Statement:
        - Effect: Allow
          Principal: { Service: lambda.amazonaws.com }
          Action:
          - sts:AssumeRole


# -------------------------------------------------------------------------------------------------------------------------------------------------------
# CIS AWS Foundations Benchmark - 1.22 – Ensure IAM policies that allow full "*:*" administrative privileges are not created
# -------------------------------------------------------------------------------------------------------------------------------------------------------

  IAMFullAdminPolicyDetachEnabledRule: 
    Type: AWS::Events::Rule
    Properties: 
      Name: IAMFullAdminPolicyDetachEnabledRule
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



aws-remediate-pci-securityhub/cft/aws-security-hub-pci-remediations-template2.yml [2088:2138]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                      DocumentVersion='1', # default
                      Parameters={
                          'username': [ username ],
                          'findingid': [Id]
                      }
                  )
              except Exception as e:
                  print(e)
                  print("SSM automation execution error")
                  raise

  IAMUserPolicyDetachEnabledLambdaRole:
    Type: AWS::IAM::Role
    Properties:
      Policies:
      - PolicyName: IAMUserPolicyDetachEnabledLambdaPolicy
        PolicyDocument:
          Version: 2012-10-17
          Statement:
          - Effect: Allow
            Action:
            - cloudwatch:PutMetricData
            - iam:*
            Resource: '*'
          - Effect: Allow
            Action:
            - ssm:StartAutomationExecution
            - logs:CreateLogGroup
            - logs:CreateLogStream
            - logs:PutLogEvents
            - logs:DescribeLogGroups
            - iam:PassRole
            Resource: '*'
          - Effect: Allow
            Action:
            - cloudtrail:UpdateTrail
            - securityhub:UpdateFindings
            Resource: '*'
      AssumeRolePolicyDocument:
        Version: 2012-10-17
        Statement:
        - Effect: Allow
          Principal: { Service: lambda.amazonaws.com }
          Action:
          - sts:AssumeRole

# PCI.IAM.3
  IAMFullAdminPolicyDetachEnabledRule: 
    Type: AWS::Events::Rule
    Properties: 
      Name: IAMFullAdminPolicyDetachEnabledRule
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



