Skip to content

Commit

Permalink
aws/cert-manager: Tighten IAM permissions for cert-manager
Browse files Browse the repository at this point in the history
This change restricts which record types and domain prefixes
cert-manager is allowed to change for DNS01 acme challenges.

Only _acme-challenge.* TXT records may be created/updated/removed.

Implements #15680
  • Loading branch information
andsens committed Mar 19, 2024
1 parent db26ad5 commit a902f9e
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions pkg/model/components/addonmanifests/certmanager/iam.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,23 @@ func addCertManagerPermissions(b *iam.PolicyBuilder, p *iam.Policy) {
}

p.Statement = append(p.Statement, &iam.Statement{
Effect: iam.StatementEffectAllow,
Action: stringorset.Of("route53:ChangeResourceRecordSets",
"route53:ListResourceRecordSets",
),
Effect: iam.StatementEffectAllow,
Action: stringorset.Of("route53:ListResourceRecordSets"),
Resource: stringorset.Set(zoneResources),
})

p.Statement = append(p.Statement, &iam.Statement{
Effect: iam.StatementEffectAllow,
Action: stringorset.Of("route53:ChangeResourceRecordSets"),
Resource: stringorset.Set(zoneResources),
Condition: iam.Condition{
"ForAllValues:StringLike": map[string]interface{}{
"route53:ChangeResourceRecordSetsNormalizedRecordNames": []string{"_acme-challenge.*"},
},
"ForAllValues:StringEquals": map[string]interface{}{
"route53:ChangeResourceRecordSetsRecordTypes": []string{"TXT"},
},
},
})

p.Statement = append(p.Statement, &iam.Statement{
Expand Down

0 comments on commit a902f9e

Please sign in to comment.