Bug 1598167

Summary: VNC server TLS config must change to use new tls-creds-x509 object syntax
Product: Red Hat Enterprise Linux 8 Reporter: Daniel Berrangé <berrange>
Component: libvirtAssignee: Ján Tomko <jtomko>
Status: CLOSED CURRENTRELEASE QA Contact: yafu <yafu>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.0CC: chhu, dyuan, fjin, xuzhang, yalzhang
Target Milestone: rc   
Target Release: 8.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-4.5.0-9.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-06-14 01:18:42 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
vnc-tls.sh none

Description Daniel Berrangé 2018-07-04 14:03:34 UTC
Description of problem:
When TLS support was added to QEMU chardevs, migration, NBD, the existing syntax used by VNC was deprecated. Unfortunately it appears that libvirt is still using the deprecated syntax, as the VNC server code not switched to the new syntax when TLS was added to chardevs/migration/NBD.

QEMU will shortly be deleting support for the deprecated syntax entirely, so libvirt must switch to the new syntax for VNC ASAP to avoid regression.

ie it must  use   -object tls-creds-x509,.... and  -vnc tls-creds=$ID instead of the 'tls', 'x509' or 'x509verify' flags to -vnc.

This will also allow for using encrypted TLS creds with VNC.

Version-Release number of selected component (if applicable):
4.5.0-1.el8

Comment 1 Ján Tomko 2018-07-17 15:17:26 UTC
Upstream patches switching to the new syntax:
https://www.redhat.com/archives/libvir-list/2018-July/msg01085.html

They do not include the ability to use encrypted TLS creds.

Comment 2 Daniel Berrangé 2018-07-18 10:37:54 UTC
Filed a separate bug to track use of encrypted creds

https://bugzilla.redhat.com/show_bug.cgi?id=1602418

Comment 3 Ján Tomko 2018-07-18 15:41:40 UTC
Pushed upstream as:
Author:     Ján Tomko <jtomko>
CommitDate: 2018-07-18 17:29:51 +0200

    qemu: vnc: switch to tls-creds-x509
    
    The tls, x509 and x509verify options were deprecated in QEMU v2.5.0:
    
    commit 3e305e4a4752f70c0b5c3cf5b43ec957881714f7
    Author:     Daniel P. Berrange <berrange>
    
        ui: convert VNC server to use QCryptoTLSSession
    
    Use the tls-creds-x509 object when available.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1598167
    
    Signed-off-by: Ján Tomko <jtomko>

git describe: v4.5.0-166-g17f50c8260

Comment 6 yafu 2019-01-10 06:11:01 UTC
Verified with:
libvirt-4.5.0-16.el8.x86_64
qemu-kvm-2.12.0-51.module+el8+2608+a17c4bfe.x86_64

Test steps:
1.Setup tls env using scripts in attachment:
#sh vnc-tls.sh

2.Enable vnc_tls in qemu.conf:
vnc_tls = 1 
vnc_tls_x509_cert_dir = "/etc/pki/libvirt-vnc"

3.Restart libvirtd:
#systemctl restart libvirtd

4.Define a guest with vnc graphics device:
#virsh edit vm1
 <graphics type='vnc' autoport='yes' listen='0.0.0.0'>
      <listen type='address' address='0.0.0.0'/>
 </graphics>

5.Start the guest:
#virsh start vm

6.Check the qemu cmd line:
# ps aux  | grep -i vnc
..-object tls-creds-x509,id=vnc-tls-creds0,dir=/etc/pki/libvirt-vnc,endpoint=server,verify-peer=no -vnc 0.0.0.0:1,tls-creds=vnc-tls-creds0
..

7.Can connect guest by vncviewer successfully:
#vncviewer -X509CA /etc/pki/libvirt-vnc/ca-cert.pem
Click on 'yes' in popped vncviewer window to continue.

Comment 7 yafu 2019-01-10 06:11:49 UTC
Created attachment 1519657 [details]
vnc-tls.sh