2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-29 09:13:08 +00:00

Merge pull request #1771 from zet809/fix_issue_1750

Remove the hardcoded password for FSP
This commit is contained in:
Victor Hu 2016-08-29 22:34:47 -04:00 committed by GitHub
commit c44e760214
6 changed files with 9 additions and 192 deletions

View File

@ -80,16 +80,12 @@ FSP/CEC specific:
=================
\ **rspconfig**\ \ *noderange*\ {\ **autopower | iocap | dev | celogin1 | decfg | memdecfg | procdecfg | time | date | spdump | sysdump | network**\ }
\ **rspconfig**\ \ *noderange*\ {\ **autopower | iocap | decfg | memdecfg | procdecfg | time | date | spdump | sysdump | network**\ }
\ **rspconfig**\ \ *noderange*\ \ **autopower**\ ={\ **enable | disable**\ }
\ **rspconfig**\ \ *noderange*\ \ **iocap**\ ={\ **enable | disable**\ }
\ **rspconfig**\ \ *noderange*\ \ **dev**\ ={\ **enable | disable**\ }
\ **rspconfig**\ \ *noderange*\ \ **celogin1**\ ={\ **enable | disable**\ }
\ **rspconfig**\ \ *noderange*\ \ **time**\ =\ *hh:mm:ss*\
\ **rspconfig**\ \ *noderange*\ \ **date**\ =\ *mm:dd:yyyy*\
@ -142,7 +138,7 @@ BPA/Frame Specific:
===================
\ **rspconfig**\ \ *noderange*\ {\ **network | dev | celogin1**\ }
\ **rspconfig**\ \ *noderange*\ {\ **network**\ }
\ **rspconfig**\ \ *noderange*\ \ **network**\ ={\ **nic,**\ \*}
@ -150,10 +146,6 @@ BPA/Frame Specific:
\ **rspconfig**\ \ *noderange*\ \ **network**\ ={\ **nic,0.0.0.0**\ }
\ **rspconfig**\ \ *noderange*\ \ **dev**\ ={\ **enable | disable**\ }
\ **rspconfig**\ \ *noderange*\ \ **celogin1**\ ={\ **enable | disable**\ }
\ **rspconfig**\ \ *noderange*\ \ **HMC_passwd**\ ={\ *currentpasswd,newpasswd*\ }
\ **rspconfig**\ \ *noderange*\ \ **admin_passwd**\ ={\ *currentpasswd,newpasswd*\ }
@ -255,7 +247,7 @@ DESCRIPTION
\ **rspconfig**\ configures various settings in the nodes' service processors. If only a keyword is
specified, without the \ **=**\ , it displays the current value.
For options \ **autopower | iocap | dev | celogin1 | decfg | memdecfg | procdecfg | time | date | spdump | sysdump | network**\ , user need to use \ *chdef -t site enableASMI=yes*\ to enable ASMI first. For options \ **dev | celogin1**\ , user also need to contact IBM service to get the dynamic password for 'celogin' and put it in passwd table. After completed the command, user should use \ *chdef -t site enableASMI=no*\ to disable ASMI.
For options \ **autopower | iocap | decfg | memdecfg | procdecfg | time | date | spdump | sysdump | network**\ , user need to use \ *chdef -t site enableASMI=yes*\ to enable ASMI first.
*******
@ -396,18 +388,6 @@ OPTIONS
\ **dev**\ ={\ **enable**\ | \ **disable**\ }
Enable or disable the CEC|Frame 'dev' account or display account status if no value specified.
\ **celogin1**\ ={\ **enable**\ | \ **disable**\ }
Enable or disable the CEC|Frame 'celogin1' account or display account status if no value specified.
\ **ip**\
The ip address.

View File

