- Newest
- Most votes
- Most comments
Try WAF with tags
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Deny",
"Action": [
"wafv2:DeleteRuleGroup",
"wafv2:DeleteWebACL"
],
"Resource": "*",
"Condition": {
"StringEquals": {
"aws:RequestTag/Protected": "True"
}
}
},
{
"Effect": "Allow",
"Action": [
"wafv2:DeleteRuleGroup",
"wafv2:DeleteWebACL"
],
"Resource": "*",
"Condition": {
"StringNotEqualsIfExists": {
"aws:RequestTag/Protected": "True"
}
}
}
]
}
I don't think you can accomplish that with an IAM policy. I believe the OnlyProxy rule could be removed, its matching criteria changed, or priority modified to move it where another rule would get evaluated before it with the UpdateRuleGroup API call, for which permissions would be checked against those specified for wafv2:UpdateRuleGroup: https://docs.aws.amazon.com/service-authorization/latest/reference/list_awswafv2.html
The permissions IAM evaluates for wafv2:UpdateRuleGroup only cover "rulegroup", "ipset", and "regexpatternset" types of resources and resource tags associated with those resource types. The individual rules and their attributes are specified as an array type of parameter to the UpdateRuleGroup API, and the contents of that array aren't validated against IAM policies, including SCPs, except for the "ipset" or "regexpatternset" types of resources used in the rules.
If you're using AWS Config, you could consider building a custom Config rule that would detect unauthorised changes and alert you or trigger automatic remediation.
Relevant content
- asked 5 years ago
- asked 3 years ago
- asked 3 years ago
- AWS OFFICIALUpdated 9 months ago
- AWS OFFICIALUpdated 4 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated a year ago
The answer isn't clear enough, If I prevent someone from deleting a Rule Group this doesn't mean that they can't modify or remove a custom rule inside the WebACL