5.6. Managing SSH keys

5.6.1. vinfra cluster sshkey add

Add an SSH public key from a file:

usage: vinfra cluster sshkey add <file>
<file>
SSH public key file

Example:

# vinfra cluster sshkey add id_rsa.pub
+---------+--------------------------------------+
| Field   | Value                                |
+---------+--------------------------------------+
| task_id | 100a54ce-0bf5-4bc0-8e46-2e8b952343e6 |
+---------+--------------------------------------+

This command creates a task to add a public SSH key from the file mykey.pub to the list of trusted keys.

Task outcome:

# vinfra task show 100a54ce-0bf5-4bc0-8e46-2e8b952343e6
+---------+--------------------------------------------------------------------------------------+
| Field   | Value                                                                                |
+---------+--------------------------------------------------------------------------------------+
| args    | - admin                                                                              |
|         | - 1                                                                                  |
| kwargs  | key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCueWO956J/u5kjWnia7zePChoTMVBtsh1TDNgOskM |
|         | shfHWUzzfydi3/4sTrJ++6dtIoS1D3VVHvHBvp456PT5e/eVy7u0SipOPPoDY2vS2IEY+zjT6MYABi6oEYom |
|         | Dbi7CsRL02HcTWzAkooZNlimWPggYaMT10BZOKAvNB+Ctpkw8JaT5PRve8UVfjxIQIzL6pQOf0CDeCHgDsvw |
|         | xK7SrqOvBzTlF9mWkGdTGy+R0JrgGk+v9PvDXZwyeK+qS54uaGmpB6ZRkKMroIk3h+nZ4y/1eQ6m1C8Aspa0 |
|         | nnaMaNKOtwOibrd3MDroMcqkJWTTH/cukD3sB+MjL6nmFlrrAfRU6PBkwysIio6/XHS9jG+TI7NeRApkHnwi |
|         | vwIWEKSg6pqaiLUsMi/46KCHzde2OzgO8Hd0R5d7hNN/80mhD7b+bY9wig+VTMoQFQYSWrIy/qLL95ws4amg |
|         | nXOIksNFjfFEE/+lMcZXt3j5kqnjW7OT2/xkqqWoumaM+FEPLNijL18yb29/XJr/cQZX5R9iXSk33DVjhln/ |
|         | HG7xpHqAtrXbvKY8zI8t23otGT/rSvWRWV/wgPBZVWSWtsE99FEMmwmxk/b3KuPhi0jK0IUKcv5UBL+NLHw4 |
|         | rZRiYgw/fWXPO3f6ZSLLJXtW4iW+BQL60qQWUNQ==                                            |
|         |   user@example.com                                                                   |
| name    | backend.presentation.nodes.ssh.tasks.CreateSshKeyTask                                |
| result  | id: 6a2fb834-4bc6-4597-ae74-7cacf96b7c75                                             |
|         | key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCueWO956J/u5kjWnia7zePChoTMVBtsh1TDNgOskM |
|         | shfHWUzzfydi3/4sTrJ++6dtIoS1D3VVHvHBvp456PT5e/eVy7u0SipOPPoDY2vS2IEY+zjT6MYABi6oEYom |
|         | Dbi7CsRL02HcTWzAkooZNlimWPggYaMT10BZOKAvNB+Ctpkw8JaT5PRve8UVfjxIQIzL6pQOf0CDeCHgDsvw |
|         | xK7SrqOvBzTlF9mWkGdTGy+R0JrgGk+v9PvDXZwyeK+qS54uaGmpB6ZRkKMroIk3h+nZ4y/1eQ6m1C8Aspa0 |
|         | nnaMaNKOtwOibrd3MDroMcqkJWTTH/cukD3sB+MjL6nmFlrrAfRU6PBkwysIio6/XHS9jG+TI7NeRApkHnwi |
|         | vwIWEKSg6pqaiLUsMi/46KCHzde2OzgO8Hd0R5d7hNN/80mhD7b+bY9wig+VTMoQFQYSWrIy/qLL95ws4amg |
|         | nXOIksNFjfFEE/+lMcZXt3j5kqnjW7OT2/xkqqWoumaM+FEPLNijL18yb29/XJr/cQZX5R9iXSk33DVjhln/ |
|         | HG7xpHqAtrXbvKY8zI8t23otGT/rSvWRWV/wgPBZVWSWtsE99FEMmwmxk/b3KuPhi0jK0IUKcv5UBL+NLHw4 |
|         | rZRiYgw/fWXPO3f6ZSLLJXtW4iW+BQL60qQWUNQ==                                            |
|         |   user@example.com                                                                   |
|         | label: user@example.com                                                              |
| state   | success                                                                              |
| task_id | 100a54ce-0bf5-4bc0-8e46-2e8b952343e6                                                 |
+---------+--------------------------------------------------------------------------------------+

