Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pulumi: Allow only specified user IP addresses #1572

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions data_safe_haven/pulumi/components/sre_networking.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def __init__(
shm_zone_name: Input[str],
sre_index: Input[int],
sre_name: Input[str],
user_public_ip_ranges: Input[list[str]],
) -> None:
# Virtual network and subnet IP ranges
subnet_ranges = Output.from_input(sre_index).apply(
Expand Down Expand Up @@ -58,7 +59,7 @@ def __init__(
# Other variables
self.firewall_ip_address = firewall_ip_address
self.location = location
self.public_ip_range_users = "Internet"
self.user_public_ip_ranges = user_public_ip_ranges
self.shm_fqdn = shm_fqdn
self.shm_networking_resource_group_name = shm_networking_resource_group_name
self.shm_subnet_identity_servers_prefix = shm_subnet_identity_servers_prefix
Expand Down Expand Up @@ -183,7 +184,7 @@ def __init__(
name="AllowUsersInternetInbound",
priority=NetworkingPriorities.AUTHORISED_EXTERNAL_USER_IPS,
protocol=network.SecurityRuleProtocol.TCP,
source_address_prefix=props.public_ip_range_users,
source_address_prefixes=props.user_public_ip_ranges,
source_port_range="*",
),
network.SecurityRuleArgs(
Expand Down
3 changes: 3 additions & 0 deletions data_safe_haven/pulumi/declarative_sre.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ def run(self) -> None:
shm_zone_name=self.cfg.shm.fqdn,
sre_index=self.cfg.sres[self.sre_name].index,
sre_name=self.sre_name,
user_public_ip_ranges=self.cfg.sres[
self.sre_name
].research_user_ip_addresses,
),
)

Expand Down