# hkb-baseline-account-settings

Execution role of the hkb-baseline-account-settings function. Sets EBS default encryption, the IAM password policy, two Systems Manager settings and VPC Block Public Access, nothing else.

- **Lives in:** [Log Archive](/architecture/log-archive/), [Security](/architecture/security/), [Shared Services](/architecture/shared-services/), [Prod](/architecture/prod/), [Dev](/architecture/dev/), [Sandbox](/architecture/sandbox/). **Trusted by:** `lambda.amazonaws.com`.
- **Boundary:** `hkb-pipeline-boundary`.
- **Reach:** 10 named actions across 4 services (ec2, iam, logs, ssm); 3 statements on all resources.
- **Source:** `baseline/hkb-baseline-account.yaml`, resource `SettingsRole`.

## Trust policy

```yaml
AssumeRolePolicyDocument:
  Version: "2012-10-17"
  Statement:
    - Effect: Allow
      Principal:
        Service: lambda.amazonaws.com
      Action: sts:AssumeRole
      Condition:
        StringEquals:
          aws:SourceAccount: !Ref AWS::AccountId
```

## Permissions

```yaml
Policies:
  - PolicyName: hkb-baseline-account-settings
    PolicyDocument:
      Version: "2012-10-17"
      Statement:
        - Sid: EbsDefaultEncryption
          Effect: Allow
          Action:
            - ec2:EnableEbsEncryptionByDefault
            - ec2:GetEbsEncryptionByDefault
          Resource: "*"
        - Sid: VpcBlockPublicAccess
          Effect: Allow
          Action:
            - ec2:DescribeVpcs
            - ec2:ModifyVpcBlockPublicAccessOptions
          Resource: "*"
        - Sid: PasswordPolicy
          Effect: Allow
          Action:
            - iam:UpdateAccountPasswordPolicy
            - iam:GetAccountPasswordPolicy
          Resource: "*"
        - Sid: SsmServiceSettings
          Effect: Allow
          Action:
            - ssm:UpdateServiceSetting
            - ssm:GetServiceSetting
          Resource:
            - !Sub arn:${AWS::Partition}:ssm:*:${AWS::AccountId}:servicesetting/ssm/documents/console/public-sharing-permission
            - !Sub arn:${AWS::Partition}:ssm:*:${AWS::AccountId}:servicesetting/ssm/automation/customer-script-log-destination
        - Sid: OwnLogs
          Effect: Allow
          Action:
            - logs:CreateLogStream
            - logs:PutLogEvents
          Resource: !GetAtt SettingsLogGroup.Arn
```
