fence-agents/0016-fence_pve-Add-support-for-ssl-secure-and-ssl-insecur.patch

35 lines
1.1 KiB
Diff

From 1a51916d64f48995b324e0c8f0977366956896b1 Mon Sep 17 00:00:00 2001
From: Marek 'marx' Grac <mgrac@redhat.com>
Date: Mon, 13 Oct 2014 10:33:18 +0200
Subject: [PATCH 16/16] fence_pve: Add support for --ssl-secure and
--ssl-insecure
Resolves: rhbz#1151515
---
fence/agents/pve/fence_pve.py | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/fence/agents/pve/fence_pve.py b/fence/agents/pve/fence_pve.py
index 132234e..bb59a9b 100644
--- a/fence/agents/pve/fence_pve.py
+++ b/fence/agents/pve/fence_pve.py
@@ -106,8 +106,13 @@ def send_cmd(options, cmd, post=None):
conn.setopt(pycurl.POSTFIELDS, urllib.urlencode(post))
conn.setopt(pycurl.WRITEFUNCTION, output_buffer.write)
conn.setopt(pycurl.TIMEOUT, int(options["--shell-timeout"]))
- conn.setopt(pycurl.SSL_VERIFYPEER, 0)
- conn.setopt(pycurl.SSL_VERIFYHOST, 0)
+ if opt.has_key("--ssl") or opt.has_key("--ssl-secure"):
+ conn.setopt(pycurl.SSL_VERIFYPEER, 1)
+ conn.setopt(pycurl.SSL_VERIFYHOST, 2)
+
+ if opt.has_key("--ssl-insecure"):
+ conn.setopt(pycurl.SSL_VERIFYPEER, 0)
+ conn.setopt(pycurl.SSL_VERIFYHOST, 0)
logging.debug("URL: " + url)
--
1.8.4.5