diff --git a/CLI.md b/CLI.md index d1dd879..98ea2cc 100644 --- a/CLI.md +++ b/CLI.md @@ -12,64 +12,59 @@ Most commands will take from 0 to 2 parameters. You should include all parameter ## The commands -### `cli createuser ` -This will create a simple user as admin using the email as login ID and setting the initial password. +### listendpoints +Get all the system endpoints. -### `cli createuser_v ` -This will create a simple user and force email verification. +### emailtest +Generate a forgot Password e-amil to the logged in user. -### `cli deleteuser ` -Delete the specified user using the user's UUID. +### me +Show information about the logged user. -### `cli getuser ` -Get the specified user using the user's UUID. +### createuser +Create a user with an initial password and force the user to change password. -### `cli listusers` -Get a list of users. +### createuser_v +Same as create user but also force an e-mail verification. -### `cli policies` -List the link used to display password and usage policies for the management site. +### deleteuser +Delete the user. + +### getuser +Get the user information. -### `cli setavatar ` -Sets the avatar for the user with ID. The file should be gif, png, svg. +### listusers +List users. -### `cli deleteavatar ` -Remove the avatar fort the specified user ID. +### policies +List the login and access policies. -### `cli secversion` -Get the vewrsion of the secufiry service. +### setavatar +Sets the avatar for user to the image in filename. -### `cli sectimes` -Get the starttime and uptime for the security service. +### getavatar +Get the avatar for the user. +### deleteavatar +Remove the avatar for a user. +### sendemail +Sends a test email to see if the e-mail system is working. +### setloglevel +Set the log level for s specific subsystem. -### `cli revisions` -Get the list of currently available revisions. +### getloglevels +Get the current log levels for all subsystems. -### `cli devicetypes` -Retrieve the list of known `device_types` +### getloglevelnames +Get the log level names available. -### `cli firmwareage ` -If you specify your `device_type` and `revision`, the system will do its best to estimate how -far in the past you `revision` is compared to the latest revision. +### getsubsystemnames +Get the list of subsystems. -### `cli gethistory ` -Get the revision history for a given device. - -### `cli connecteddevices` -Get a list of the currently known devices and the last connection information we have about the, - -### `cli connecteddevice ` -Get the information relevant to a specific device. - -### `cli devicereport` -Give a simplified dashboard report of the data in the service. - -### `cli fmsversion` -Display the version of the service. - -### `cli fmstimes` -Display the uptime and start time of the service. +### systeminfo +Get basic system information. +### reloadsubsystem +Reload the configuration for a subsystem. diff --git a/test_scripts/curl/cli b/test_scripts/curl/cli index c2b0aef..ea324ac 100755 --- a/test_scripts/curl/cli +++ b/test_scripts/curl/cli @@ -216,7 +216,7 @@ policies() { } setavatar() { - curl ${FLAGS} -F 'data=@open-wifi.svg' "https://${OWSEC}/api/v1/avatar/$1" \ + curl ${FLAGS} -F 'data=@$2' "https://${OWSEC}/api/v1/avatar/$1" \ -H "Authorization: Bearer ${token}" > ${result_file}; jq < ${result_file} } @@ -235,14 +235,8 @@ deleteavatar() { jq < ${result_file} } -help() { - echo - echo "listendpoints Get all the system endpoints." - echo -} - sendemail() { - payload="{ \"recipients\" : [ \"stephane.bourque@gmail.com\" ] , \"subject\" : \"test1\" , \"from\" : \"no-reply@arilia.com\" , \"text\" : \"This is a test from SES.\" }" + payload="{ \"recipients\" : [ \"$1\" ] , \"subject\" : \"test1\" , \"from\" : \"$2\" , \"text\" : \"This is a test from SES.\" }" curl ${FLAGS} -X POST "https://${OWSEC}/api/v1/email" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer ${token}" \ @@ -263,7 +257,7 @@ testlogout() { setloglevel() { payload="{ \"command\" : \"setloglevel\" , \"subsystems\" : [ { \"tag\" : \"$1\" , \"value\" : \"$2\" } ] }" - curl ${FLAGS} -X POST "https://${OWFMS}/api/v1/system" \ + curl ${FLAGS} -X POST "https://${OWSEC}/api/v1/system" \ -H "accept: application/json" \ -H "Authorization: Bearer ${token}" \ -d "$payload" @@ -271,7 +265,7 @@ setloglevel() { getloglevels() { payload="{ \"command\" : \"getloglevels\" }" - curl ${FLAGS} -X POST "https://${OWFMS}/api/v1/system" \ + curl ${FLAGS} -X POST "https://${OWSEC}/api/v1/system" \ -H "accept: application/json" \ -H "Authorization: Bearer ${token}" \ -d "$payload" @@ -279,7 +273,7 @@ getloglevels() { getloglevelnames() { payload="{ \"command\" : \"getloglevelnames\" }" - curl ${FLAGS} -X POST "https://${OWFMS}/api/v1/system" \ + curl ${FLAGS} -X POST "https://${OWSEC}/api/v1/system" \ -H "accept: application/json" \ -H "Authorization: Bearer ${token}" \ -d "$payload" @@ -287,27 +281,52 @@ getloglevelnames() { getsubsystemnames() { payload="{ \"command\" : \"getsubsystemnames\" }" - curl ${FLAGS} -X POST "https://${OWFMS}/api/v1/system" \ + curl ${FLAGS} -X POST "https://${OWSEC}/api/v1/system" \ -H "accept: application/json" \ -H "Authorization: Bearer ${token}" \ -d "$payload" } systeminfo() { - curl ${FLAGS} -X GET "https://${OWFMS}/api/v1/system?command=info" \ + curl ${FLAGS} -X GET "https://${OWSEC}/api/v1/system?command=info" \ -H "accept: application/json" \ -H "Authorization: Bearer ${token}" > ${result_file} jq < ${result_file} } reloadsubsystem() { - payload="{ \"command\" : \"reload\", \"subsystems\" : [ \"OUIServer\" , \"CommandManager\" ] }" - curl ${FLAGS} -X POST "https://${OWFMS}/api/v1/system" \ + payload="{ \"command\" : \"reload\", \"subsystems\" : [ \"$1\" ] }" + curl ${FLAGS} -X POST "https://${OWSEC}/api/v1/system" \ -H "accept: application/json" \ -H "Authorization: Bearer ${token}" \ -d "$payload" } +help() { + echo + echo "Usage: cli [args]" + echo + echo "listendpoints Get all the system endpoints." + echo "emailtest Generate a forgot Password e-amil to the logged in user." + echo "me Show information about the logged user." + echo "createuser Create a user with an initial password and force the user to change password." + echo "createuser_v Same as create user but also force an e-mail verification." + echo "deleteuser Delete the user." + echo "getuser Get the user information." + echo "listusers List users." + echo "policies List the login and access policies." + echo "setavatar Sets the avatar for user to the image in filename." + echo "getavatar Get the avatar for the user." + echo "deleteavatar Remove the avatar for a user." + echo "sendemail Sends a test email to see if the e-mail system is working." + echo "setloglevel Set the log level for s specific subsystem." + echo "getloglevels Get the current log levels for all subsystems." + echo "getloglevelnames Get the log level names available." + echo "getsubsystemnames Get the list of subsystems." + echo "systeminfo Get basic system information." + echo "reloadsubsystem Reload the configuration for a subsystem." + echo +} shopt -s nocasematch @@ -332,7 +351,7 @@ case "$1" in "getloglevels") login; getloglevels; logout ;; "getloglevelnames") login; getloglevelnames; logout ;; "getsubsystemnames") login; getsubsystemnames; logout ;; - "reloadsubsystem") login; reloadsubsystem; logout ;; + "reloadsubsystem") login; reloadsubsystem "$2"; logout ;; "systeminfo") login; systeminfo ; logout;; "help") login; help ; logout ;; *) help ;;