[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] Cluster Project branch, RHEL47, updated. gfs-kernel_2_6_9_76-59-g115f01b



This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Cluster Project".

http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=115f01bfcf32a87e9d3bc0b215ad9a61ecf9b903

The branch, RHEL47 has been updated
       via  115f01bfcf32a87e9d3bc0b215ad9a61ecf9b903 (commit)
      from  f9daca2d6e65a8265c2358714e5038426adabe49 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 115f01bfcf32a87e9d3bc0b215ad9a61ecf9b903
Author: Marek 'marx' Grac <mgrac redhat com>
Date:   Mon May 19 17:28:39 2008 +0200

    [FENCE] Fix #248609: SSH support in Bladecenter fencing (ssh)
    
    Complete ssh support for Bladecenter. You can use password or private key
    (identity_file on STDIN; -k in getopt) to login to system. This patch contains
    complete infrastructure (usable also by other agents).

-----------------------------------------------------------------------

Summary of changes:
 fence/agents/bladecenter/fence_bladecenter.py |    2 +-
 fence/agents/lib/fencing.py.py                |   40 ++++++++++++++++++++-----
 2 files changed, 33 insertions(+), 9 deletions(-)

diff --git a/fence/agents/bladecenter/fence_bladecenter.py b/fence/agents/bladecenter/fence_bladecenter.py
index 6670bcb..ff7ad67 100755
--- a/fence/agents/bladecenter/fence_bladecenter.py
+++ b/fence/agents/bladecenter/fence_bladecenter.py
@@ -64,7 +64,7 @@ def set_power_status(conn, options):
 def main():
 	device_opt = [  "help", "version", "agent", "quiet", "verbose", "debug",
 			"action", "ipaddr", "login", "passwd", "passwd_script",
-			"cmd_prompt", "secure", "port" ]
+			"cmd_prompt", "secure", "port", "identity_file" ]
 
 	options = check_input(device_opt, process_input(device_opt))
 
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index 0ddf173..7aa8a0c 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -72,12 +72,16 @@ all_opt = {
 		"order" : 1 },
 	"passwd" : {
 		"getopt" : "p:",
-		"help" : "-p <password>  Login password",
+		"help" : "-p <password>  Login password or passphrase",
 		"order" : 1 },
 	"passwd_script" : {
 		"getopt" : "S:",
 		"help" : "-S <script>    Script to run to retrieve password",
 		"order" : 1 },
+	"identity_file" : {
+		"getopt" : "k:",
+		"help" : "-k <filename>  Identity file (private key) for ssh ",
+		"order" : 1 },
 	"module_name" : {
 		"getopt" : "m:",
 		"help" : "-m <module>    DRAC/MC module name",
@@ -254,11 +258,19 @@ def check_input(device_opt, opt):
 	if 0 == options.has_key("-a"):
 		fail_usage("Failed: You have to enter fence address")
 
-	if 0 == (options.has_key("-p") or options.has_key("-S")):
-		fail_usage("Failed: You have to enter password or password script")
+	if 0 == device_opt.count("identity_file"):
+		if 0 == (options.has_key("-p") or options.has_key("-S")):
+			fail_usage("Failed: You have to enter password or password script")
+	else: 
+		if 0 == (options.has_key("-p") or options.has_key("-S") or options.has_key("-k")):
+			fail_usage("Failed: You have to enter password, password script or identity file")
+
+	if 0 == options.has_key("-x") and 1 == options.has_key("-k"):
+		fail_usage("Failed: You have to use identity file together with ssh connection (-x)")
 
-	if 1 == (options.has_key("-p") and options.has_key("-S")):
-		fail_usage("Failed: You have to enter password or password script")
+	if 1 == options.has_key("-k"):
+		if 0 == os.path.isfile(options["-k"]):
+			fail_usage("Failed: Identity file " + options["-k"] + " does not exist")
 
 	if (0 == options.has_key("-n")) and (device_opt.count("port")):
 		fail_usage("Failed: You have to enter plug number")
@@ -325,14 +337,26 @@ def fence_login(options):
 		re_login = re.compile("(login: )|(Login Name:  )|(username: )|(User Name :)", re.IGNORECASE)
 		re_pass  = re.compile("password", re.IGNORECASE)
 
-		if options.has_key("-x"):
+		if options.has_key("-x") and 0 == options.has_key("-k"):
 			conn = fspawn ('ssh ' + options["-l"] + "@" + options["-a"])
-			result = conn.log_expect(options, [ "ssword: ", "Are you sure you want to continue connecting (yes/no)?" ], LOGIN_TIMEOUT)
+			result = conn.log_expect(options, [ "ssword:", "Are you sure you want to continue connecting (yes/no)?" ], LOGIN_TIMEOUT)
 			if result == 1:
 				conn.sendline("yes")
-				conn.log_expect(options, "ssword: ", SHELL_TIMEOUT)
+				conn.log_expect(options, "ssword:", SHELL_TIMEOUT)
 			conn.sendline(options["-p"])
 			conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
+		elif options.has_key("-x") and 1 == options.has_key("-k"):
+			conn = fspawn ('ssh ' + options["-l"] + "@" + options["-a"] + " -i " + options["-k"])
+			result = conn.log_expect(options, [ options["-c"], "Are you sure you want to continue connecting (yes/no)?", "Enter passphrase for key '"+options["-k"]+"':" ], LOGIN_TIMEOUT)
+			if result == 1:
+				conn.sendline("yes")
+				conn.log_expect(options, [ options["-c"], "Enter passphrase for key '"+options["-k"]+"':"] , SHELL_TIMEOUT)
+			if result != 0:
+				if options.has_key("-p"):
+					conn.sendline(options["-p"])
+					conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
+				else:
+					fail_usage("Failed: You have to enter passphrase (-p) for identity file")
 		else:
 			conn = fspawn ('telnet ' + options["-a"])
 			conn.log_expect(options, re_login, LOGIN_TIMEOUT)


hooks/post-receive
--
Cluster Project


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]