mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-08-24 12:10:25 +00:00
Add testcase for nodeshell REST API method for non-root user
This commit is contained in:
@@ -25,4 +25,5 @@ restapi_list_wrong_osimage
|
||||
restapi_modify_wrong_field_CN
|
||||
restapi_delete_temp_CN_put
|
||||
restapi_nodeshell_cmd_root
|
||||
restapi_nodeshell_cmd_non_root
|
||||
restapi_cleanup_on_MN_CN
|
||||
|
@@ -245,3 +245,19 @@ cmd:username=__GETTABLEVALUE(key,system,username,passwd)__;password=__GETTABLEVA
|
||||
check:rc==0
|
||||
check:output=~root
|
||||
end
|
||||
|
||||
start:restapi_nodeshell_cmd_non_root
|
||||
description: Call nodeshell method to execute a command by non-root user
|
||||
label:restapi
|
||||
cmd:useradd -u 99 nonroot
|
||||
cmd:echo nonrootpw | passwd --stdin nonroot
|
||||
cmd:tabch key=xcat,username=nonroot passwd.password=nonrootpw
|
||||
cmd:mkdef -t policy 9 name=nonroot rule=allow
|
||||
cmd:xdsh $$CN "useradd -u 99 nonroot"
|
||||
cmd:xdsh $$CN "echo nonrootpw | passwd --stdin nonroot"
|
||||
cmd:/opt/xcat/share/xcat/scripts/setup-local-client.sh nonroot -f
|
||||
cmd:runuser -l nonroot -c 'echo nonrootpw | xdsh $$CN -K'
|
||||
cmd:username=nonroot;password=nonrootpw;xdsh $$CN "curl -X POST -s --cacert /root/ca-cert.pem 'https://$$MN/xcatws/nodes/$$CN/nodeshell?userName=$username&userPW=$password' -H Content-Type:application/json --data '{\"command\":\"id\"}'"
|
||||
check:rc==0
|
||||
check:output=~nonroot
|
||||
end
|
||||
|
Reference in New Issue
Block a user