-
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.
Updates to WAF documentation (#3194)
- Loading branch information
1 parent
6600b30
commit 096105e
Showing
11 changed files
with
449 additions
and
154 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,147 @@ | ||
--- | ||
severity: Important | ||
pillar: Security | ||
category: Identity and access management | ||
category: SE:08 Hardening resources | ||
resource: Virtual Machine | ||
online version: https://azure.github.io/PSRule.Rules.Azure/en/rules/Azure.VM.PublicKey/ | ||
--- | ||
|
||
# Use public keys for Linux | ||
# VM password-based authentication is enabled | ||
|
||
## SYNOPSIS | ||
|
||
Linux virtual machines should use public keys. | ||
|
||
## DESCRIPTION | ||
|
||
Linux virtual machines support either password or public key based authentication for the default administrator account. | ||
Linux virtual machines should have password authentication disabled to help with eliminating password-based attacks. | ||
|
||
## RECOMMENDATION | ||
|
||
Consider using public key based authentication instead of passwords. | ||
Consider disabling password-based authentication on Linux virtual machines and instead use public keys. | ||
|
||
## EXAMPLES | ||
|
||
### Configure with Azure template | ||
|
||
To deploy virtual machines that pass this rule: | ||
|
||
- Set the `properties.osProfile.linuxConfiguration.disablePasswordAuthentication` property to `true`. | ||
|
||
For example: | ||
|
||
```json | ||
{ | ||
"type": "Microsoft.Compute/virtualMachines", | ||
"apiVersion": "2024-03-01", | ||
"name": "[parameters('name')]", | ||
"location": "[parameters('location')]", | ||
"identity": { | ||
"type": "SystemAssigned" | ||
}, | ||
"properties": { | ||
"hardwareProfile": { | ||
"vmSize": "Standard_D8d_v5" | ||
}, | ||
"osProfile": { | ||
"computerName": "[parameters('name')]", | ||
"adminUsername": "[parameters('adminUsername')]", | ||
"linuxConfiguration": { | ||
"disablePasswordAuthentication": true | ||
} | ||
}, | ||
"storageProfile": { | ||
"imageReference": { | ||
"publisher": "MicrosoftCblMariner", | ||
"offer": "Cbl-Mariner", | ||
"sku": "cbl-mariner-2-gen2", | ||
"version": "latest" | ||
}, | ||
"osDisk": { | ||
"name": "[format('{0}-disk0', parameters('name'))]", | ||
"caching": "ReadWrite", | ||
"createOption": "FromImage", | ||
"managedDisk": { | ||
"storageAccountType": "Premium_LRS" | ||
} | ||
} | ||
}, | ||
"networkProfile": { | ||
"networkInterfaces": [ | ||
{ | ||
"id": "[resourceId('Microsoft.Network/networkInterfaces', parameters('nicName'))]" | ||
} | ||
] | ||
} | ||
}, | ||
"zones": [ | ||
"1" | ||
], | ||
"dependsOn": [ | ||
"[resourceId('Microsoft.Network/networkInterfaces', parameters('nicName'))]" | ||
] | ||
} | ||
``` | ||
|
||
### Configure with Bicep | ||
|
||
To deploy virtual machines that pass this rule: | ||
|
||
- Set the `properties.osProfile.linuxConfiguration.disablePasswordAuthentication` property to `true`. | ||
|
||
For example: | ||
|
||
```bicep | ||
resource linux 'Microsoft.Compute/virtualMachines@2024-03-01' = { | ||
name: name | ||
location: location | ||
identity: { | ||
type: 'SystemAssigned' | ||
} | ||
properties: { | ||
hardwareProfile: { | ||
vmSize: 'Standard_D8d_v5' | ||
} | ||
osProfile: { | ||
computerName: name | ||
adminUsername: adminUsername | ||
linuxConfiguration: { | ||
disablePasswordAuthentication: true | ||
} | ||
} | ||
storageProfile: { | ||
imageReference: { | ||
publisher: 'MicrosoftCblMariner' | ||
offer: 'Cbl-Mariner' | ||
sku: 'cbl-mariner-2-gen2' | ||
version: 'latest' | ||
} | ||
osDisk: { | ||
name: '${name}-disk0' | ||
caching: 'ReadWrite' | ||
createOption: 'FromImage' | ||
managedDisk: { | ||
storageAccountType: 'Premium_LRS' | ||
} | ||
} | ||
} | ||
networkProfile: { | ||
networkInterfaces: [ | ||
{ | ||
id: nic.id | ||
} | ||
] | ||
} | ||
} | ||
zones: [ | ||
'1' | ||
] | ||
} | ||
``` | ||
|
||
## LINKS | ||
|
||
- [SE:08 Hardening resources](https://learn.microsoft.com/azure/well-architected/security/harden-resources) | ||
- [Azure security baseline for Linux Virtual Machines](https://learn.microsoft.com/security/benchmark/azure/baselines/virtual-machines-linux-security-baseline) | ||
- [Detailed steps: Create and manage SSH keys for authentication to a Linux VM in Azure](https://learn.microsoft.com/azure/virtual-machines/linux/create-ssh-keys-detailed) | ||
- [Azure deployment reference](https://learn.microsoft.com/azure/templates/microsoft.compute/virtualmachines) |
Oops, something went wrong.