Linux VM Without SSH Key misconfiguration detected in code
Linux VM Without SSH Key misconfiguration detected in code
Rule Details
Cortex AppSec Rule ID
APPSEC_AZURE_178
Category - Subcategory
Public Exposure - Encryption And Protocols
Provider
AZURE
Severity
HIGH
Framework
ARM, Bicep, Terraform, Terraform Plan
Impact
SSH (Secure Shell) provides encrypted communication sessions for Linux VMs in a potentially insecure network. Utilizing SSH keys rather than passwords enhances the security even further. SSH keys are more secure and complex than passwords and are more challenging for attackers to compromise.
This rule checks to ensure that Linux VMs and Linux VM Scale Sets in Azure are configured to use SSH keys for authentication.
How to Fix
Resources:
azurerm_linux_virtual_machine
azurerm_linux_virtual_machine_scale_set
Argument:
admin_ssh_key
Note: It's recommended to enable SSH with keys on all Linux VM and VM Scale Set instances in Azure to ensure secure communication and authentication. [source,go]
resource "azurerm_linux_virtual_machine" "example" { name = "example-linux-vm" location = azurerm_resource_group.example.location resource_group_name = azurerm_resource_group.example.name
... other configurations ...
admin_ssh_key {
username = "adminuser"
public_key = file("~/.ssh/id_rsa.pub") } }
resource "azurerm_linux_virtual_machine_scale_set" "example" { name = "example-linux-vmss" location = azurerm_resource_group.example.location resource_group_name = azurerm_resource_group.example.name
... other configurations ...
admin_ssh_key {
username = "adminuser"
public_key = file("~/.ssh/id_rsa.pub") } }
Last updated
Was this helpful?
