Skip to content
This repository has been archived by the owner on Dec 4, 2018. It is now read-only.

Commit

Permalink
1. Merge attack surface summaries for all DB services
Browse files Browse the repository at this point in the history
2. Create base for elasticache attack surface
3. Fix ALB summary
  • Loading branch information
l01cd3v committed Nov 17, 2017
1 parent 15cb7eb commit f9431e1
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
12 changes: 11 additions & 1 deletion AWSScout2/configs/data/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,15 @@
}
},
"database": {
"summaries": {
"external attack surface": {
"cols": 1,
"path": "service_groups.database.summaries.external_attack_surface",
"callbacks": [
[ "merge", {"attribute": "external_attack_surface"} ]
]
}
},
"elasticache": {
"resources": {
"clusters": {
Expand All @@ -361,7 +370,8 @@
"cols": 2,
"path": "services.elasticache.regions.id.vpcs.id.clusters",
"callbacks": [
[ "match_security_groups_and_resources_callback", {"status_path": ["CacheClusterStatus"], "sg_list_attribute_name": ["SecurityGroups"], "sg_id_attribute_name": "SecurityGroupId"} ]
[ "match_security_groups_and_resources_callback", {"status_path": ["CacheClusterStatus"], "sg_list_attribute_name": ["SecurityGroups"], "sg_id_attribute_name": "SecurityGroupId"} ],
[ "get_db_attack_surface", {} ]
]
},
"parameter_groups": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

<!-- Template for network attack surface -->
<script id="service_groups.database.summaries.external_attack_surface.details.template" type="text/x-handlebars-template">
{{> attack_surface service = 'Database'}}
</script>

11 changes: 8 additions & 3 deletions AWSScout2/rules/preprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ def process_metadata_callbacks(aws_config):
if 'summaries' in aws_config['metadata'][service_group]:
for summary in aws_config['metadata'][service_group]['summaries']:
current_path = [ 'services', service ]
print('Summary :: %s' % summary)
for callback in aws_config['metadata'][service_group]['summaries'][summary]['callbacks']:
callback_name = callback[0]
callback_args = copy.deepcopy(callback[1])
Expand Down Expand Up @@ -673,6 +672,12 @@ def get_db_attack_surface(aws_config, current_config, path, current_path, db_id,
listeners = [ current_config['Endpoint']['Port'] ]
security_groups = current_config['VpcSecurityGroups']
security_group_to_attack_surface(aws_config, service_config['external_attack_surface'], public_dns, current_path, [g['VpcSecurityGroupId'] for g in security_groups], listeners)
elif 'ConfigurationEndpoint' in current_config:
public_dns = current_config['ConfigurationEndpoint']['Address'].replace('.cfg', '') # TODO : get the proper addresss
listeners = [ current_config['ConfigurationEndpoint']['Port'] ]
security_groups = current_config['SecurityGroups']
security_group_to_attack_surface(aws_config, service_config['external_attack_surface'], public_dns, current_path, [g['SecurityGroupId'] for g in security_groups], listeners)
# TODO :: Get Redis endpoint information



Expand All @@ -691,11 +696,11 @@ def get_lb_attack_surface(aws_config, current_config, path, current_path, elb_id
elif current_path[1] == 'elbv2' and current_config['Scheme'] == 'internet-facing':
vpc_id = current_path[5]
elb_config['external_attack_surface'][public_dns] = {'protocols': {}}
security_groups = current_config['security_groups']
security_groups = [g['GroupId'] for g in current_config['security_groups']]
listeners = []
for listener in current_config['listeners']:
listeners.append(listener)
security_group_to_attack_surface(aws_config, elb_config['external_attack_surface'], public_dns, current_path, [g['GroupId'] for g in security_groups], 'GroupId', listeners)
security_group_to_attack_surface(aws_config, elb_config['external_attack_surface'], public_dns, current_path, security_groups, listeners)
elif current_config['Scheme'] == 'internet-facing':
# Classic ELbs do not have a security group, lookup listeners instead
public_dns = current_config['DNSName']
Expand Down

0 comments on commit f9431e1

Please sign in to comment.