Updating cli/documentation

This commit is contained in:
stephb9959
2021-09-19 16:12:27 -07:00
parent e09012c413
commit 5f38e163a1
2 changed files with 74 additions and 60 deletions

83
CLI.md
View File

@@ -12,64 +12,59 @@ Most commands will take from 0 to 2 parameters. You should include all parameter
## The commands
### `cli createuser <email> <initial password>`
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 <email> <initial password>`
This will create a simple user and force email verification.
### emailtest
Generate a forgot Password e-amil to the logged in user.
### `cli deleteuser <id>`
Delete the specified user using the user's UUID.
### me
Show information about the logged user.
### `cli getuser <id>`
Get the specified user using the user's UUID.
### createuser <email> <password>
Create a user with an initial password and force the user to change password.
### `cli listusers`
Get a list of users.
### createuser_v <email> <password>
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 <user UUID>
Delete the user.
### getuser <user UUID>
Get the user information.
### `cli setavatar <id> <filename>`
Sets the avatar for the user with ID. The file should be gif, png, svg.
### listusers
List users.
### `cli deleteavatar <id>`
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 <user UUID> <filename>
Sets the avatar for user to the image in filename.
### `cli sectimes`
Get the starttime and uptime for the security service.
### getavatar <user UUID>
Get the avatar for the user.
### deleteavatar <user UUID>
Remove the avatar for a user.
### sendemail <recipient> <from>
Sends a test email to see if the e-mail system is working.
### setloglevel <subsystem> <loglevel>
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 <device_type> <revision>`
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 <serialNumber>`
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 <serialNumber>`
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 <subsystem name>
Reload the configuration for a subsystem.

View File

@@ -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 <cmd> [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 <email> <password> Create a user with an initial password and force the user to change password."
echo "createuser_v <email> <password> Same as create user but also force an e-mail verification."
echo "deleteuser <user UUID> Delete the user."
echo "getuser <user UUID> Get the user information."
echo "listusers List users."
echo "policies List the login and access policies."
echo "setavatar <user UUID> <filename> Sets the avatar for user to the image in filename."
echo "getavatar <user UUID> Get the avatar for the user."
echo "deleteavatar <user UUID> Remove the avatar for a user."
echo "sendemail <recipient> <from> Sends a test email to see if the e-mail system is working."
echo "setloglevel <subsystem> <loglevel> 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 <subsystem name> 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 ;;