@ -50,9 +50,7 @@ sub parse_args {
"general_passwd",
"*_passwd",
"hostname",
"resetnet",
"dev",
"celogin1"
"resetnet"
);
my @bpa = (
"frame",
@ -63,9 +61,7 @@ sub parse_args {
"general_passwd",
"*_passwd",
"hostname",
"resetnet",
"dev",
"celogin1"
"resetnet"
);
my @ppc = (
"sshcfg"
@ -169,16 +165,6 @@ sub parse_args {
return (usage("No argument specified for '$_'"));
}
}
{
if ($request->{dev} eq '1' && $request->{other} eq '1') {
return (usage("Invalid command arrays"));
}
# my $result = parse_dev_option( $request, \%cmds);
# if ($result) {
# return ( usage($result));
# }
}
####################################
# Return method to invoke
####################################
@ -216,25 +202,6 @@ sub parse_args {
return (\%opt);
}
sub parse_dev_option {
my $req = shift;
my $cmds = shift;
foreach my $cmd (keys %$cmds) {
if ($cmd =~ /^(dev|celogin1)$/) {
if ($cmds->{$cmd} and ($cmds->{$cmd} !~ /^(enable|disable)$/i)) {
return ("Invalid argument " . $cmds->{$cmd} . " for " . $cmd);
}
$req->{dev} = 1;
} else {
$req->{other} = 1;
}
}
if ($req->{dev} eq '1' && $req->{other} eq '1') {
return ("Invalid command arrays");
}
return undef;
}
##########################################################################
# Parse the command line optional arguments
##########################################################################
@ -324,14 +291,6 @@ sub parse_option {
}
}
if ($command eq 'dev' or $command eq 'celogin1') {
if ($value !~ /^(enable|disable)$/i) {
return ("Invalid argument '$value'");
}
$request->{dev} = 1;
} else {
$request->{other} = 1;
}
return undef;
}

View File

