Bug 1967716

Summary: RFE: rebuild guest agent to include public ssh injection api support
Product: Red Hat Enterprise Linux 8 Reporter: David Vossel <dvossel>
Component: qemu-kvmAssignee: Marc-Andre Lureau <marcandre.lureau>
qemu-kvm sub component: Guest Agent QA Contact: dehanmeng <demeng>
Status: CLOSED ERRATA Docs Contact:
Severity: medium    
Priority: medium CC: danken, demeng, fdeutsch, jinzhao, juzhang, mprivozn, virt-maint
Version: 8.5Keywords: FutureFeature, Triaged
Target Milestone: betaFlags: pm-rhel: mirror+
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qemu-kvm-4.2.0-56.module+el8.5.0+12039+0434c559 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-11-09 18:01:39 UTC Type: Feature Request
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description David Vossel 2021-06-03 17:05:02 UTC
Description of problem:

https://bugzilla.redhat.com/show_bug.cgi?id=1885332 includes a new qemu guest agent api that supports ssh injection. This was shipped in RHEL-AV 8.4. This guest agent api needs to be present for rhel 8.4 guests that are not using the RHEL-AV packages as well

Comment 2 John Ferlan 2021-06-04 12:37:41 UTC
Looks like we need backports for RHEL 8.5.0 and then eventually a zstream for 8.4.0

Comment 3 Marc-Andre Lureau 2021-06-06 19:41:29 UTC
backport patches ready to be submitted:
https://gitlab.com/marcandre.lureau-rh/qemu-kvm/-/tree/rhbz-1967716

Comment 4 Fabian Deutsch 2021-06-07 14:15:11 UTC
Quick q: How is the guest agent delivered these days on RHEL?Using an RPM or container?

Comment 5 John Ferlan 2021-06-08 13:47:16 UTC
Changing to ASSIGNED since patches aren't posted downstream yet

I believe Fabian's question was answered in the Virt/CNV meeting by Martin - essentially it was a RHV mechanism until RHCOS added guest agent.

Once patches are posted to rhvirt-patches the DTM would need to be adjusted

Comment 6 Marc-Andre Lureau 2021-06-08 16:01:46 UTC
please qa ack

Comment 7 Marc-Andre Lureau 2021-06-09 10:07:15 UTC
sent "[RHEL-8.5.0 qemu-kvm PATCH 0/4] qga: public ssh injection api support"

Comment 10 Yanan Fu 2021-07-29 14:25:04 UTC
QE bot(pre verify): Set 'Verified:Tested,SanityOnly' as gating/tier1 test pass.

Comment 11 dehanmeng 2021-07-30 02:40:05 UTC
Verify with version qemu-kvm-4.2.0-56.module+el8.5.0+12039+0434c559

Steps to Verify:
1.Start guest with virtio serial and start guest agent inside the guest 
2.Connect to the chardev socket in host side for sending following command to the guest:
# nc -U /tmp/qga.sock 
{"execute":"guest-ping"}
{"return": {}}
3.Off the selinux permission in guest:
#setenforce 0 
4.create a user in guest:
#useradd fedora
5.issue cmds in the unix socked,cmds like following items:
{"execute": "guest-ssh-add-authorized-keys", "arguments": { "username": "fedora", "keys": ["ssh-rsa aaa"]}}
{"return": {}}

$cat .ssh/authorized_keys
ssh-rsa aaa
{"execute":"guest-ssh-get-authorized-keys","arguments":{"username":"fedora" }}
{"return": {"keys": ["ssh-rsa aaa"]}}

{"execute": "guest-ssh-add-authorized-keys", "arguments": { "username": "fedora", "keys": [ "ssh-rsa aaa", "ssh-rsa bbb" ] } }
{"return": {}}
$cat .ssh/authorized_keys
ssh-rsa aaa
ssh-rsa bbb


{"execute": "guest-ssh-remove-authorized-keys", "arguments": { "username": "fedora", "keys": [ "ssh-rsa bbb", "ssh-rsa ccc" ] } }
{"return": {}}
$cat .ssh/authorized_keys
ssh-rsa aaa

{"execute":"guest-ssh-add-authorized-keys","arguments":{"username": "fedora", "keys": ["aaa"], "reset": true }}                  
{"return": {}}

$cat .ssh/authorized_keys
aaa
{"execute":"guest-ssh-get-authorized-keys","arguments":{"username":"fedora" }}
{"return": {"keys": ["aaa"]}}

Actual result:
Commands running well and no errors.
Expected result:
Commands running well and no errors.

Comment 14 errata-xmlrpc 2021-11-09 18:01:39 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 (Moderate: virt:rhel and virt-devel:rhel security, bug fix, and enhancement 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-2021:4191