Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions crates/kit/src/libvirt/domain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,15 @@ impl DomainBuilder {
writer.end_element("video")?;
}

// SPICE graphics for virt-manager access
// Always enable SPICE with auto-port allocation for easy debugging via virt-manager
writer.start_element("graphics", &[("type", "spice"), ("autoport", "yes")])?;
writer.write_empty_element("listen", &[("type", "address"), ("address", "127.0.0.1")])?;
writer.end_element("graphics")?;
writer.start_element("video", &[])?;
writer.write_empty_element("model", &[("type", "virtio")])?;
writer.end_element("video")?;
Comment on lines +462 to +469

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security-medium medium

This section enables the SPICE graphics console by default, listening on "127.0.0.1" without authentication. This creates a security vulnerability where local users in multi-user environments could gain unauthorized access to the VM console. It is highly recommended to make this feature optional or implement authentication. Furthermore, this unconditional addition of a SPICE "

Suggested change
// SPICE graphics for virt-manager access
// Always enable SPICE with auto-port allocation for easy debugging via virt-manager
writer.start_element("graphics", &[("type", "spice"), ("autoport", "yes")])?;
writer.write_empty_element("listen", &[("type", "address"), ("address", "127.0.0.1")])?;
writer.end_element("graphics")?;
writer.start_element("video", &[])?;
writer.write_empty_element("model", &[("type", "virtio")])?;
writer.end_element("video")?;
if self.vnc_port.is_none() {
// SPICE graphics for virt-manager access
// Always enable SPICE with auto-port allocation for easy debugging via virt-manager
writer.start_element("graphics", &[("type", "spice"), ("autoport", "yes")])?;
writer.write_empty_element("listen", &[("type", "address"), ("address", "127.0.0.1")])?;
writer.end_element("graphics")?;
writer.start_element("video", &[])?;
writer.write_empty_element("model", &[("type", "virtio")])?;
writer.end_element("video")?;
}


// Virtiofs filesystems
for filesystem in &self.virtiofs_filesystems {
writer.start_element(
Expand Down
Loading