This file is indexed.

/usr/sbin/fence_ilo is in fence-agents 4.0.22-2.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#!/usr/bin/python -tt

#####
##
## The Following Agent Has Been Tested On:
##
##  iLO Version
## +---------------------------------------------+
##  iLO  / firmware 1.91 / RIBCL 2.22
##  iLO2 / firmware 1.22 / RIBCL 2.22
##  iLO2 / firmware 1.50 / RIBCL 2.22
#####

import sys, re, pexpect
import atexit
from xml.sax.saxutils import quoteattr
sys.path.append("/usr/share/fence")
from fencing import *
from fencing import fail, EC_LOGIN_DENIED

#BEGIN_VERSION_GENERATION
RELEASE_VERSION="4.0.22"
BUILD_DATE="(built Sat, 06 Feb 2016 12:34:18 +0100)"
REDHAT_COPYRIGHT="Copyright (C) Red Hat, Inc. 2004-2010 All rights reserved."
#END_VERSION_GENERATION

def get_power_status(conn, options):
	conn.send("<LOGIN USER_LOGIN = " + quoteattr(options["--username"]) + \
		" PASSWORD = " + quoteattr(options["--password"]) + ">\r\n")
	conn.send("<SERVER_INFO MODE = \"read\"><GET_HOST_POWER_STATUS/>\r\n")
	conn.send("</SERVER_INFO></LOGIN>\r\n")
	conn.log_expect("HOST_POWER=\"(.*?)\"", int(options["--power-timeout"]))

	status = conn.match.group(1)
	return status.lower().strip()

def set_power_status(conn, options):
	conn.send("<LOGIN USER_LOGIN = " + quoteattr(options["--username"]) + \
		" PASSWORD = " + quoteattr(options["--password"]) + ">\r\n")
	conn.send("<SERVER_INFO MODE = \"write\">")

	if options.get("fw_processor", None) == "iLO2":
		if options["fw_version"] > 1.29:
			conn.send("<HOLD_PWR_BTN TOGGLE=\"yes\" />\r\n")
		else:
			conn.send("<HOLD_PWR_BTN />\r\n")
	elif options["--ribcl-version"] < 2.21:
		conn.send("<SET_HOST_POWER HOST_POWER = \"" + options["--action"] + "\" />\r\n")
	else:
		if options["--action"] == "off":
			conn.send("<HOLD_PWR_BTN/>\r\n")
		else:
			conn.send("<PRESS_PWR_BTN/>\r\n")
	conn.send("</SERVER_INFO></LOGIN>\r\n")

	return

def define_new_opts():
	all_opt["ribcl"] = {
		"getopt" : "r:",
		"longopt" : "ribcl-version",
		"help" : "-r, --ribcl-version=[version]  Force ribcl version to use",
		"required" : "0",
		"shortdesc" : "Force ribcl version to use",
		"order" : 1}

def main():
	device_opt = ["ipaddr", "login", "passwd", "ssl", "notls", "tls1.0", "ribcl"]

	atexit.register(atexit_handler)

	define_new_opts()

	all_opt["login_timeout"]["default"] = "10"
	all_opt["retry_on"]["default"] = "3"
	all_opt["ssl"]["default"] = "1"

	options = check_input(device_opt, process_input(device_opt))

	docs = {}
	docs["shortdesc"] = "Fence agent for HP iLO"
	docs["longdesc"] = "fence_ilo is an I/O Fencing agent \
used for HP servers with the Integrated Light Out (iLO) PCI card.\
The agent opens an SSL connection to the iLO card. Once the SSL \
connection is established, the agent is able to communicate with \
the iLO card through an XML stream."
	docs["vendorurl"] = "http://www.hp.com"
	docs["symlink"] = [("fence_ilo2", "Fence agent for HP iLO2")]
	show_docs(options, docs)

	##
	## Login and get version number
	####
	conn = fence_login(options)
	try:
		conn.send("<?xml version=\"1.0\"?>\r\n")
		conn.log_expect(["</RIBCL>", "<END_RIBCL/>"], int(options["--login-timeout"]))
	except pexpect.TIMEOUT:
		fail(EC_LOGIN_DENIED)
	except pexpect.EOF:
		if "--tls1.0" in options:
			fail(EC_LOGIN_DENIED)
		options["--tls1.0"] = "1"
		conn.close()
		conn = fence_login(options)
		try:
			conn.send("<?xml version=\"1.0\"?>\r\n")
			conn.log_expect(["</RIBCL>", "<END_RIBCL/>"], int(options["--login-timeout"]))
		except pexpect.TIMEOUT:
			fail(EC_LOGIN_DENIED)
		except pexpect.EOF:
			fail(EC_LOGIN_DENIED)

	try:
		version = re.compile("<RIBCL VERSION=\"(.*?)\"", re.IGNORECASE).search(conn.before).group(1)
		if not options.has_key("--ribcl-version"):
			options["--ribcl-version"] = float(version)

		if options["--ribcl-version"] >= 2:
			conn.send("<RIBCL VERSION=\"2.0\">\r\n")
		else:
			conn.send("<RIBCL VERSION=\"1.2\">\r\n")

		conn.send("<LOGIN USER_LOGIN = " + quoteattr(options["--username"]) + \
			" PASSWORD = " + quoteattr(options["--password"]) + ">\r\n")
		if options["--ribcl-version"] >= 2:
			conn.send("<RIB_INFO MODE=\"read\"><GET_FW_VERSION />\r\n")
			conn.send("</RIB_INFO>\r\n")
			conn.log_expect(r"<GET_FW_VERSION\s*\n", int(options["--shell-timeout"]))
			conn.log_expect("/>", int(options["--shell-timeout"]))
			options["fw_version"] = float(re.compile(r"FIRMWARE_VERSION\s*=\s*\"(.*?)\"",
					re.IGNORECASE).search(conn.before).group(1))
			options["fw_processor"] = re.compile(r"MANAGEMENT_PROCESSOR\s*=\s*\"(.*?)\"",
					re.IGNORECASE).search(conn.before).group(1)
		conn.send("</LOGIN>\r\n")
	except pexpect.TIMEOUT:
		fail(EC_LOGIN_DENIED)
	except pexpect.EOF:
		fail(EC_LOGIN_DENIED)

	##
	## Fence operations
	####
	result = fence_action(conn, options, set_power_status, get_power_status, None)

	sys.exit(result)

if __name__ == "__main__":
	main()