cluster: RHEL58 - fence_rhevm: REST API URL needs to be updated to /api
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 443e1dd7a89a48233f74349de9bd1c14571f2843
Parent: 05fc9d0a0a4baf8ad0da2d3ad27dda526db3b75e
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Mon Aug 29 10:47:36 2011 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Thu Sep 15 13:28:27 2011 +0200
fence_rhevm: REST API URL needs to be updated to /api
Resolves: rhbz#731167
---
fence/agents/rhevm/fence_rhevm.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/fence/agents/rhevm/fence_rhevm.py b/fence/agents/rhevm/fence_rhevm.py
index c9625a2..e420455 100755
--- a/fence/agents/rhevm/fence_rhevm.py
+++ b/fence/agents/rhevm/fence_rhevm.py
@@ -88,7 +88,7 @@ def send_command(opt, command, method = "GET"):
else:
url = "http:"
- url += "//" + opt["-a"] + ":" + str(opt["-u"]) + "/rhevm-api/" + command
+ url += "//" + opt["-a"] + ":" + str(opt["-u"]) + "/api/" + command
## send command through pycurl
c = pycurl.Curl()
12 years, 7 months
cluster: RHEL58 - fence_rhevm: change "UP" status to "up" state as the REST-API has changed
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 05fc9d0a0a4baf8ad0da2d3ad27dda526db3b75e
Parent: 5d43860ce95d3305d0d92bd25f8fcf2e4a60ce1a
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Mon Aug 22 10:02:25 2011 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Thu Sep 15 13:27:55 2011 +0200
fence_rhevm: change "UP" status to "up" state as the REST-API has changed
Resolves: rhbz#731167
---
fence/agents/rhevm/fence_rhevm.py | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/fence/agents/rhevm/fence_rhevm.py b/fence/agents/rhevm/fence_rhevm.py
index 1cb8d00..c9625a2 100755
--- a/fence/agents/rhevm/fence_rhevm.py
+++ b/fence/agents/rhevm/fence_rhevm.py
@@ -12,7 +12,7 @@ BUILD_DATE=""
#END_VERSION_GENERATION
re_get_id = re.compile("<vm id=\"(.*?)\"", re.IGNORECASE);
-re_status = re.compile("<status>(.*?)</status>", re.IGNORECASE);
+re_status = re.compile("<state>(.*?)</state>", re.IGNORECASE);
re_get_name = re.compile("<name>(.*?)</name>", re.IGNORECASE);
def get_power_status(conn, options):
@@ -40,7 +40,7 @@ def get_power_status(conn, options):
else:
status = result.group(1)
- if (status == "UP"):
+ if (status == "up"):
return "on"
else:
return "off"
12 years, 7 months
cluster: RHEL58 - ipmilan: Allow privilege selection
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 5d43860ce95d3305d0d92bd25f8fcf2e4a60ce1a
Parent: 8a4b94c64a858b076de4772e5493efd2fe628b4e
Author: Kristoffer Knigga <kris(a)knigga.com>
AuthorDate: Fri Jul 1 10:16:44 2011 -0400
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Thu Sep 15 13:25:51 2011 +0200
ipmilan: Allow privilege selection
In some cases, it's desirable to limit the rights to an iLO
user in order to mitigate the fact that the login information
is stored as plaintext in the cluster configuration.
Unfortunately, ipmitool and fence_ipmilan do not work in this
configuration.
# /usr/bin/ipmitool -I lanplus -H '10.1.9.40' \
-U 'fence' -P 'fencepost' -v chassis power status
RAKP 2 message indicates an error : unauthorized role requested
Error: Unable to establish IPMI v2 / RMCP+ session
Unable to get Chassis Power Status
It turns out that dialing back the permissions on a user in iLO
changes its privilege level, in this case from administrator to
operator. ipmitool defaults to administrator if nothing is
specified, hence the error. If the correct privilege level is
given to ipmitool the command works:
# /usr/bin/ipmitool -I lanplus -H '10.1.9.40' \
-U 'fence' -L 'OPERATOR' -P 'fencepost' -v chassis power status
Chassis Power is on
This patch adds the 'privlvl' option to fence_ipmilan, allowing
administrators to change the privilege level in the cluster
configuration.
Signed-off-by: Kristoffer Knigga <kris(a)knigga.com>
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
Resolves: rhbz#726731
---
fence/agents/ipmilan/ipmilan.c | 43 +++++++++++++++++++++++++++++++++++----
1 files changed, 38 insertions(+), 5 deletions(-)
diff --git a/fence/agents/ipmilan/ipmilan.c b/fence/agents/ipmilan/ipmilan.c
index b7b4c85..f9d15b1 100644
--- a/fence/agents/ipmilan/ipmilan.c
+++ b/fence/agents/ipmilan/ipmilan.c
@@ -107,6 +107,7 @@ struct ipmi {
char *i_user;
char *i_authtype;
char *i_password;
+ char *i_privlvl;
int i_rdfd;
int i_wrfd;
pid_t i_pid;
@@ -205,6 +206,7 @@ struct xml_parameter_s xml_parameters[]={
{"method","-M",0,"string",DEFAULT_METHOD,"Method to fence (onoff or cycle)"},
{"power_wait","-T",0,"string","2","Wait X seconds after on/off operation"},
{"delay","-f",0,"string",NULL,"Wait X seconds before fencing is started"},
+ {"privlvl","-L",0,"string",NULL,"Privilege level on IPMI device"},
{"verbose","-v",0,"boolean",NULL,"Verbose mode"}};
/*
@@ -301,6 +303,11 @@ build_cmd(char *command, size_t cmdlen, struct ipmi *ipmi, int op)
strncat(cmd, arg, sizeof(cmd) - strlen(arg));
}
+ if (ipmi->i_privlvl) {
+ snprintf(arg, sizeof(arg), " -L %s", str_prepare_for_sh(tmp,ipmi->i_privlvl,sizeof(tmp)));
+ strncat(cmd, arg, sizeof(cmd) - strlen(arg));
+ }
+
if (ipmi->i_cipher>=0) {
snprintf(arg, sizeof(arg), " -C %d", ipmi->i_cipher);
strncat(cmd, arg, sizeof(cmd) - strlen(arg));
@@ -589,6 +596,10 @@ ipmi_destroy(struct ipmi *i)
free(i->i_host);
i->i_host = NULL;
}
+ if (i->i_privlvl) {
+ free(i->i_privlvl);
+ i->i_privlvl = NULL;
+ }
i->i_config = 0;
i->i_id = NOTIPMI;
}
@@ -602,7 +613,7 @@ static struct ipmi *
ipmi_init(struct ipmi *i, char *host, char *authtype,
char *user, char *password, int lanplus, int verbose,int timeout,
int power_wait,
- int cipher)
+ int cipher, char *privlvl)
{
const char *p;
@@ -652,6 +663,10 @@ ipmi_init(struct ipmi *i, char *host, char *authtype,
} else
i->i_authtype = NULL;
+ if (privlvl && strlen(privlvl)) {
+ i->i_privlvl = strdup(privlvl);
+ } else
+ i->i_privlvl = NULL;
if (user && strlen(user)) {
i->i_user= strdup(user);
@@ -963,7 +978,8 @@ get_options_stdin(char *ip, size_t iplen,
int *lanplus, int *verbose,int *timeout,
int *power_wait,
int *cipher, char *method, int methodlen,
- char *delay, size_t delaylen)
+ char *delay, size_t delaylen,
+ char *privlvl, size_t privlen)
{
char in[256];
int line = 0;
@@ -1018,6 +1034,11 @@ get_options_stdin(char *ip, size_t iplen,
pwd_script[pwd_script_len - 1] = '\0';
} else
pwd_script[0] = '\0';
+ } else if (!strcasecmp(name, "privlvl")) {
+ if (val) {
+ strncpy(privlvl, val, privlen);
+ } else
+ privlvl[0] = '\0';
} else if (!strcasecmp(name, "user") || !strcasecmp(name, "login")) {
/* username */
if (val)
@@ -1082,6 +1103,8 @@ printf(" -P Use Lanplus\n");
printf(" -S <path> Script to retrieve password (if required)\n");
printf(" -l <login> Username/Login (if required) to control power\n"
" on IPMI device\n");
+printf(" -L <privlvl> IPMI privilege level. Defaults to ADMINISTRATOR.\n"
+ " See ipmitool(1) for more info.\n");
printf(" -o <op> Operation to perform.\n");
printf(" Valid operations: on, off, reboot, status,\n");
printf(" diag, list or monitor\n");
@@ -1108,6 +1131,7 @@ printf(" timeout=<timeout> Same as -t\n");
printf(" power_wait=<time> Same as -T\n");
printf(" cipher=<cipher> Same as -C\n");
printf(" method=<method> Same as -M\n");
+printf(" privlvl=<privlvl> Same as -L\n");
printf(" verbose Same as -v\n\n");
exit(1);
}
@@ -1170,6 +1194,7 @@ main(int argc, char **argv)
char passwd[64];
char user[64];
char op[64];
+ char privlvl[64];
char method[64];
char delay[64];
char pwd_script[PATH_MAX] = { 0, };
@@ -1188,6 +1213,7 @@ main(int argc, char **argv)
memset(passwd, 0, sizeof(passwd));
memset(user, 0, sizeof(user));
memset(op, 0, sizeof(op));
+ memset(privlvl, 0, sizeof(privlvl));
memset(method, 0, sizeof(method));
memset(delay, 0, sizeof(delay));
@@ -1195,12 +1221,18 @@ main(int argc, char **argv)
/*
Parse command line options if any were specified
*/
- while ((opt = getopt(argc, argv, "A:a:i:l:p:S:Po:vV?hHt:T:C:M:f:")) != EOF) {
+ while ((opt = getopt(argc, argv, "A:a:i:l:p:S:Po:vV?hHt:T:C:M:f:L:")) != EOF) {
switch(opt) {
case 'A':
/* Auth type */
strncpy(authtype, optarg, sizeof(authtype));
break;
+ case 'L':
+ /* Privilege level - ipmitool defaults
+ * to ADMINISTRATOR if nothing is given
+ */
+ strncpy(privlvl, optarg, sizeof(privlvl));
+ break;
case 'a':
case 'i':
/* IP address */
@@ -1277,7 +1309,8 @@ main(int argc, char **argv)
op, sizeof(op), &lanplus, &verbose,&timeout,
&down_sleep,
&cipher, method, sizeof(method),
- delay, sizeof(delay)) != 0)
+ delay, sizeof(delay),
+ privlvl, sizeof(privlvl)) != 0)
return 1;
}
@@ -1356,7 +1389,7 @@ main(int argc, char **argv)
}
/* Ok, set up the IPMI struct */
- i = ipmi_init(NULL, ip, authtype, user, passwd, lanplus, verbose, timeout, down_sleep, cipher);
+ i = ipmi_init(NULL, ip, authtype, user, passwd, lanplus, verbose, timeout, down_sleep, cipher, privlvl);
if (!i)
fail_exit("Failed to initialize\n");
12 years, 7 months
fence-agents: RHEL6 - ipmilan: Allow privilege selection
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/fence-agents.git?p=fence-agents.git;a=com...
Commit: df491093a86637ae67cacf3dcd4b2b24f1716019
Parent: 09e9ff80011cc2ca685d9f64c54b97864802bdcf
Author: Kristoffer Knigga <kris(a)knigga.com>
AuthorDate: Fri Jul 1 10:16:44 2011 -0400
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Thu Sep 15 12:42:37 2011 +0200
ipmilan: Allow privilege selection
In some cases, it's desirable to limit the rights to an iLO
user in order to mitigate the fact that the login information
is stored as plaintext in the cluster configuration.
Unfortunately, ipmitool and fence_ipmilan do not work in this
configuration.
# /usr/bin/ipmitool -I lanplus -H '10.1.9.40' \
-U 'fence' -P 'fencepost' -v chassis power status
RAKP 2 message indicates an error : unauthorized role requested
Error: Unable to establish IPMI v2 / RMCP+ session
Unable to get Chassis Power Status
It turns out that dialing back the permissions on a user in iLO
changes its privilege level, in this case from administrator to
operator. ipmitool defaults to administrator if nothing is
specified, hence the error. If the correct privilege level is
given to ipmitool the command works:
# /usr/bin/ipmitool -I lanplus -H '10.1.9.40' \
-U 'fence' -L 'OPERATOR' -P 'fencepost' -v chassis power status
Chassis Power is on
This patch adds the 'privlvl' option to fence_ipmilan, allowing
administrators to change the privilege level in the cluster
configuration.
Signed-off-by: Kristoffer Knigga <kris(a)knigga.com>
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
Resolves: rhbz#726571
---
fence/agents/ipmilan/ipmilan.c | 43 +++++++++++++++++++++++++++++++++++----
1 files changed, 38 insertions(+), 5 deletions(-)
diff --git a/fence/agents/ipmilan/ipmilan.c b/fence/agents/ipmilan/ipmilan.c
index 4e2862c..b6fc193 100644
--- a/fence/agents/ipmilan/ipmilan.c
+++ b/fence/agents/ipmilan/ipmilan.c
@@ -76,6 +76,7 @@ struct ipmi {
char *i_user;
char *i_authtype;
char *i_password;
+ char *i_privlvl;
int i_rdfd;
int i_wrfd;
pid_t i_pid;
@@ -174,6 +175,7 @@ struct xml_parameter_s xml_parameters[]={
{"method","-M",0,"string",DEFAULT_METHOD,"Method to fence (onoff or cycle)"},
{"power_wait","-T",0,"string","2","Wait X seconds after on/off operation"},
{"delay","-f",0,"string",NULL,"Wait X seconds before fencing is started"},
+ {"privlvl","-L",0,"string",NULL,"Privilege level on IPMI device"},
{"verbose","-v",0,"boolean",NULL,"Verbose mode"}};
/*
@@ -270,6 +272,11 @@ build_cmd(char *command, size_t cmdlen, struct ipmi *ipmi, int op, int nopass)
strncat(cmd, arg, sizeof(cmd) - strlen(arg));
}
+ if (ipmi->i_privlvl) {
+ snprintf(arg, sizeof(arg), " -L %s", str_prepare_for_sh(tmp,ipmi->i_privlvl,sizeof(tmp)));
+ strncat(cmd, arg, sizeof(cmd) - strlen(arg));
+ }
+
if (ipmi->i_cipher>=0) {
snprintf(arg, sizeof(arg), " -C %d", ipmi->i_cipher);
strncat(cmd, arg, sizeof(cmd) - strlen(arg));
@@ -569,6 +576,10 @@ ipmi_destroy(struct ipmi *i)
free(i->i_host);
i->i_host = NULL;
}
+ if (i->i_privlvl) {
+ free(i->i_privlvl);
+ i->i_privlvl = NULL;
+ }
i->i_config = 0;
i->i_id = NOTIPMI;
}
@@ -582,7 +593,7 @@ static struct ipmi *
ipmi_init(struct ipmi *i, char *host, char *authtype,
char *user, char *password, int lanplus, int verbose,int timeout,
int power_wait,
- int cipher)
+ int cipher, char *privlvl)
{
const char *p;
@@ -632,6 +643,10 @@ ipmi_init(struct ipmi *i, char *host, char *authtype,
} else
i->i_authtype = NULL;
+ if (privlvl && strlen(privlvl)) {
+ i->i_privlvl = strdup(privlvl);
+ } else
+ i->i_privlvl = NULL;
if (user && strlen(user)) {
i->i_user= strdup(user);
@@ -721,7 +736,8 @@ get_options_stdin(char *ip, size_t iplen,
int *lanplus, int *verbose,int *timeout,
int *power_wait,
int *cipher, char *method, int methodlen,
- char *delay, size_t delaylen)
+ char *delay, size_t delaylen,
+ char *privlvl, size_t privlen)
{
char in[256];
int line = 0;
@@ -776,6 +792,11 @@ get_options_stdin(char *ip, size_t iplen,
pwd_script[pwd_script_len - 1] = '\0';
} else
pwd_script[0] = '\0';
+ } else if (!strcasecmp(name, "privlvl")) {
+ if (val) {
+ strncpy(privlvl, val, privlen);
+ } else
+ privlvl[0] = '\0';
} else if (!strcasecmp(name, "user") || !strcasecmp(name, "login")) {
/* username */
if (val)
@@ -840,6 +861,8 @@ printf(" -P Use Lanplus\n");
printf(" -S <path> Script to retrieve password (if required)\n");
printf(" -l <login> Username/Login (if required) to control power\n"
" on IPMI device\n");
+printf(" -L <privlvl> IPMI privilege level. Defaults to ADMINISTRATOR.\n"
+ " See ipmitool(1) for more info.\n");
printf(" -o <op> Operation to perform.\n");
printf(" Valid operations: on, off, reboot, status,\n");
printf(" diag, list or monitor\n");
@@ -866,6 +889,7 @@ printf(" timeout=<timeout> Same as -t\n");
printf(" power_wait=<time> Same as -T\n");
printf(" cipher=<cipher> Same as -C\n");
printf(" method=<method> Same as -M\n");
+printf(" privlvl=<privlvl> Same as -L\n");
printf(" verbose Same as -v\n\n");
exit(1);
}
@@ -928,6 +952,7 @@ main(int argc, char **argv)
char passwd[64];
char user[64];
char op[64];
+ char privlvl[64];
char method[64];
char delay[64];
char pwd_script[PATH_MAX] = { 0, };
@@ -946,6 +971,7 @@ main(int argc, char **argv)
memset(passwd, 0, sizeof(passwd));
memset(user, 0, sizeof(user));
memset(op, 0, sizeof(op));
+ memset(privlvl, 0, sizeof(privlvl));
memset(method, 0, sizeof(method));
memset(delay, 0, sizeof(delay));
@@ -953,12 +979,18 @@ main(int argc, char **argv)
/*
Parse command line options if any were specified
*/
- while ((opt = getopt(argc, argv, "A:a:i:l:p:S:Po:vV?hHt:T:C:M:f:")) != EOF) {
+ while ((opt = getopt(argc, argv, "A:a:i:l:p:S:Po:vV?hHt:T:C:M:f:L:")) != EOF) {
switch(opt) {
case 'A':
/* Auth type */
strncpy(authtype, optarg, sizeof(authtype));
break;
+ case 'L':
+ /* Privilege level - ipmitool defaults
+ * to ADMINISTRATOR if nothing is given
+ */
+ strncpy(privlvl, optarg, sizeof(privlvl));
+ break;
case 'a':
case 'i':
/* IP address */
@@ -1035,7 +1067,8 @@ main(int argc, char **argv)
op, sizeof(op), &lanplus, &verbose,&timeout,
&down_sleep,
&cipher, method, sizeof(method),
- delay, sizeof(delay)) != 0)
+ delay, sizeof(delay),
+ privlvl, sizeof(privlvl)) != 0)
return 1;
}
@@ -1114,7 +1147,7 @@ main(int argc, char **argv)
}
/* Ok, set up the IPMI struct */
- i = ipmi_init(NULL, ip, authtype, user, passwd, lanplus, verbose, timeout, down_sleep, cipher);
+ i = ipmi_init(NULL, ip, authtype, user, passwd, lanplus, verbose, timeout, down_sleep, cipher, privlvl);
if (!i)
fail_exit("Failed to initialize\n");
12 years, 7 months
fence-agents: RHEL6 - fence_ipmilan: fence_ipmilan exposes user password on verbose mode
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/fence-agents.git?p=fence-agents.git;a=com...
Commit: 09e9ff80011cc2ca685d9f64c54b97864802bdcf
Parent: c6b07346bf6ba78b43826ee777849495b3d13180
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Thu Sep 15 12:31:09 2011 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Thu Sep 15 12:33:37 2011 +0200
fence_ipmilan: fence_ipmilan exposes user password on verbose mode
In verbose mode password is replaced by '[set]'
Resolves: rhbz#732372
---
fence/agents/ipmilan/ipmilan.c | 27 +++++++++++++++++++--------
1 files changed, 19 insertions(+), 8 deletions(-)
diff --git a/fence/agents/ipmilan/ipmilan.c b/fence/agents/ipmilan/ipmilan.c
index c4dbd2d..4e2862c 100644
--- a/fence/agents/ipmilan/ipmilan.c
+++ b/fence/agents/ipmilan/ipmilan.c
@@ -243,7 +243,7 @@ static char *str_prepare_for_sh(char *dest,char *source,int max_len) {
}
static int
-build_cmd(char *command, size_t cmdlen, struct ipmi *ipmi, int op)
+build_cmd(char *command, size_t cmdlen, struct ipmi *ipmi, int op, int nopass)
{
char cmd[2048];
char arg[2048];
@@ -276,7 +276,11 @@ build_cmd(char *command, size_t cmdlen, struct ipmi *ipmi, int op)
}
if (ipmi->i_password) {
- snprintf(arg, sizeof(arg), " -P %s", str_prepare_for_sh(tmp,ipmi->i_password,sizeof(tmp)));
+ if (nopass) {
+ snprintf(arg, sizeof(arg), " -P %s", str_prepare_for_sh(tmp,(char *)"[set]",sizeof(tmp)));
+ } else {
+ snprintf(arg, sizeof(arg), " -P %s", str_prepare_for_sh(tmp,ipmi->i_password,sizeof(tmp)));
+ }
strncat(cmd, arg, sizeof(cmd) - strlen(arg));
} else {
snprintf(arg, sizeof(arg), " -P ''");
@@ -319,9 +323,9 @@ build_cmd(char *command, size_t cmdlen, struct ipmi *ipmi, int op)
static int
-ipmi_spawn(struct ipmi *ipmi, const char *cmd)
+ipmi_spawn(struct ipmi *ipmi, const char *cmd, const char *cmd_print)
{
- dbg_printf(ipmi, 1, "Spawning: '%s'...\n", cmd);
+ dbg_printf(ipmi, 1, "Spawning: '%s'...\n", cmd_print);
if (!ipmi) {
errno = EINVAL;
return -1;
@@ -337,8 +341,8 @@ ipmi_spawn(struct ipmi *ipmi, const char *cmd)
if ((ipmi->i_pid = StartProcess(cmd, &ipmi->i_rdfd,
&ipmi->i_wrfd,
EXP_STDERR|EXP_NOCTTY)) >= 0) {
- dbg_printf(ipmi, 2, "Spawned: '%s' - PID %d\n", cmd,
- (int)ipmi->i_pid);
+ dbg_printf(ipmi, 2, "Spawned: '%s' - PID %d\n",
+ cmd_print, (int)ipmi->i_pid);
return 0;
}
return -1;
@@ -398,11 +402,18 @@ static int
ipmi_op(struct ipmi *ipmi, int op, struct Etoken *toklist)
{
char cmd[2048];
+ char cmd_nopass[2048];
+ char *cmd_print = cmd;
int ret;
- build_cmd(cmd, sizeof(cmd), ipmi, op);
+ build_cmd(cmd, sizeof(cmd), ipmi, op, 0);
+ if (ipmi->i_verbose >= 1 && ipmi->i_password) {
+ build_cmd(cmd_nopass, sizeof(cmd_nopass),
+ ipmi, op, 1);
+ cmd_print = cmd_nopass;
+ }
- if (ipmi_spawn(ipmi, cmd) != 0)
+ if (ipmi_spawn(ipmi, cmd, cmd_print) != 0)
return -1;
ret = ipmi_expect(ipmi, toklist, ipmi->i_timeout);
ipmi_reap(ipmi);
12 years, 7 months
fence-agents: master - fence_ipmilan: fence_ipmilan exposes user password on verbose mode
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/fence-agents.git?p=fence-agents.git;a=com...
Commit: 61a7bb3addd3862833f5cf23725d378c563a10c5
Parent: 5e12971ad0bece6485c583d79ba84804f5c71163
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Thu Sep 15 12:31:09 2011 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Thu Sep 15 12:31:09 2011 +0200
fence_ipmilan: fence_ipmilan exposes user password on verbose mode
In verbose mode password is replaced by '[set]'
Resolves: rhbz#732372
---
fence/agents/ipmilan/ipmilan.c | 27 +++++++++++++++++++--------
1 files changed, 19 insertions(+), 8 deletions(-)
diff --git a/fence/agents/ipmilan/ipmilan.c b/fence/agents/ipmilan/ipmilan.c
index 35130ad..b6fc193 100644
--- a/fence/agents/ipmilan/ipmilan.c
+++ b/fence/agents/ipmilan/ipmilan.c
@@ -245,7 +245,7 @@ static char *str_prepare_for_sh(char *dest,char *source,int max_len) {
}
static int
-build_cmd(char *command, size_t cmdlen, struct ipmi *ipmi, int op)
+build_cmd(char *command, size_t cmdlen, struct ipmi *ipmi, int op, int nopass)
{
char cmd[2048];
char arg[2048];
@@ -283,7 +283,11 @@ build_cmd(char *command, size_t cmdlen, struct ipmi *ipmi, int op)
}
if (ipmi->i_password) {
- snprintf(arg, sizeof(arg), " -P %s", str_prepare_for_sh(tmp,ipmi->i_password,sizeof(tmp)));
+ if (nopass) {
+ snprintf(arg, sizeof(arg), " -P %s", str_prepare_for_sh(tmp,(char *)"[set]",sizeof(tmp)));
+ } else {
+ snprintf(arg, sizeof(arg), " -P %s", str_prepare_for_sh(tmp,ipmi->i_password,sizeof(tmp)));
+ }
strncat(cmd, arg, sizeof(cmd) - strlen(arg));
} else {
snprintf(arg, sizeof(arg), " -P ''");
@@ -326,9 +330,9 @@ build_cmd(char *command, size_t cmdlen, struct ipmi *ipmi, int op)
static int
-ipmi_spawn(struct ipmi *ipmi, const char *cmd)
+ipmi_spawn(struct ipmi *ipmi, const char *cmd, const char *cmd_print)
{
- dbg_printf(ipmi, 1, "Spawning: '%s'...\n", cmd);
+ dbg_printf(ipmi, 1, "Spawning: '%s'...\n", cmd_print);
if (!ipmi) {
errno = EINVAL;
return -1;
@@ -344,8 +348,8 @@ ipmi_spawn(struct ipmi *ipmi, const char *cmd)
if ((ipmi->i_pid = StartProcess(cmd, &ipmi->i_rdfd,
&ipmi->i_wrfd,
EXP_STDERR|EXP_NOCTTY)) >= 0) {
- dbg_printf(ipmi, 2, "Spawned: '%s' - PID %d\n", cmd,
- (int)ipmi->i_pid);
+ dbg_printf(ipmi, 2, "Spawned: '%s' - PID %d\n",
+ cmd_print, (int)ipmi->i_pid);
return 0;
}
return -1;
@@ -405,11 +409,18 @@ static int
ipmi_op(struct ipmi *ipmi, int op, struct Etoken *toklist)
{
char cmd[2048];
+ char cmd_nopass[2048];
+ char *cmd_print = cmd;
int ret;
- build_cmd(cmd, sizeof(cmd), ipmi, op);
+ build_cmd(cmd, sizeof(cmd), ipmi, op, 0);
+ if (ipmi->i_verbose >= 1 && ipmi->i_password) {
+ build_cmd(cmd_nopass, sizeof(cmd_nopass),
+ ipmi, op, 1);
+ cmd_print = cmd_nopass;
+ }
- if (ipmi_spawn(ipmi, cmd) != 0)
+ if (ipmi_spawn(ipmi, cmd, cmd_print) != 0)
return -1;
ret = ipmi_expect(ipmi, toklist, ipmi->i_timeout);
ipmi_reap(ipmi);
12 years, 7 months
cluster: RHEL58 - fence_drac5: drac5 firmware does not close ssh session correctly
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 8a4b94c64a858b076de4772e5493efd2fe628b4e
Parent: 787770656ed17759a11c824016ff07ecb992ffff
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Thu Sep 15 10:54:24 2011 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Thu Sep 15 10:54:24 2011 +0200
fence_drac5: drac5 firmware does not close ssh session correctly
Attempt to close connection right after sending 'exit' command does
not close session correctly.
Resolves: rhbz#718924
---
fence/agents/drac/fence_drac5.py | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/fence/agents/drac/fence_drac5.py b/fence/agents/drac/fence_drac5.py
index fc42f89..23cd7ca 100755
--- a/fence/agents/drac/fence_drac5.py
+++ b/fence/agents/drac/fence_drac5.py
@@ -12,7 +12,7 @@
## @note: drac_version was removed
#####
-import sys, re, pexpect, exceptions
+import sys, re, pexpect, exceptions, time
sys.path.append("/usr/lib/fence")
from fencing import *
@@ -134,6 +134,7 @@ By default, the telnet interface is not enabled."
######
try:
conn.sendline("exit")
+ time.sleep(1)
conn.close()
except exceptions.OSError:
pass
12 years, 7 months
cluster: RHEL58 - fence_drac5: Incorrect output of 'list' operation on Drac 5
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 787770656ed17759a11c824016ff07ecb992ffff
Parent: a322f4f709a1ac80a8cfb8b2a4c66aea5cd27a66
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Fri Jul 8 09:54:42 2011 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Thu Sep 15 10:50:21 2011 +0200
fence_drac5: Incorrect output of 'list' operation on Drac 5
Previously (due to other bug) fence agents operation 'list' was not
working properly. After fixing that issue, drac5 returned empty line
instead of N/A as an output for 'list'. This happends because fencing
library does not have support for situations when for one fence agents
there are fence devices that supports / not supports 'list' option.
Resolves: rhbz#718194 (regression introduced by previous patch)
---
fence/agents/drac/fence_drac5.py | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/fence/agents/drac/fence_drac5.py b/fence/agents/drac/fence_drac5.py
index a1398b1..fc42f89 100755
--- a/fence/agents/drac/fence_drac5.py
+++ b/fence/agents/drac/fence_drac5.py
@@ -72,6 +72,10 @@ def get_list_devices(conn, options):
outlets[list_re.search(line).group(1)] = ("", list_re.search(line).group(2))
elif options["model"] == "DRAC 5":
## DRAC 5 can be used only for one computer
+ ## standard fence library can't handle correctly situation
+ ## when some fence devices supported by fence agent
+ ## works with 'list' and other should returns 'N/A'
+ print "N/A"
pass
except pexpect.EOF:
fail(EC_CONNECTION_LOST)
12 years, 7 months
cluster: RHEL58 - fence_drac5: Fix support for Dell DRAC CMC
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: a322f4f709a1ac80a8cfb8b2a4c66aea5cd27a66
Parent: beb2677e0fd466058c3afb12de091d864a1e6126
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Fri Jul 1 13:10:37 2011 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Thu Sep 15 10:49:42 2011 +0200
fence_drac5: Fix support for Dell DRAC CMC
Fix operation 'list' for Drac CMC and typo that causes python traceback
Resolves: rhbz#718194
---
fence/agents/drac/fence_drac5.py | 4 ++--
fence/agents/lib/fencing.py.py | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/fence/agents/drac/fence_drac5.py b/fence/agents/drac/fence_drac5.py
index ab02b21..a1398b1 100755
--- a/fence/agents/drac/fence_drac5.py
+++ b/fence/agents/drac/fence_drac5.py
@@ -66,10 +66,10 @@ def get_list_devices(conn, options):
conn.sendline("getmodinfo")
list_re = re.compile("^([^\s]*?)\s+Present\s*(ON|OFF)\s*.*$")
+ conn.log_expect(options, options["-c"], int(options["-g"]))
for line in conn.before.splitlines():
if (list_re.search(line)):
outlets[list_re.search(line).group(1)] = ("", list_re.search(line).group(2))
- conn.log_expect(options, options["-c"], int(options["-g"]))
elif options["model"] == "DRAC 5":
## DRAC 5 can be used only for one computer
pass
@@ -113,7 +113,7 @@ By default, the telnet interface is not enabled."
conn = fence_login(options)
if conn.before.find("CMC") >= 0:
- if 0 == options.has_key("-m") and 0 == ["monitor", "list"].count(option["-o"].lower()):
+ if 0 == options.has_key("-m") and 0 == ["monitor", "list"].count(options["-o"].lower()):
fail_usage("Failed: You have to enter module name (-m)")
options["model"]="DRAC CMC"
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index 61c23af..1ff51a4 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -764,7 +764,7 @@ def fence_action(tn, options, set_power_fn, get_power_fn, get_outlet_list = None
## Process options that manipulate fencing device
#####
- if (options["-o"] == "list") and (0 == options["device_opt"].count("port")) and (0 == options["device_opt"].count("partition") and 0 == options["device_opt"].count("uuid")):
+ if (options["-o"] == "list") and (0 == options["device_opt"].count("port")) and (0 == options["device_opt"].count("partition") and 0 == options["device_opt"].count("uuid") and 0 == options["device_opt"].count("module_name")):
print "N/A"
return
elif (options["-o"] == "list" and get_outlet_list == None):
12 years, 7 months
cluster: RHEL58 - fence_bladecenter: Reboot operation did not work correctly with --missing-as-off
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: beb2677e0fd466058c3afb12de091d864a1e6126
Parent: 6689362008847088660603c7a041968fb33b50be
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Thu May 26 18:00:54 2011 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Thu Sep 15 10:48:59 2011 +0200
fence_bladecenter: Reboot operation did not work correctly with --missing-as-off
This patch adds a correct handling of situation where prompt was not changed
as expected (means blade is not available)
Resolves: rhbz#689851
---
fence/agents/bladecenter/fence_bladecenter.py | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/fence/agents/bladecenter/fence_bladecenter.py b/fence/agents/bladecenter/fence_bladecenter.py
index b4f7eb9..ac65f65 100755
--- a/fence/agents/bladecenter/fence_bladecenter.py
+++ b/fence/agents/bladecenter/fence_bladecenter.py
@@ -57,7 +57,14 @@ def set_power_status(conn, options):
node_cmd = "system:blade\[" + options["-n"] + "\]>"
conn.send("env -T system:blade[" + options["-n"] + "]\r\n")
- conn.log_expect(options, node_cmd, int(options["-Y"]))
+ i = conn.log_expect(options, [ node_cmd, "system>" ] , int(options["-Y"]))
+ if i == 1:
+ ## Given blade number does not exist
+ if options.has_key("-M"):
+ return
+ else:
+ fail(EC_GENERIC_ERROR)
+
conn.send("power -"+options["-o"]+"\r\n")
conn.log_expect(options, node_cmd, int(options["-Y"]))
conn.send("env -T system\r\n")
12 years, 7 months