Red Hat Bugzilla – Bug 632851
[PATCH] fence_virsh: add option --use-sudo
Last modified: 2015-01-12 04:28:11 EST
Created attachment 446663 [details]
Initial patch for --use-sudo for fence_virsh
Description of problem:
fence_virsh logs in on the host (bare metal) running the guest (virtual) and executes 'virsh <action> <guest>'. It is required that the system that executed the fencing, can log in as a user with the privileges to run 'virsh'. Allowing 'virsh' to work correctly, requires on standard installations 'root' privileges.
However it may not always be acceptable that a virtual machine executing fence-operations can gain 'root' access on the physical host. Separating privileges with 'sudo' is easy to setup, but requires fence_virsh to be able to execute 'sudo virsh ...' instead of the plain 'virsh ...'.
The attached patch implements a --use-sudo (or -U) option in fencing.py and uses this option in fence_virsh.
A simple /etc/sudoers.d/fence_virsh allows any user in the 'virtadmin' group to execute (any) virsh commands. It would be possible to fine-tune this on user basis and only allow some users fence some virtual-machines.
Example of /etc/sudoers.d/fence_virsh:
# configuration to allow the group virtadmin execute virsh commands
%virtadmin ALL = NOPASSWD : /usr/bin/virsh
Please consider this patch (or similar) for inclusion (an email to firstname.lastname@example.org was sent yesterday, but is not in the archives yet...).
sorry that it took so long. Patch based on your proposion is in upstream now and it will be part of next minor version.
This bug appears to have been reported against 'rawhide' during the Fedora 19 development cycle.
Changing version to '19'.
(As we did not run this process for some time, it could affect also pre-Fedora 19 development
cycle bugs. We are very sorry. It will help us with cleanup during Fedora 19 End Of Life. Thank you.)
More information and reason for this action is here:
This message is a notice that Fedora 19 is now at end of life. Fedora
has stopped maintaining and issuing updates for Fedora 19. It is
Fedora's policy to close all bug reports from releases that are no
longer maintained. Approximately 4 (four) weeks from now this bug will
be closed as EOL if it remains open with a Fedora 'version' of '19'.
Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.
Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 19 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.
Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.