4.3. Managing SSH Keys

4.3.1. Adding SSH Keys

4.3.1.1. Syntax

usage: vinfra cluster sshkey add [-h] [-f {json,table,value,yaml}] [-c COLUMN]
                                 [--wait] [--timeout <seconds>]
                                 <file>

Add an SSH public key from a file.

positional arguments:
  <file>                SSH public key file
...

4.3.1.2. Sample Output

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

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

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                                                 |
+---------+--------------------------------------------------------------------------------------+

4.3.2. Listing SSH Keys

4.3.2.1. Syntax

usage: vinfra cluster sshkey list [-h] [-f {json,table,value,yaml}]
                                  [-c COLUMN]

Show the list of added SSH public keys.
...

4.3.2.2. Sample Output

This command lists trusted SSH keys.

# 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                      |                  |
+--------------------------------------+---------------------------------------+------------------+

4.3.3. Deleting SSH Keys

4.3.3.1. Syntax

usage: vinfra cluster sshkey delete [-h] [-f {json,table,value,yaml}]
                                    [-c COLUMN] [--wait] [--timeout <seconds>]
                                    <sshkey>

Remove an SSH public key from storage cluster nodes.

positional arguments:
  <sshkey>              SSH key value
...

4.3.3.2. Sample Output

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

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

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                  |
+---------+-------------------------------------------------------+