Bug 632851

Summary: [PATCH] fence_virsh: add option --use-sudo
Product: [Fedora] Fedora Reporter: Niels de Vos <ndevos>
Component: fence-agentsAssignee: Marek Grac <mgrac>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: low    
Version: 19CC: fdinitto
Target Milestone: ---Keywords: Patch
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: fence-agents-3.1.10-1.fc19 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-01-12 09:28:11 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Initial patch for --use-sudo for fence_virsh none

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 was sent yesterday, but is not in the archives yet...).

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

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

http://git.fedorahosted.org/cgit/fence-agents.git/commit/?id=b2afa6263795d06bbfc027444c812a7c20d500c7

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

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:
https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora19

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.