-
Notifications
You must be signed in to change notification settings - Fork 910
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow setting no ranges in firewall module custom rules (#1073)
* allow setting no ranges in custom firewall rules * fix blueprint * fix example * fix example
- Loading branch information
Showing
18 changed files
with
301 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
default_rules_config = { | ||
admin_ranges = ["10.0.0.0/8"] | ||
https_ranges = [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Copyright 2022 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
values: | ||
google_compute_firewall.allow-admins[0]: | ||
source_ranges: | ||
- 10.0.0.0/8 | ||
google_compute_firewall.allow-tag-http[0]: | ||
allow: | ||
- ports: | ||
- "80" | ||
protocol: tcp | ||
source_ranges: | ||
- 130.211.0.0/22 | ||
- 209.85.152.0/22 | ||
- 209.85.204.0/22 | ||
- 35.191.0.0/16 | ||
google_compute_firewall.allow-tag-ssh[0]: | ||
allow: | ||
- ports: | ||
- "22" | ||
protocol: tcp | ||
source_ranges: | ||
- 35.235.240.0/20 | ||
|
||
counts: | ||
google_compute_firewall: 3 | ||
modules: 0 | ||
resources: 3 | ||
|
||
outputs: | ||
default_rules: __missing__ | ||
rules: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
project_id = "test-project" | ||
network = "test-network" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
default_rules_config = { | ||
disabled = true | ||
} | ||
egress_rules = { | ||
allow-egress-rfc1918 = { | ||
deny = false | ||
description = "Allow egress to RFC 1918 ranges." | ||
destination_ranges = [ | ||
"10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16" | ||
] | ||
} | ||
allow-egress-tag = { | ||
deny = false | ||
description = "Allow egress from a specific tag to 0/0." | ||
targets = ["target-tag"] | ||
} | ||
deny-egress-all = { | ||
description = "Block egress." | ||
} | ||
} | ||
ingress_rules = { | ||
allow-ingress-ntp = { | ||
description = "Allow NTP service based on tag." | ||
targets = ["ntp-svc"] | ||
rules = [{ protocol = "udp", ports = [123] }] | ||
} | ||
allow-ingress-tag = { | ||
description = "Allow ingress from a specific tag." | ||
source_ranges = [] | ||
sources = ["client-tag"] | ||
targets = ["target-tag"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
# Copyright 2022 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
values: | ||
google_compute_firewall.custom-rules["allow-egress-rfc1918"]: | ||
allow: | ||
- ports: [] | ||
protocol: all | ||
deny: [] | ||
description: Allow egress to RFC 1918 ranges. | ||
destination_ranges: | ||
- 10.0.0.0/8 | ||
- 172.16.0.0/12 | ||
- 192.168.0.0/16 | ||
direction: EGRESS | ||
google_compute_firewall.custom-rules["allow-egress-tag"]: | ||
allow: | ||
- ports: [] | ||
protocol: all | ||
deny: [] | ||
description: Allow egress from a specific tag to 0/0. | ||
destination_ranges: | ||
- 0.0.0.0/0 | ||
direction: EGRESS | ||
target_tags: | ||
- target-tag | ||
google_compute_firewall.custom-rules["allow-ingress-ntp"]: | ||
allow: | ||
- ports: | ||
- "123" | ||
protocol: udp | ||
deny: [] | ||
description: Allow NTP service based on tag. | ||
direction: INGRESS | ||
source_ranges: | ||
- 0.0.0.0/0 | ||
source_service_accounts: null | ||
source_tags: null | ||
target_tags: | ||
- ntp-svc | ||
google_compute_firewall.custom-rules["allow-ingress-tag"]: | ||
allow: | ||
- ports: [] | ||
protocol: all | ||
deny: [] | ||
description: Allow ingress from a specific tag. | ||
direction: INGRESS | ||
source_ranges: null | ||
source_tags: | ||
- client-tag | ||
target_tags: | ||
- target-tag | ||
google_compute_firewall.custom-rules["deny-egress-all"]: | ||
allow: [] | ||
deny: | ||
- ports: [] | ||
protocol: all | ||
description: Block egress. | ||
direction: EGRESS | ||
|
||
counts: | ||
google_compute_firewall: 5 | ||
modules: 0 | ||
resources: 5 | ||
|
||
outputs: | ||
default_rules: | ||
admin: [] | ||
http: [] | ||
https: [] | ||
ssh: [] | ||
rules: __missing__ |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
default_rules_config = { | ||
disabled = true | ||
} | ||
factories_config = { | ||
cidr_tpl_file = "../../tests/modules/net_vpc_firewall/data/cidr_template.yaml" | ||
rules_folder = "../../tests/modules/net_vpc_firewall/data/firewall" | ||
} |
Oops, something went wrong.