With NLBs the DNS formatting has changed, which resulted in Lemur not getting the region correctly parsed

This commit is contained in:
Hossein Shafagh 2019-09-23 12:36:08 -07:00
parent 4e7e81aee8
commit 86f661a8af
1 changed files with 5 additions and 1 deletions

View File

@ -40,7 +40,11 @@ from lemur.plugins.lemur_aws import iam, s3, elb, ec2
def get_region_from_dns(dns):
return dns.split(".")[-4]
# XXX.REGION.elb.amazonaws.com
if dns.endswith(".elb.amazonaws.com"):
return dns.split(".")[-4]
else: # NLBs have a different pattern on the dns XXXX.elb.REGION.amazonaws.com
return dns.split(".")[-3]
def format_elb_cipher_policy_v2(policy):