Bug #35035
closedVM creation is broken with libvirt >= 8.0.0 due to VNC password length
Description
since libvirt >= 8.0.0 [1] (RHEL 8.6, RHEL9, and probably others), the VNC password must be limited to 8 chars.
Foreman uses 16 a char password and VM creation breaks:
"Failed to create a compute xxxx (Libvirt) instance xxxx: Error saving the server: Call to virDomainDefineXML failed: unsupported configuration: VNC password is 16 characters long, only 8 permitted"
The solution, for now, was to reduce SecureRandom.hex(8) to SecureRandom.hex(4) in random_password() [2], which is called by the libvirt model [3]. But that's probably not the best way :)
[1] https://github.com/libvirt/libvirt/commit/27c1d06b5bd68bdce55efff0a50a15a30cb2a96b
[2] https://github.com/theforeman/foreman/blob/develop/app/models/compute_resource.rb#L429
[3] https://github.com/theforeman/foreman/blob/develop/app/models/compute_resources/foreman/model/libvirt.rb#L176
Updated by Robert Frank over 2 years ago
- Related to Bug #35024: Foreman Libvirt Plugin requesting +8 chars for remote console VNC Password added
Updated by Robert Frank over 2 years ago
- Found in Releases 3.3.0 added
I think the best approach is to pass the required length to the random_password function using the current 8 as the default value.
Then libvirt.rb can call random_password(4) without reducing the security of other providers.
I've create a patch [1]. Let me know if you want me to create a PR.
[1] https://github.com/theforeman/foreman/compare/develop...rwf14f:35035-fix_vnc_password_length
Updated by Lukas Zapletal over 2 years ago
- Triaged changed from No to Yes
Hey, thanks for the report and patch, yeah file a PR please.
Updated by The Foreman Bot over 2 years ago
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/9265 added
Updated by Anonymous over 2 years ago
- Status changed from Ready For Testing to Closed
Applied in changeset foreman|4ea1a6b709e3755aa6bd0eb76754f34b56797197.
Updated by Ewoud Kohl van Wijngaarden about 2 years ago
- Subject changed from VM creation is broken with libvirt >= 8.0.0 to VM creation is broken with libvirt >= 8.0.0 due to VNC password length
- Category set to Compute resources - libvirt