111 lines
2.6 KiB
Plaintext
Raw Normal View History

== Why is this an issue?
Cloud platforms such as Azure support virtual firewalls that can be used to restrict access to services by controlling inbound and outbound traffic. +
Any firewall rule allowing traffic from all IP addresses to standard network ports on which administration services traditionally listen, such as 22 for SSH, can expose these services to exploits and unauthorized access.
include::../impact.adoc[]
== How to fix it
include::../common/how-to-fix-it/intro.adoc[]
=== Code examples
==== Noncompliant code example
[source,json,diff-id=1,diff-type=noncompliant]
----
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"name": "networkSecurityGroups/example",
"type": "Microsoft.Network/networkSecurityGroups/securityRules",
"apiVersion": "2022-11-01",
"properties": {
"protocol": "*",
"destinationPortRange": "*",
"sourceAddressPrefix": "*",
"access": "Allow",
"direction": "Inbound"
}
}
]
}
----
[source,bicep,diff-id=2,diff-type=noncompliant]
----
resource securityRules 'Microsoft.Network/networkSecurityGroups/securityRules@2022-11-01' = {
name: 'securityRules'
properties: {
direction: 'Inbound'
access: 'Allow'
protocol: '*'
destinationPortRange: '*'
sourceAddressPrefix: '*'
}
}
----
==== Compliant solution
[source,json,diff-id=1,diff-type=compliant]
----
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"name": "networkSecurityGroups/example",
"type": "Microsoft.Network/networkSecurityGroups/securityRules",
"apiVersion": "2022-11-01",
"properties": {
"protocol": "*",
"destinationPortRange": "22",
"sourceAddressPrefix": "10.0.0.0/24",
"access": "Allow",
"direction": "Inbound"
}
}
]
}
----
[source,bicep,diff-id=2,diff-type=compliant]
----
resource securityRules 'Microsoft.Network/networkSecurityGroups/securityRules@2022-11-01' = {
name: 'securityRules'
properties: {
direction: 'Inbound'
access: 'Allow'
protocol: '*'
destinationPortRange: '22'
sourceAddressPrefix: '10.0.0.0/24'
}
}
----
== Resources
include::../common/resources/docs.adoc[]
include::../common/resources/articles.adoc[]
include::../common/resources/presentations.adoc[]
include::../common/resources/standards.adoc[]
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
'''
endif::env-github,rspecator-view[]