Skip to content

Commit bf846a2

Browse files
committed
Deny whole vnet rather than only subnet
1 parent 648eaf2 commit bf846a2

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

infra/aks-post-deployment/components/network_security_rules.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@ def __init__(
2929
child_opts = ResourceOptions.merge(opts, ResourceOptions(parent=self))
3030

3131
access_nodes_subnet_cidr = args.stack_outputs.access_nodes_subnet_cidr
32+
access_vnet_cidr = args.stack_outputs.access_vnet_cidr
3233
isolated_nodes_subnet_cidr = args.stack_outputs.isolated_nodes_subnet_cidr
3334
isolated_cluster_k8s_api_ip = args.stack_outputs.isolated_cluster_api_server_ip
35+
isolated_vnet_cidr = args.stack_outputs.isolated_vnet_cidr
3436
fridge_api_ip = args.stack_outputs.fridge_api_ip
3537

3638
access_cluster_nsg_rules = [
@@ -85,14 +87,14 @@ def __init__(
8587
description="Allow Harbor access from Isolated cluster",
8688
),
8789
network.SecurityRuleArgs(
88-
name="DenyIsolatedClusterInBound",
90+
name="DenyIsolatedClusterInbound",
8991
priority=1000,
9092
direction=network.SecurityRuleDirection.INBOUND,
9193
access=network.SecurityRuleAccess.DENY,
9294
protocol=network.SecurityRuleProtocol.ASTERISK,
9395
source_port_range="*",
9496
destination_port_range="*",
95-
source_address_prefix=isolated_nodes_subnet_cidr,
97+
source_address_prefix=isolated_vnet_cidr,
9698
destination_address_prefix="*",
9799
description="Deny all other inbound from Isolated cluster",
98100
),
@@ -137,7 +139,7 @@ def __init__(
137139
source_port_range="*",
138140
destination_port_range="*",
139141
source_address_prefix="*",
140-
destination_address_prefix=isolated_nodes_subnet_cidr,
142+
destination_address_prefix=isolated_vnet_cidr,
141143
description="Deny all other outbound to Isolated cluster",
142144
),
143145
]
@@ -175,7 +177,7 @@ def __init__(
175177
protocol=network.SecurityRuleProtocol.ASTERISK,
176178
source_port_range="*",
177179
destination_port_range="*",
178-
source_address_prefix=args.stack_outputs.access_nodes_subnet_cidr,
180+
source_address_prefix=access_vnet_cidr,
179181
destination_address_prefix="*",
180182
description="Deny all other traffic from access cluster VNet",
181183
),
@@ -215,7 +217,7 @@ def __init__(
215217
source_port_range="*",
216218
destination_port_range="*",
217219
source_address_prefix="*",
218-
destination_address_prefix=access_nodes_subnet_cidr,
220+
destination_address_prefix=access_vnet_cidr,
219221
description="Deny all other outbound to access cluster",
220222
),
221223
network.SecurityRuleArgs(

0 commit comments

Comments
 (0)