Bug 632851 - [PATCH] fence_virsh: add option --use-sudo
Summary: [PATCH] fence_virsh: add option --use-sudo
Alias: None
Product: Fedora
Classification: Fedora
Component: fence-agents
Version: 19
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Marek Grac
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2010-09-11 13:12 UTC by Niels de Vos
Modified: 2015-01-12 09:28 UTC (History)
1 user (show)

Fixed In Version: fence-agents-3.1.10-1.fc19
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2015-01-12 09:28:11 UTC
Type: ---

Attachments (Terms of Use)
Initial patch for --use-sudo for fence_virsh (2.62 KB, application/octet-stream)
2010-09-11 13:12 UTC, Niels de Vos
no flags Details

Description Niels de Vos 2010-09-11 13:12:02 UTC
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 cluster-devel@redhat.com was sent yesterday, but is not in the archives yet...).

Comment 1 Marek Grac 2012-08-09 13:06:34 UTC

sorry that it took so long. Patch based on your proposion is in upstream now and it will be part of next minor version.


Comment 2 Niels de Vos 2012-08-09 15:03:38 UTC

Comment 3 Fedora End Of Life 2013-04-03 20:34:35 UTC
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:

Comment 4 Fedora End Of Life 2015-01-09 22:28:25 UTC
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.

Note You need to log in before you can comment on or make changes to this bug.