Bug 2217870 - "virtctl ssh" and NodePort ssh commands in UI do not work without '-i' flag
Summary: "virtctl ssh" and NodePort ssh commands in UI do not work without '-i' flag
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Container Native Virtualization (CNV)
Classification: Red Hat
Component: User Experience
Version: 4.13.0
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
: 4.14.0
Assignee: Tal Nisan
QA Contact: Guohua Ouyang
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-06-27 10:25 UTC by Avital Pinnick
Modified: 2023-11-08 14:06 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-11-08 14:05:51 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker CNV-30327 0 None None None 2023-06-27 10:28:01 UTC
Red Hat Product Errata RHSA-2023:6817 0 None None None 2023-11-08 14:06:06 UTC

Description Avital Pinnick 2023-06-27 10:25:43 UTC
Description of problem:

The "virtctl ssh" and "NodePort ssh" commands that are copied from the UI do not work unless the user adds the "-i" flag and the private key. 

Version-Release number of selected component (if applicable):
4.13

How reproducible:


Steps to Reproduce:
1. Create SSH key pair with "ssh-keygen" in /home/user/.ssh directory.
2. Inject public key as static key into a VM and restart the VM.
3. Copy the virtctl ssh command from the UI and try to run it from the CLI.

Actual results:
Permission denied error:

[avitalpinnick@fedora ~]$ virtctl -n avital ssh cloud-user@rhel9-inject-before-boot
The authenticity of host 'vmi/rhel9-inject-before-boot.avital (<no hostip for proxy command>)' can't be established.
ED25519 key fingerprint is SHA256:vmloMxhsR1f49jl04UrMNiJkxn3Xj9HHufgfwtWHHLM.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'vmi/rhel9-inject-before-boot.avital' (ED25519) to the list of known hosts.
cloud-user@vmi/rhel9-inject-before-boot.avital: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).

Expected results:
SSH connection succeeds

Additional info:

This command worked with "/home/avitalpinnick/.ssh/testkey2": "virtctl -n avital ssh cloud-user@rhel9-inject-before-boot -i testkey2"

If the private key is in another location, the full path has to be specified: "virtctl -n avital ssh cloud-user@rhel9-inject-before-boot -i /home/avitalpinnick/testkey2"

I observed the same behavior when I copied and ran the NodePort/SSH command (after running the oc patch command to get the service to work).

I recommend adding "-i <private_SSH_key>" with a tooltip saying that if the private key is not in /home/user/.ssh, the full path needs to be specified.

Comment 1 Dominik Holler 2023-07-27 09:43:14 UTC
Should documentation for the "--identity-file" and a "--local-ssh-opts" option added to
https://docs.openshift.com/container-platform/4.14/virt/virtual_machines/virt-accessing-vm-ssh.html#using-virtctl-ssh_virt-accessing-vm-ssh
?

Comment 2 Guohua Ouyang 2023-08-01 05:02:13 UTC
verified on kubevirt-console-plugin-rhel9:v4.14.0-2359

Comment 4 Avital Pinnick 2023-08-01 12:01:26 UTC
(In reply to Dominik Holler from comment #1)
> Should documentation for the "--identity-file" and a "--local-ssh-opts"
> option added to
> https://docs.openshift.com/container-platform/4.14/virt/virtual_machines/
> virt-accessing-vm-ssh.html#using-virtctl-ssh_virt-accessing-vm-ssh
> ?

The "-i" flag (same as --identity-file) is already documented: https://docs.openshift.com/container-platform/4.14/virt/virtual_machines/virt-accessing-vm-ssh.html#virt-running-virtctl-ssh-command_virt-accessing-vm-ssh

Comment 5 errata-xmlrpc 2023-11-08 14:05:51 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Important: OpenShift Virtualization 4.14.0 Images security and bug fix update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2023:6817


Note You need to log in before you can comment on or make changes to this bug.