@@ -88,7 +88,7 @@ def validation_profile(profile_name):
88
88
'''
89
89
verify profile name doesn't have path to files or unexpected input
90
90
'''
91
- if re .match (r"^[a-zA-Z0-9 ]*$" , profile_name ):
91
+ if re .match (r"^[a-zA-Z0-9_- ]*$" , profile_name ):
92
92
return profile_name
93
93
raise argparse .ArgumentTypeError ("%s is an invalid profile name value" % profile_name )
94
94
@@ -580,13 +580,13 @@ def check_egress_acls(acls, dst_port):
580
580
'''
581
581
for acl in acls :
582
582
# check ipv4 acl rule only
583
- if acl .get ('CidrBlock' ):
583
+ if acl .get ('CidrBlock' ) and acl . get ( 'Protocol' ) != '1' :
584
584
# Check Port
585
585
if ((acl .get ('Protocol' ) == '-1' ) or
586
586
(dst_port in range (acl ['PortRange' ]['From' ], acl ['PortRange' ]['To' ] + 1 ))):
587
587
# Check Action
588
588
return acl ['RuleAction' ] == 'allow'
589
- return ""
589
+ return False
590
590
591
591
592
592
def check_ingress_acls (acls , src_port_from , src_port_to ):
@@ -595,15 +595,15 @@ def check_ingress_acls(acls, src_port_from, src_port_to):
595
595
'''
596
596
for acl in acls :
597
597
# check ipv4 acl rule only
598
- if acl .get ('CidrBlock' ):
598
+ if acl .get ('CidrBlock' ) and acl . get ( 'Protocol' ) != '1' :
599
599
# Check Port
600
- test_range = range (src_port_from , src_port_to )
600
+ test_range = range (src_port_from , src_port_to + 1 )
601
601
set_test_range = set (test_range )
602
602
if ((acl .get ('Protocol' ) == '-1' ) or
603
603
set_test_range .issubset (range (acl ['PortRange' ]['From' ], acl ['PortRange' ]['To' ] + 1 ))):
604
604
# Check Action
605
605
return acl ['RuleAction' ] == 'allow'
606
- return ""
606
+ return False
607
607
608
608
609
609
def check_nacl (input_subnets , input_subnet_ids , ec2_client ):
0 commit comments