Skip to content

Commit a06c95d

Browse files
committed
DMZ Tagging: Support multiple tags, move to panther_config
1 parent 2f53632 commit a06c95d

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

global_helpers/panther_base_helpers.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from functools import reduce
88
from ipaddress import ip_address, ip_network
99
from typing import Any, List, Optional, Sequence, Union
10+
from panther_config import config
1011

1112
# # # # # # # # # # # # # #
1213
# Exceptions #
@@ -59,16 +60,16 @@ def is_dmz_cidr(ip_range):
5960
return any(ip_network(ip_range).overlaps(dmz_network) for dmz_network in DMZ_NETWORKS)
6061

6162

62-
DMZ_TAG_KEY = "environment"
63-
DMZ_TAG_VALUE = "dmz"
64-
63+
DMZ_TAGS = config.DMZ_TAGS
6564

6665
# Defaults to False to assume something is not a DMZ if it is not tagged
6766
def is_dmz_tags(resource):
6867
"""This function determines whether a given resource is tagged as existing in a DMZ."""
6968
if resource["Tags"] is None:
7069
return False
71-
return resource["Tags"].get(DMZ_TAG_KEY) == DMZ_TAG_VALUE
70+
for key, value in DMZ_TAGS:
71+
if resource["Tags"].get(key) == value:
72+
return True
7273

7374

7475
# Function variables here so that implementation details of these functions can be changed without

global_helpers/panther_config_defaults.py

+5
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,8 @@
1313
MS_EXCHANGE_ALLOWED_FORWARDING_DESTINATION_DOMAINS = ORGANIZATION_DOMAINS
1414
MS_EXCHANGE_ALLOWED_FORWARDING_DESTINATION_EMAILS = ["postmaster@" + ORGANIZATION_DOMAINS[0]]
1515
TELEPORT_ORGANIZATION_DOMAINS = ORGANIZATION_DOMAINS
16+
17+
# Key/value pairs of tags used to denote resources that are intentionally exposed
18+
DMZ_TAGS = set(
19+
("environment", "dmz"),
20+
)

0 commit comments

Comments
 (0)