mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 14:57:42 +00:00
qemu: Add conf option to auto setup VNC unix sockets
If vnc_auto_unix_socket is enabled, any VNC devices without a hardcoded listen or socket value will be setup to serve over a unix socket in /var/lib/libvirt/qemu/$vmname.vnc. We store the generated socket path in the transient VM definition at CLI build time.
This commit is contained in:
parent
1d9c0a08d9
commit
a942ea0692
@ -11,6 +11,14 @@
|
|||||||
#
|
#
|
||||||
# vnc_listen = "0.0.0.0"
|
# vnc_listen = "0.0.0.0"
|
||||||
|
|
||||||
|
# Enable this option to have VNC served over an automatically created
|
||||||
|
# unix socket. This prevents unprivileged access from users on the
|
||||||
|
# host machine, though most VNC clients do not support it.
|
||||||
|
#
|
||||||
|
# This will only be enabled for VNC configurations that do not have
|
||||||
|
# a hardcoded 'listen' or 'socket' value.
|
||||||
|
#
|
||||||
|
# vnc_auto_unix_socket = 1
|
||||||
|
|
||||||
# Enable use of TLS encryption on the VNC server. This requires
|
# Enable use of TLS encryption on the VNC server. This requires
|
||||||
# a VNC client which supports the VeNCrypt protocol extension.
|
# a VNC client which supports the VeNCrypt protocol extension.
|
||||||
|
@ -3560,7 +3560,15 @@ qemuBuildCommandLine(virConnectPtr conn,
|
|||||||
def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
|
def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
|
||||||
virBuffer opt = VIR_BUFFER_INITIALIZER;
|
virBuffer opt = VIR_BUFFER_INITIALIZER;
|
||||||
|
|
||||||
if (def->graphics[0]->data.vnc.socket) {
|
if (def->graphics[0]->data.vnc.socket ||
|
||||||
|
driver->vncAutoUnixSocket) {
|
||||||
|
|
||||||
|
if (!def->graphics[0]->data.vnc.socket &&
|
||||||
|
virAsprintf(&def->graphics[0]->data.vnc.socket,
|
||||||
|
"%s/%s.vnc", driver->libDir, def->name) == -1) {
|
||||||
|
goto no_memory;
|
||||||
|
}
|
||||||
|
|
||||||
virBufferVSprintf(&opt, "unix:%s",
|
virBufferVSprintf(&opt, "unix:%s",
|
||||||
def->graphics[0]->data.vnc.socket);
|
def->graphics[0]->data.vnc.socket);
|
||||||
|
|
||||||
|
@ -138,6 +138,10 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
|
|||||||
return -1; \
|
return -1; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
p = virConfGetValue (conf, "vnc_auto_unix_socket");
|
||||||
|
CHECK_TYPE ("vnc_auto_unix_socket", VIR_CONF_LONG);
|
||||||
|
if (p) driver->vncAutoUnixSocket = p->l;
|
||||||
|
|
||||||
p = virConfGetValue (conf, "vnc_tls");
|
p = virConfGetValue (conf, "vnc_tls");
|
||||||
CHECK_TYPE ("vnc_tls", VIR_CONF_LONG);
|
CHECK_TYPE ("vnc_tls", VIR_CONF_LONG);
|
||||||
if (p) driver->vncTLS = p->l;
|
if (p) driver->vncTLS = p->l;
|
||||||
|
@ -82,6 +82,7 @@ struct qemud_driver {
|
|||||||
char *cacheDir;
|
char *cacheDir;
|
||||||
char *saveDir;
|
char *saveDir;
|
||||||
char *snapshotDir;
|
char *snapshotDir;
|
||||||
|
unsigned int vncAutoUnixSocket : 1;
|
||||||
unsigned int vncTLS : 1;
|
unsigned int vncTLS : 1;
|
||||||
unsigned int vncTLSx509verify : 1;
|
unsigned int vncTLSx509verify : 1;
|
||||||
unsigned int vncSASL : 1;
|
unsigned int vncSASL : 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user