OpenStack Security and SSH
This guide describes SSH key management, security groups, and VM access for OpenStack-based providers such as Chameleon Cloud and Jetstream.
Prerequisites
The OpenStack provider requires the OpenStack CLI to be installed and configured. The active cloud configuration should also include the SSH private key and default VM user when SSH access is required.
Example configuration:
Note: The exact image, username, credentials, and security-group requirements may differ between OpenStack deployments.
SSH Key Management
List Keys
List SSH keys available in the active provider:
Upload a Public Key
Upload an existing public SSH key:
If no path is supplied, the command resolves the key path in the following priority:
1. key_path defined in clouds.yaml for the active provider.
2. Local file ~/.ssh/id_ed25519.pub.
3. Local file ~/.ssh/id_rsa.pub.
4. Any single file matching ~/.ssh/*.pub. (If multiple files match, an error is raised and manual configuration in clouds.yaml is required).
A custom cloud key name can also be specified:
Note: If
--nameis omitted, the tool first checks forkey_nameinclouds.yaml. If still missing, the provider derives the key name from the public-key filename.
Delete a Key
Delete a key from the active provider:
Important: Deleting the cloud copy of a public key does not delete your local private key.
Security Groups
Security groups control network access to OpenStack VMs.
List Security Groups
Inspect a Security Group
Create a Security Group
Create a group for SSH access:
Add an SSH Rule
Allow inbound TCP port 22 from a trusted network:
cmx vm security-group rule add ssh-access \
--protocol tcp \
--port 22 \
--cidr 192.0.2.0/24 \
--direction ingress
Security Tip: Replace
192.0.2.0/24with the specific network that should be allowed to connect. Avoid using0.0.0.0/0for SSH unless public SSH access is intentionally required. Restricting the CIDR reduces unnecessary exposure of port 22.
List Rules
Associate the Group with a VM
Remove the Group from a VM
Remove a Rule
First, obtain the rule ID:
Then remove it:
Delete the Security Group
Note: Remove the group from all associated VMs before attempting to delete it if required by your OpenStack deployment.
Connecting to a VM
Once the VM has network connectivity, an appropriate security group, and the correct SSH key, inspect its connection information:
Start an interactive SSH session:
Generate SSH configuration information:
Run a command remotely:
The OpenStack implementation uses the configured key_path and user values when establishing SSH-based connections.
Recommended Workflow
A typical secure setup follows these steps:
- Create or select an SSH key pair locally.
- Upload only the public key to OpenStack.
- Create a dedicated security group.
- Allow SSH only from the required source CIDR.
- Associate the security group with the VM.
- Verify the VM connection information.
- Connect using
cmx vm sshor execute commands withcmx vm run.
Example execution:
# Upload public key
cmx key upload ~/.ssh/id_rsa.pub --name research-key
# Create security group
cmx vm security-group create research-ssh \
--description "SSH access for research VM"
# Add inbound SSH rule for trusted CIDR
cmx vm security-group rule add research-ssh \
--protocol tcp \
--port 22 \
--cidr 192.0.2.0/24 \
--direction ingress
# Attach security group to instance
cmx vm security-group add research-vm research-ssh
# Inspect login info and connect
cmx vm login research-vm
cmx vm ssh research-vm
Provider Support
The commands in this guide describe functionality implemented by the OpenStack provider. Chameleon Cloud and Jetstream use the OpenStack provider path, but authentication, images, network configuration, quotas, and site-specific policies may differ.
Other providers may implement only a subset of these operations. For example, a provider may support listing security groups without supporting creation or rule management. Unsupported operations should be handled through the provider feature interface rather than assumed to be available on every cloud.