Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add wafv2 permissions #136

Merged
merged 20 commits into from
Mar 17, 2021
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
34 changes: 34 additions & 0 deletions aws/policy/security-services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,40 @@ Statement:
Resource:
- 'arn:aws:iam::{{ aws_account_id }}:role/ansible_lambda_role'

- Sid: AllowRegionalRestrictedResourceActionsWhichIncurFees
Effect: Allow
Action:
- wafv2:ListRuleGroups
- wafv2:ListWebACLs
- wafv2:AssociateWebACL
- wafv2:DeleteRuleGroup
- wafv2:CreateRuleGroup
- wafv2:PutFirewallManagerRuleGroups
- wafv2:GetWebACLForResource
- wafv2:GetLoggingConfiguration
- wafv2:DeleteWebACL
- wafv2:GetRateBasedStatementManagedKeys
- wafv2:ListLoggingConfigurations
- wafv2:GetIPSet
- wafv2:CreateWebACL
- wafv2:ListIPSets
- wafv2:GetWebACL
- wafv2:GetRuleGroup
- wafv2:CreateIPSet
- wafv2:ListAvailableManagedRuleGroups
- wafv2:DeleteIPSet
- wafv2:DescribeManagedRuleGroup
- wafv2:CheckCapacity
- wafv2:ListResourcesForWebACL
- wafv2:DeleteLoggingConfiguration
- wafv2:PutLoggingConfiguration
- wafv2:DisassociateWebACL
- wafv2:UpdateWebACL
- wafv2:UpdateRuleGroup
- wafv2:DeleteFirewallManagerRuleGroups
- wafv2:DisassociateFirewallManager
- wafv2:UpdateIPSet
markuman marked this conversation as resolved.
Show resolved Hide resolved

- Sid: AllowRegionalUnrestrictedResourceActionsWhichIncurNoFees
Effect: Allow
Action:
Expand Down
21 changes: 21 additions & 0 deletions aws/terminator/security_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,27 @@ def terminate(self):
self.client.delete_regex_pattern_set(RegexPatternSetId=self.id, ChangeToken=self.change_token)


class WafV2IpSetRegionl(Terminator):
markuman marked this conversation as resolved.
Show resolved Hide resolved
@staticmethod
def create(credentials):
return Terminator._create(credentials, WafV2IpSetRegionl, 'wafv2', lambda client: client.list_ip_sets(Scope='REGIONAL')['IPSets'])
markuman marked this conversation as resolved.
Show resolved Hide resolved

@property
def id(self):
return self.instance['Id']

@property
def name(self):
return self.instance['Name']

@property
def lock_token(self):
return self.instance['LockToken']

def terminate(self):
self.client.delete_ip_set(Id=self.id, Name=self.name, LockToken=self.lock_token, Scope='REGIONAL')


class InspectorAssessmentTemplate(DbTerminator):
@staticmethod
def create(credentials):
Expand Down