mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-09-05 20:47:55 +00:00
fix(xcatd): refuse the ^ file operator on an unauthenticated request
xcatd expands the request noderange before it authorizes the caller: once to count the nodes, and once in validate() to match the policy rules. The ^ operator makes xcatd open a caller-named file at that point. A client can connect without a certificate, because the listener does not require one, and such a client has no peername. Expand these two pre-authorization noderanges with nofile when the caller has no peername (checked with defined, so the identity "0" still counts as authenticated). If validate() finds a rejected ^file atom on such a request, deny it. An authenticated caller expands ^file as before.
This commit is contained in:
@@ -98,7 +98,10 @@ sub validate {
|
||||
|
||||
my %req_noderange_info;
|
||||
if (defined $request->{noderange}->[0]) {
|
||||
my @tmpn = xCAT::NodeRange::noderange($request->{noderange}->[0]);
|
||||
my @tmpn = xCAT::NodeRange::noderange($request->{noderange}->[0], 1, 1, (defined($peername) ? () : (nofile => 1)));
|
||||
if (!defined($peername) && xCAT::NodeRange::file_operator_rejected()) {
|
||||
return 0;
|
||||
}
|
||||
$req_noderange_info{leftnodenum} = @tmpn;
|
||||
if($req_noderange_info{leftnodenum}){
|
||||
$req_noderange_info{leftnodes} = \@tmpn;
|
||||
|
||||
@@ -2843,7 +2843,7 @@ sub service_connection {
|
||||
}
|
||||
|
||||
if (exists($req->{noderange}) && defined($req->{noderange}->[0])) {
|
||||
my @nnodes = xCAT::NodeRange::noderange($req->{noderange}->[0]);
|
||||
my @nnodes = xCAT::NodeRange::noderange($req->{noderange}->[0], 1, 1, (defined($peername) ? () : (nofile => 1)));
|
||||
$numofnodes = (scalar(@nnodes));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user