-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Azure.VM.PublicIPAttached (#3012)
* Added Azure.VM.PublicIPAttached * Update changelog * Update docs/en/rules/Azure.VM.PublicIPAttached.md Co-authored-by: Bernie White <[email protected]> * Update docs/en/rules/Azure.VM.PublicIPAttached.md Co-authored-by: Bernie White <[email protected]> * Update docs/en/rules/Azure.VM.PublicIPAttached.md Co-authored-by: Bernie White <[email protected]> * Update docs/en/rules/Azure.VM.PublicIPAttached.md Co-authored-by: Bernie White <[email protected]> * Update docs/en/rules/Azure.VM.PublicIPAttached.md Co-authored-by: Bernie White <[email protected]> --------- Co-authored-by: Bernie White <[email protected]>
- Loading branch information
1 parent
e4dedd8
commit fe84d55
Showing
5 changed files
with
142 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
--- | ||
severity: Critical | ||
pillar: Security | ||
category: SE:06 Network controls | ||
resource: Virtual Machine | ||
online version: https://azure.github.io/PSRule.Rules.Azure/en/rules/Azure.VM.PublicIPAttached/ | ||
--- | ||
|
||
# Public IPs attached | ||
|
||
## SYNOPSIS | ||
|
||
Avoid attaching public IPs directly to virtual machines. | ||
|
||
## DESCRIPTION | ||
|
||
Attaching a public IP address to a virtual machine network interface (NIC) exposes it directly to the Internet. | ||
This exposure can make the VM vulnerable to unauthorized inbound access and security compromise. | ||
Minimize the number of Internet ingress/ egress points to enhance security and reduces potential attack surfaces. | ||
|
||
For enhanced security, consider one or more of the following options: | ||
|
||
- **Secure remote access** — by RDP or SSH to virtual machines can be configured through Azure Bastion. | ||
- Azure Bastion provides a secure encrypted connection without exposing a public IP. | ||
- **Exposing web services** — by HTTP/S can be configured by App Gateway or Azure Front Door (AFD). | ||
- App Gateway and AFD provide a secure reverse proxy that supports web application firewall (WAF) filtering. | ||
- **Internet connectivity** — should be managed through a security hardened device such as Azure Firewall. | ||
- This option also allows additional controls to be applied for east/ west and north/ south traffic filtering. | ||
- Alternatively a Network Virtual Appliance (NVA) can used. | ||
|
||
## RECOMMENDATION | ||
|
||
Evaluate alternative methods for inbound access to virtual machines to enhance security and minimize risk. | ||
|
||
### Configure with Azure template | ||
|
||
To deploy VM network interfaces that pass this rule: | ||
|
||
- For each IP configuration specified in the `properties.ipConfigurations` property: | ||
- Ensure that the `properties.publicIPAddress.id` property does not reference a Public IP resource. | ||
|
||
For example: | ||
|
||
```json | ||
{ | ||
"type": "Microsoft.Network/networkInterfaces", | ||
"apiVersion": "2023-11-01", | ||
"name": "[parameters('nicName')]", | ||
"location": "[parameters('location')]", | ||
"properties": { | ||
"ipConfigurations": [ | ||
{ | ||
"name": "[parameters('ipConfig')]", | ||
"properties": { | ||
"privateIPAllocationMethod": "Dynamic", | ||
"subnet": { | ||
"id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('virtualNetworkName'), parameters('subnetName'))]" | ||
} | ||
} | ||
} | ||
] | ||
} | ||
} | ||
``` | ||
|
||
### Configure with Bicep | ||
|
||
To deploy VM network interfaces that pass this rule: | ||
|
||
- For each IP configuration specified in the `properties.ipConfigurations` property: | ||
- Ensure that the `properties.publicIPAddress.id` property does not reference a Public IP resource. | ||
|
||
For example: | ||
|
||
```bicep | ||
resource nic 'Microsoft.Network/networkInterfaces@2023-11-01' = { | ||
name: nicName | ||
location: location | ||
properties: { | ||
ipConfigurations: [ | ||
{ | ||
name: ipconfig | ||
properties: { | ||
privateIPAllocationMethod: 'Dynamic' | ||
subnet: { | ||
id: resourceId('Microsoft.Network/virtualNetworks/subnets', virtualNetworkName, subnetName) | ||
} | ||
} | ||
} | ||
] | ||
} | ||
} | ||
``` | ||
|
||
## LINKS | ||
|
||
- [SE:06 Network controls](https://learn.microsoft.com/azure/well-architected/security/networking) | ||
- [Plan for inbound and outbound internet connectivity](https://learn.microsoft.com/azure/cloud-adoption-framework/ready/azure-best-practices/plan-for-inbound-and-outbound-internet-connectivity) | ||
- [Dissociate public IP address from a VM](https://learn.microsoft.com/azure/virtual-network/ip-services/remove-public-ip-address-vm) | ||
- [Azure Bastion](https://learn.microsoft.com/azure/bastion/bastion-overview) | ||
- [Azure deployment reference](https://learn.microsoft.com/azure/templates/microsoft.network/networkinterfaces) |
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