5.6.2. vinfra cluster sshkey list

Show the list of added SSH public keys:

usage: vinfra cluster sshkey list [--long]
--long
Enable access and listing of all fields of objects.

Example:

# vinfra cluster sshkey list
+--------------------------------------+---------------------------------------+------------------+
| id                                   | key                                   | label            |
+--------------------------------------+---------------------------------------+------------------+
| 8ccf7f1b-6a53-4d74-99ce-c410d51a9921 | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACA | user@example.com |
|                                      | QCueWO956J/u5kjWnia7zePChoTMVBtsh1TDN |                  |
|                                      | gOskMg5shfHWUzzfydi3/4sTrJ++6dtIoS1D3 |                  |
|                                      | VVHvHBvp456PT5e/eVy7u0SipOPPoDY2vS2IE |                  |
|                                      | Y+zjT6MYABi6oEYomIIDbi7CsRL02HcTWzAko |                  |
|                                      | oZNlimWPggYaMT10BZOKAvNB+Ctpkw8JaT5PR |                  |
|                                      | ve8UVfjxIQIzL6pQOf0CDeCHgDsvwcmxK7Srq |                  |
|                                      | OvBzTlF9mWkGdTGy+R0JrgGk+v9PvDXZwyeK+ |                  |
|                                      | qS54uaGmpB6ZRkKMroIk3h+nZ4y/1eQ6m1C8A |                  |
|                                      | spa0f5nnaMaNKOtwOibrd3MDroMcqkJWTTH/c |                  |
|                                      | ukD3sB+MjL6nmFlrrAfRU6PBkwysIio6/XHS9 |                  |
|                                      | jG+TI7NeRApkHnwiiOvwIWEKSg6pqaiLUsMi/ |                  |
|                                      | 46KCHzde2OzgO8Hd0R5d7hNN/80mhD7b+bY9w |                  |
|                                      | ig+VTMoQFQYSWrIy/qLL95ws4amgAQnXOIksN |                  |
|                                      | FjfFEE/+lMcZXt3j5kqnjW7OT2/xkqqWoumaM |                  |
|                                      | +FEPLNijL18yb29/XJr/cQZX5R9iXSk33DVjh |                  |
|                                      | ln/EyHG7xpHqAtrXbvKY8zI8t23otGT/rSvWR |                  |
|                                      | WV/wgPBZVWSWtsE99FEMmwmxk/b3KuPhi0jK0 |                  |
|                                      | IUKcv5UBL+NLHw4gQrZRiYgw/fWXPO3f6ZSLL |                  |
|                                      | JXtW4iW+BQL60qQWUNQ==                 |                  |
|                                      | user@example.com                      |                  |
+--------------------------------------+---------------------------------------+------------------+

This command lists trusted SSH keys.

5.6.3. vinfra cluster sshkey delete

Remove an SSH public key from storage cluster nodes:

usage: vinfra cluster sshkey delete <sshkey>
<sshkey>
SSH key value

Example:

# vinfra cluster sshkey delete 8ccf7f1b-6a53-4d74-99ce-c410d51a9921
+---------+--------------------------------------+
| Field   | Value                                |
+---------+--------------------------------------+
| task_id | 053802b2-b4c3-454d-89e2-6d6d312dd2ed |
+---------+--------------------------------------+

This command creates a task to delete the SSH key with the ID 8ccf7f1b-6a53-4d74-99ce-c410d51a9921.

Task outcome:

# vinfra task show 053802b2-b4c3-454d-89e2-6d6d312dd2ed
+---------+-------------------------------------------------------+
| Field   | Value                                                 |
+---------+-------------------------------------------------------+
| args    | - admin                                               |
|         | - 1                                                   |
|         | - 8ccf7f1b-6a53-4d74-99ce-c410d51a9921                |
| kwargs  | {}                                                    |
| name    | backend.presentation.nodes.ssh.tasks.RemoveSshKeyTask |
| state   | success                                               |
| task_id | 053802b2-b4c3-454d-89e2-6d6d312dd2ed                  |
+---------+-------------------------------------------------------+