Skip to content
This repository has been archived by the owner on Sep 17, 2021. It is now read-only.

Commit

Permalink
Fixing issue #40 SG Name Collisions
Browse files Browse the repository at this point in the history
Security Monkey was unaware that security group names in different VPC's
could collide.  Security group names in EC2 may also collide with a VPC
security group name.  The fix is to include the security group ID and
optionally the VPC ID to the name stored by security_monkey.
  • Loading branch information
Patrick Kelley committed Aug 11, 2014
1 parent 13bf64a commit 16081d4
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions security_monkey/watchers/security_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,14 @@ def slurp(self):
item_config['rules'].append(rule_config)
item_config['rules'] = sorted(item_config['rules'])

item = SecurityGroupItem(region=region.name, account=account, name=sg.name, config=item_config)
# Issue 40: Security Groups can have a name collision between EC2 and
# VPC or between different VPCs within a given region.
if sg.vpc_id:
sg_name = "{0} ({1} in {2})".format(sg.name, sg.id, sg.vpc_id)
else:
sg_name = "{0} ({1})".format(sg.name, sg.id)

item = SecurityGroupItem(region=region.name, account=account, name=sg_name, config=item_config)
item_list.append(item)

return item_list, exception_map
Expand All @@ -119,4 +126,4 @@ def __init__(self, region=None, account=None, name=None, config={}):
region=region,
account=account,
name=name,
new_config=config)
new_config=config)

0 comments on commit 16081d4

Please sign in to comment.