Merge pull request #2854 from hosseinsh/nlb-naming-bug

With NLBs the DNS formatting has changed, which resulted in Lemur not…
This commit is contained in:
Hossein Shafagh 2019-09-23 13:23:43 -07:00 committed by GitHub
commit 2239b68e0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -40,7 +40,12 @@ from lemur.plugins.lemur_aws import iam, s3, elb, ec2
def get_region_from_dns(dns): def get_region_from_dns(dns):
# XXX.REGION.elb.amazonaws.com
if dns.endswith(".elb.amazonaws.com"):
return dns.split(".")[-4] 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): def format_elb_cipher_policy_v2(policy):