Jan Safranek/Jose Plans patch to add new -Y option to prompt user to enter kgkey

This commit is contained in:
Carol Hebert 2009-03-16 19:15:17 +00:00
parent 96df77742c
commit afbec90dc2
2 changed files with 25 additions and 2 deletions

View File

@ -26,7 +26,7 @@ ipmitool [\fB\-c\fR|\fB\-h\fR|\fB\-v\fR|\fB\-V\fR]
[\fB\-o\fR <\fIoemtype\fP>] [\fB\-o\fR <\fIoemtype\fP>]
[\fB\-O\fR <\fIsel oem\fP>] [\fB\-O\fR <\fIsel oem\fP>]
[\fB\-C\fR <\fIciphersuite\fP>] [\fB\-C\fR <\fIciphersuite\fP>]
[\fB\-K\fR|\fB\-k\fR <\fIkg_key\fP>] [\fB\-Y\fR|[\fB\-K\fR|\fB\-k\fR <\fIkg_key\fP>]
[\fB\-y\fR <\fIhex_kg_key\fP>] [\fB\-y\fR <\fIhex_kg_key\fP>]
[\fB\-e\fR <\fIesc_char\fP>] [\fB\-e\fR <\fIesc_char\fP>]
<\fIcommand\fP> <\fIcommand\fP>
@ -62,6 +62,9 @@ This is not available with all commands.
Use supplied character for SOL session escape character. The default Use supplied character for SOL session escape character. The default
is to use \fI~\fP but this can conflict with ssh sessions. is to use \fI~\fP but this can conflict with ssh sessions.
.TP .TP
\fB\-K\fR
Read Kg key from IPMI_KGKEY environment variable.
.TP
\fB\-k\fR <\fIkey\fP> \fB\-k\fR <\fIkey\fP>
Use supplied Kg key for IPMIv2 authentication. The default is not to Use supplied Kg key for IPMIv2 authentication. The default is not to
use any Kg key. use any Kg key.
@ -72,6 +75,9 @@ hexadecimal format and can be used to specify keys with non-printable
characters. E.g. '-k PASSWORD' and '-y 50415353574F5244' are characters. E.g. '-k PASSWORD' and '-y 50415353574F5244' are
equivalent. equivalent.
The default is not to use any Kg key. The default is not to use any Kg key.
.TP
\fB\-Y\fR
Prompt for the Kg key for IPMIv2 authentication.
.TP .TP
\fB\-C\fR <\fIciphersuite\fP> \fB\-C\fR <\fIciphersuite\fP>
The remote server authentication, integrity, and encryption algorithms The remote server authentication, integrity, and encryption algorithms

View File

@ -73,7 +73,7 @@
#endif #endif
#ifdef ENABLE_ALL_OPTIONS #ifdef ENABLE_ALL_OPTIONS
# define OPTION_STRING "I:hVvcgsEKao:H:d:P:f:U:p:C:L:A:t:T:m:S:l:b:B:e:k:y:O:" # define OPTION_STRING "I:hVvcgsEKYao:H:d:P:f:U:p:C:L:A:t:T:m:S:l:b:B:e:k:y:O:"
#else #else
# define OPTION_STRING "I:hVvcH:f:U:p:d:S:" # define OPTION_STRING "I:hVvcH:f:U:p:d:S:"
#endif #endif
@ -227,6 +227,7 @@ ipmi_option_usage(const char * progname, struct ipmi_cmd * cmdlist, struct ipmi_
lprintf(LOG_NOTICE, " -S sdr Use local file for remote SDR cache"); lprintf(LOG_NOTICE, " -S sdr Use local file for remote SDR cache");
#ifdef ENABLE_ALL_OPTIONS #ifdef ENABLE_ALL_OPTIONS
lprintf(LOG_NOTICE, " -a Prompt for remote password"); lprintf(LOG_NOTICE, " -a Prompt for remote password");
lprintf(LOG_NOTICE, " -Y Prompt for the Kg key for IPMIv2 authentication");
lprintf(LOG_NOTICE, " -e char Set SOL escape character"); lprintf(LOG_NOTICE, " -e char Set SOL escape character");
lprintf(LOG_NOTICE, " -C ciphersuite Cipher suite to be used by lanplus interface"); lprintf(LOG_NOTICE, " -C ciphersuite Cipher suite to be used by lanplus interface");
lprintf(LOG_NOTICE, " -k key Use Kg key for IPMIv2 authentication"); lprintf(LOG_NOTICE, " -k key Use Kg key for IPMIv2 authentication");
@ -470,6 +471,22 @@ ipmi_main(int argc, char ** argv,
goto out_free; goto out_free;
} }
break; break;
case 'Y':
#ifdef HAVE_GETPASSPHRASE
tmp = getpassphrase("Key: ");
#else
tmp = getpass("Key: ");
#endif
if (tmp != NULL) {
if (kgkey)
free(kgkey);
kgkey = strdup(tmp);
if (kgkey == NULL) {
lprintf(LOG_ERR, "%s: malloc failure", progname);
goto out_free;
}
}
break;
case 'U': case 'U':
username = strdup(optarg); username = strdup(optarg);
if (username == NULL) { if (username == NULL) {