Info icon
End of Life Notice: For Trend Cloud One™ - Conformity Customers, Conformity will reach its End of Sale on “July 31st, 2025” and End of Life “July 31st, 2026”. The same capabilities and much more is available in TrendAI Vision One™ Cloud Risk Management. For details, please refer to Upgrade to TrendAI Vision One™

Ensure Virtual Machine Uses SSH Key Pair Authentication

TrendAI Vision One™ provides continuous assurance that gives peace of mind for your cloud infrastructure, delivering over 1400 automated best practice checks.

Risk Level: Medium (should be achieved)
Rule ID: OpenStack-Compute-001

Ensure that your OpenStack compute virtual machines are configured to use SSH key pair authentication for remote access. When a key pair is assigned at launch, the public key is injected into the instance, allowing only users who possess the corresponding private key to gain shell access.

Security

Using SSH key pairs to authenticate remote access to your OpenStack virtual machines represents a security best practice that significantly reduces the risk of unauthorized access. Without a key pair assigned, your instance may rely on image-defined default credentials or passwords retrievable from the console log, which are difficult to audit, hard to rotate, and shared across users. Unlike key-based authentication, password-based access cannot reliably attribute login activity to a specific individual, making it harder to detect and respond to unauthorized access attempts.


Audit

To determine if your OpenStack compute virtual machines are configured to use SSH key pair authentication, perform the following operations:

Using OpenStack Console

  1. Sign in to your OpenStack Console.

  2. Navigate to Project > Compute > Instances.

  3. Click on the name of the instance that you want to examine.

  4. Select the Overview tab and locate the Metadata section. Check the Key Name field. If the Key Name field shows None, the selected virtual machine is not configured to use SSH key pair authentication.

  5. Repeat steps no. 3 and 4 for each virtual machine deployed within the current OpenStack project.

Using OpenStack CLI

  1. Run server list command (Windows/macOS/Linux) with output format options to list the ID and name of each virtual machine available in the current OpenStack project:

    openstack server list \
      --format json \
      --column ID \
      --column Name
    
  2. The command output should return the requested virtual machine identifiers and names:

    [
      {
        "ID": "11111111-2222-3333-4444-555555555555",
        "Name": "example-vm-001"
      },
      {
        "ID": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
        "Name": "example-vm-002"
      }
    ]
    
  3. Run server show command (Windows/macOS/Linux) with the ID of the virtual machine that you want to examine as the identifier parameter, to describe the key pair configuration for the selected instance:

    openstack server show 11111111-2222-3333-4444-555555555555 \
      --format json \
      --column key_name
    
  4. The command output should return the requested key pair configuration:

    {
      "key_name": null
    }
    

    If the server show command output returns null or an empty value for key_name, as shown in the example above, the selected virtual machine is not configured to use SSH key pair authentication and is therefore not compliant.

  5. Repeat steps no. 3 and 4 for each virtual machine available within the current OpenStack project.

Remediation / Resolution

OpenStack does not support adding an SSH key pair to an existing running instance. To remediate this finding, you must create a new virtual machine with an SSH key pair assigned at launch. Perform the following operations:

Using OpenStack Console

  1. Sign in to your OpenStack Console.

  2. Navigate to Project > Compute > Key Pairs.

  3. If no suitable key pair exists, choose Create Key Pair or Import Public Key to add an SSH key pair to your project:

    • For Create Key Pair: provide a unique Key Pair Name, select SSH Key as the key type, and choose Create Key Pair. Download and securely store the generated private key file (.pem).
    • For Import Public Key: provide a unique Key Pair Name, select SSH Key as the key type, paste your existing public key in the Public Key field, and choose Import Key Pair.
  4. Navigate to Project > Compute > Instances and choose Launch Instance to create a new virtual machine with the following configuration:

    1. For Details, provide an instance name and select the target availability zone.
    2. For Source, select the same image used by the non-compliant instance.
    3. For Flavor, select the same flavor used by the non-compliant instance.
    4. For Networks, configure the same network settings used by the non-compliant instance.
    5. For Security Groups, apply the same security groups used by the non-compliant instance.
    6. For Key Pair, select the key pair created or imported in step no. 3.
    7. Choose Launch Instance to create the new virtual machine.
  5. After verifying the new instance is running correctly, terminate the non-compliant instance by selecting it on the Instances page, choosing Actions, and selecting Delete Instance.

Using OpenStack CLI

  1. Run keypair list command (Windows/macOS/Linux) to list the SSH key pairs available in the current OpenStack project:

    openstack keypair list \
      --format json \
      --column Name \
      --column Type
    
  2. The command output should return the available key pairs:

    [
      {
        "Name": "my-ssh-keypair",
        "Type": "ssh"
      }
    ]
    

    If no suitable key pair exists, run the keypair create command to generate a new one and save the private key. On macOS/Linux, also restrict the file permissions so that ssh will accept the key:

    openstack keypair create my-ssh-keypair \
      --private-key my-ssh-keypair.pem
    chmod 600 my-ssh-keypair.pem
    

    On Windows, use icacls to restrict access to the private key file instead:

    openstack keypair create my-ssh-keypair \
      --private-key my-ssh-keypair.pem
    icacls my-ssh-keypair.pem /inheritance:r /grant:r "%USERNAME%:R"
    
  3. Run server show command (Windows/macOS/Linux) with the ID of the non-compliant instance to collect its current configuration details:

    openstack server show 11111111-2222-3333-4444-555555555555 \
      --format json
    
  4. The command output should return the instance configuration. Note the values for image, flavor, networks, and security_groups to use when creating the replacement instance.

  5. Run server create command (Windows/macOS/Linux) to launch a new virtual machine using the same configuration as the non-compliant instance but with a key pair assigned:

    openstack server create \
      --image aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee \
      --flavor cirros256 \
      --network example-network \
      --security-group custom-security-group \
      --key-name my-ssh-keypair \
      --format json \
      example-vm-001-remediated
    
  6. The command output should return the new instance configuration. Verify that the key_name field shows the assigned key pair name and that the status field shows BUILD (the instance is being provisioned).

  7. After verifying that the new instance is running and accessible using the SSH key pair, run server delete command to terminate the non-compliant instance:

    openstack server delete 11111111-2222-3333-4444-555555555555
    
  8. Repeat steps no. 3 – 7 for each non-compliant virtual machine available within the current OpenStack project.

References

Publication date Aug 10, 2026