Skip to content

Commit 4916ff5

Browse files
committed
Various fixes for MWAA verify_env.py script
1 parent 3470f4c commit 4916ff5

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

MWAA/verify_env/verify_env.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def validation_profile(profile_name):
8888
'''
8989
verify profile name doesn't have path to files or unexpected input
9090
'''
91-
if re.match(r"^[a-zA-Z0-9]*$", profile_name):
91+
if re.match(r"^[a-zA-Z0-9_-]*$", profile_name):
9292
return profile_name
9393
raise argparse.ArgumentTypeError("%s is an invalid profile name value" % profile_name)
9494

@@ -580,13 +580,13 @@ def check_egress_acls(acls, dst_port):
580580
'''
581581
for acl in acls:
582582
# check ipv4 acl rule only
583-
if acl.get('CidrBlock'):
583+
if acl.get('CidrBlock') and acl.get('Protocol') != '1':
584584
# Check Port
585585
if ((acl.get('Protocol') == '-1') or
586586
(dst_port in range(acl['PortRange']['From'], acl['PortRange']['To'] + 1))):
587587
# Check Action
588588
return acl['RuleAction'] == 'allow'
589-
return ""
589+
return False
590590

591591

592592
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):
595595
'''
596596
for acl in acls:
597597
# check ipv4 acl rule only
598-
if acl.get('CidrBlock'):
598+
if acl.get('CidrBlock') and acl.get('Protocol') != '1':
599599
# Check Port
600-
test_range = range(src_port_from, src_port_to)
600+
test_range = range(src_port_from, src_port_to + 1)
601601
set_test_range = set(test_range)
602602
if ((acl.get('Protocol') == '-1') or
603603
set_test_range.issubset(range(acl['PortRange']['From'], acl['PortRange']['To'] + 1))):
604604
# Check Action
605605
return acl['RuleAction'] == 'allow'
606-
return ""
606+
return False
607607

608608

609609
def check_nacl(input_subnets, input_subnet_ids, ec2_client):

0 commit comments

Comments
 (0)