Control: Authentication to Linux machines should require SSH keys
Description
Although SSH itself provides an encrypted connection, using passwords with SSH still leaves the VM vulnerable to brute-force attacks. The most secure option for authenticating to an Azure Linux virtual machine over SSH is with a public-private key pair, also known as SSH keys.
Usage
Run the control in your terminal:
powerpipe control run azure_compliance.control.compute_vm_ssh_key_authentication_linuxSnapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run azure_compliance.control.compute_vm_ssh_key_authentication_linux --shareSQL
This control uses a named query:
with vm_ssh_key_auth as (  select    distinct a.vm_id  from    azure_compute_virtual_machine as a,    jsonb_array_elements(guest_configuration_assignments) as b  where    b -> 'guestConfiguration' ->> 'name'= 'LinuxNoPasswordForSSH'    and b ->> 'complianceStatus' = 'Compliant')select  a.vm_id as resource,  case    when a.os_type <> 'Linux' then 'skip'    when b.vm_id is not null then 'ok'    else 'alarm'  end as status,  case    when a.os_type <> 'Linux' then a.title || ' is of ' || a.os_type || ' operating system.'    when b.vm_id is not null then a.title || ' have SSH keys authentication.'    else a.title || ' does not have SSH keys authentication.'  end as reason    , a.resource_group as resource_group  , sub.display_name as subscriptionfrom  azure_compute_virtual_machine as a  left join vm_ssh_key_auth as b on a.vm_id = b.vm_id,  azure_subscription as subwhere  sub.subscription_id = a.subscription_id;