@ -38,9 +38,7 @@ my %cmds = (
autopower => [ "Auto Power Restart", \&autopower ],
sysdump => [ "System Dump", \&sysdump ],
spdump => [ "Service Processor Dump", \&spdump ],
network => [ "Network Configuration", \&netcfg ],
dev => [ "Service Processor Command Line", \&devenable ],
celogin1 => [ "Service Processor Command Line", \&ce1enable ] },
network => [ "Network Configuration", \&netcfg ]},
);
@ -216,55 +214,6 @@ sub connect {
}
sub ce1enable {
return &loginenable($_[0], $_[1], $_[2], "celogin1");
}
sub devenable {
return &loginenable($_[0], $_[1], $_[2], "dev");
}
my %cmdline_for_log = (
dev => {
enable => "registry -Hw nets/DevEnabled 1",
disable => "registry -Hw nets/DevEnabled 0",
check_pwd => "registry -l DevPwdFile",
create_pwd => "netsDynPwdTool --create dev FipSdev",
password => "FipSdev"
},
celogin1 => {
enable => "registry -Hw nets/CE1Enabled 1",
disable => "registry -Hw nets/CE1Enabled 0",
check_pwd => "registry -l Ce1PwdFile",
create_pwd => "netsDynPwdTool --create celogin1 FipSce1",
password => "FipSce1"
},
);
sub send_command {
my $ua = shift;
my $server = shift;
my $id = shift;
my $log_name = shift;
my $cmd = shift;
my $cmd_line = $cmdline_for_log{$log_name}{$cmd};
if (!defined($cmd_line)) {
return undef;
}
my $res = $ua->post("https://$server/cgi-bin/cgi",
[ form => $id,
cmd => $cmd_line,
submit => "Execute" ]
);
if (!$res->is_success()) {
return undef;
}
if ($res->content =~ /(not allowed.*\.|Invalid entry)/) {
return undef;
}
return $res->content;
}
sub loginstate {
my $ua = shift;
my $server = shift;
@ -282,55 +231,6 @@ sub loginstate {
}
}
sub loginenable {
my $exp = shift;
my $request = shift;
my $id = shift;
my $log_name = shift;
my $ua = @$exp[0];
my $server = @$exp[1];
my $value = $request->{method}{$log_name};
if (!defined($value)) {
return &loginstate($ua, $server, $log_name);
}
my $url = "https://$server/cgi-bin/cgi?form=$id";
my $res = $ua->get($url);
if (!$res->is_success()) {
return ([ RC_ERROR, $res->status_line ]);
}
$res = &send_command($ua, $server, $id, $log_name, $value);
if (!defined($res)) {
return ([ RC_ERROR, "Send command Failed" ]);
}
if ($value =~ m/^disable$/) {
my $out = sprintf("%9s: Disabled", $log_name);
return ([ SUCCESS, $out ]);
}
#check password#
$res = &send_command($ua, $server, $id, $log_name, "check_pwd");
if (!defined($res)) {
return ([ RC_ERROR, "Send command Failed" ]);
}
my $password = undef;
if ($res =~ m/\[\d+([a-zA-Z]+)\d+\]/) {
$password = $1;
} else {
# create password #
$res = &send_command($ua, $server, $id, $log_name, "create_pwd");
if (!defined($res)) {
return ([ RC_ERROR, "Send command Failed" ]);
}
$password = $cmdline_for_log{$log_name}{password};
print "create password for $log_name is '$cmdline_for_log{$log_name}{password}'\n";
}
my $out = sprintf("%9s: Enabled, password: $password", $log_name);
return ([ SUCCESS, $out ]);
}
sub disconnect {
my $exp = shift;

View File

@ -187,10 +187,6 @@ my %usage = (
HMC specific:
rspconfig <noderange> [sshcfg]
rspconfig <noderange> [sshcfg=<enable|disable>]
CEC|Frame(using ASM)Specific:
rspconfig <noderange> [dev|celogin1]
rspconfig <noderange> [dev=<enable|disable>]|
rspconfig <noderange> [celogin1=<enable|disable>]
",
"getmacs" =>
"Usage:

View File

@ -54,16 +54,12 @@ B<rspconfig> I<noderange> B<ntp>={[B<ntpenable>],[B<ntpserver>],[B<frequency>],[
=head2 FSP/CEC specific:
B<rspconfig> I<noderange> {B<autopower>|B<iocap>|B<dev>|B<celogin1>|B<decfg>|B<memdecfg>|B<procdecfg>|B<time>|B<date>|B<spdump>|B<sysdump>|B<network>}
B<rspconfig> I<noderange> {B<autopower>|B<iocap>|B<decfg>|B<memdecfg>|B<procdecfg>|B<time>|B<date>|B<spdump>|B<sysdump>|B<network>}
B<rspconfig> I<noderange> B<autopower>={B<enable>|B<disable>}
B<rspconfig> I<noderange> B<iocap>={B<enable>|B<disable>}
B<rspconfig> I<noderange> B<dev>={B<enable>|B<disable>}
B<rspconfig> I<noderange> B<celogin1>={B<enable>|B<disable>}
B<rspconfig> I<noderange> B<time>=I<hh:mm:ss>
B<rspconfig> I<noderange> B<date>=I<mm:dd:yyyy>
@ -111,7 +107,7 @@ B<rspconfig> I<noderange> B<cec_off_policy>={B<poweroff>|B<stayon>}
=head2 BPA/Frame Specific:
B<rspconfig> I<noderange> {B<network>|B<dev>|B<celogin1>}
B<rspconfig> I<noderange> {B<network>}
B<rspconfig> I<noderange> B<network>={B<nic,>*}
@ -119,10 +115,6 @@ B<rspconfig> I<noderange> B<network>={B<nic,[IP,][hostname,][gateway,][netmask]>
B<rspconfig> I<noderange> B<network>={B<nic,0.0.0.0>}
B<rspconfig> I<noderange> B<dev>={B<enable>|B<disable>}
B<rspconfig> I<noderange> B<celogin1>={B<enable>|B<disable>}
B<rspconfig> I<noderange> B<HMC_passwd>={I<currentpasswd,newpasswd>}
B<rspconfig> I<noderange> B<admin_passwd>={I<currentpasswd,newpasswd>}
@ -211,7 +203,7 @@ B<rspconfig> I<noderange> B<--resetnet>
B<rspconfig> configures various settings in the nodes' service processors. If only a keyword is
specified, without the B<=>, it displays the current value.
For options B<autopower>|B<iocap>|B<dev>|B<celogin1>|B<decfg>|B<memdecfg>|B<procdecfg>|B<time>|B<date>|B<spdump>|B<sysdump>|B<network>, user need to use I<chdef -t site enableASMI=yes> to enable ASMI first. For options B<dev>|B<celogin1>, user also need to contact IBM service to get the dynamic password for 'celogin' and put it in passwd table. After completed the command, user should use I<chdef -t site enableASMI=no> to disable ASMI.
For options B<autopower>|B<iocap>|B<decfg>|B<memdecfg>|B<procdecfg>|B<time>|B<date>|B<spdump>|B<sysdump>|B<network>, user need to use I<chdef -t site enableASMI=yes> to enable ASMI first.
=head1 OPTIONS
@ -305,14 +297,6 @@ Set CEC/BPA system names to the names in xCAT DB or the input name.
Select the policy for I/O Adapter Enlarged Capacity. This option controls the size of PCI memory space allocated to each PCI slot.
=item B<dev>={B<enable> | B<disable>}
Enable or disable the CEC|Frame 'dev' account or display account status if no value specified.
=item B<celogin1>={B<enable> | B<disable>}
Enable or disable the CEC|Frame 'celogin1' account or display account status if no value specified.
=item B<ip>
The ip address.

View File

@ -2219,8 +2219,6 @@ sub process_request {
$request->{fsp_api} = 1;
#For using rspconfig options through ASMI
#my $arg = $request->{arg};
#if($request->{command} eq "rspconfig" and grep(/^(dev|celogin1)/, @$arg)) {
if ($request->{command} eq "rspconfig" and ref($request->{method}) eq 'HASH') {
$request->{fsp_api} = 0;
}