fence-agents: RHEL6 - fence_vmware_soap, fence_ovh: Caching problem with SOAP library

Marek GrĂ¡c marx at fedoraproject.org
Mon Oct 7 20:07:40 UTC 2013


Gitweb:        http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=9d23663ae93316eedb5c925f719a21ea74e9f59f
Commit:        9d23663ae93316eedb5c925f719a21ea74e9f59f
Parent:        ca652f4da2d9319c2b04000531745873613f4b2e
Author:        Marek 'marx' Grac <mgrac at redhat.com>
AuthorDate:    Mon Oct 7 15:41:09 2013 +0200
Committer:     Marek 'marx' Grac <mgrac at redhat.com>
CommitterDate: Mon Oct 7 22:06:52 2013 +0200

fence_vmware_soap, fence_ovh: Caching problem with SOAP library

Both fence agents are built on top of SUDS library which creates a cache file. Unfortunately,
it is not yet possible to completely move cache or remove it. Due to possible security issue (symlink
vulnerability) we have decided to solve this problem as simply as possible. So '/tmp' was changed to an
automatically generated temp directory which is removed at the exit of fence agent as we won't reuse it anyway.

Resolves: rhbz#1014000
---
 fence/agents/vmware_soap/fence_vmware_soap.py |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/fence/agents/vmware_soap/fence_vmware_soap.py b/fence/agents/vmware_soap/fence_vmware_soap.py
index f01d37b..6abf626 100644
--- a/fence/agents/vmware_soap/fence_vmware_soap.py
+++ b/fence/agents/vmware_soap/fence_vmware_soap.py
@@ -1,6 +1,7 @@
 #!/usr/bin/python
 
 import sys, re, pexpect, exceptions
+import shutil, tempfile
 sys.path.append("@FENCEAGENTSLIBDIR@")
 
 from suds.client import Client
@@ -22,6 +23,10 @@ def soap_login(options):
 	
 	url += options["-a"] + ":" + str(options["-u"]) + "/sdk"
 
+	tmp_dir = tempfile.mkdtemp()
+	tempfile.tempdir = tmp_dir
+	atexit.register(remove_tmp_dir, tmp_dir)
+	
 	try:
 		conn = Client(url + "/vimService.wsdl")
 		conn.set_options(location = url)
@@ -158,6 +163,9 @@ def set_power_status(conn, options):
 	else:
 		conn.service.PowerOffVM_Task(mo_machine)	
 
+def remove_tmp_dir(tmp_dir):
+	shutil.rmtree(tmp_dir)
+
 def main():
 	device_opt = [  "help", "version", "agent", "quiet", "verbose", "debug",
 			"action", "ipaddr", "login", "passwd", "passwd_script",


More information about the cluster-commits mailing list