-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
73561da
commit d6b4b83
Showing
4 changed files
with
81 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import boto3 | ||
import botocore | ||
|
||
from services.Evaluator import Evaluator | ||
|
||
class Ec2NACL(Evaluator): | ||
def __init__(self, nacl, ec2Client): | ||
super().__init__() | ||
self.nacl = nacl | ||
self.ec2Client = ec2Client | ||
self.init() | ||
return | ||
|
||
def _checkNACLAssociation(self): | ||
if not self.nacl['Associations']: | ||
self.results['NACLAssociated'] = [-1, self.nacl['NetworkAclId']] | ||
|
||
return | ||
|
||
def _checkNACLIngressSensitivePort(self): | ||
sensitivePort = [22, 3389] | ||
for entry in self.nacl['Entries']: | ||
if entry['RuleAction'] == 'allow' and entry['Egress'] == False: | ||
if ('CidrBlock' in entry and entry['CidrBlock'] == '0.0.0.0/0') or ('Ipv6CidrBlock' in entry and entry['Ipv6CidrBlock'] == '::/0'): | ||
if 'PortRange' in entry: | ||
portFrom = entry['PortRange']['From'] | ||
portTo = entry['PortRange']['To'] | ||
for port in sensitivePort: | ||
if portFrom <= port and portTo >= port: | ||
self.results['NACLSensitivePort'] = [-1, self.nacl['NetworkAclId']] | ||
return | ||
|
||
return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters