Application with rest api performs operating system actions.
- Contains few (and hopefully more and more) parsers to run programs or read/modify/delete files
- One local and/or multiple remote endpoints supported
sshis required for remote andsufor local- non-posix unsupported at the moment
- basic auth and optional bearer token
- run programs asynchronously
- parser with compatibility (OS, read/write/delete), examples, in/output parameters
- consumable for logging, automation, monitoring, ..
- tries to parse files as it is, including whitespaces (but not enforced)
βββββββββββββββββββββββββββββββββββββ ββββββββββββββββββββββββββββββββββββββ
β β β β
β http://boofi/localhost/<action> β β http://boofi/remotehost1/<action> β
β β β β
βββββββββββββ²ββββββββββββββββββββββββ βββββββββββββ²βββββββββββββββββββββββββ
β β
β ββββββββββββββββββββββββββββββββββββ
β β
β β βββββββββββββββββββββββββββββββββββββββββΊ [...]
β β β
βββββββββββΌβββΌβββΌβββββββββββββββββββ
β β β β β
β β β β β βββββββββββββββββββ
β βββΌβββΌβββΌββ β β β
β β β β β β β β β
β β β localhost β β remotehost1 β
β β boofi β β β β
β β β β ssh β β
β β ββββΌβββββββββββββββββΌβββββββββββββββΌββΊ <action>> β
β β β β β β β
β β β ββββΌβββββββββββββββββΌββββββ β β
β β β β β β β β
β ββββΌβββββββ β β β β
β β β β βββββββββββββββββββ
β βΌ β β
β su <action> β β
β β β
ββββββββββββββββββββββββββββββββββββ βββββββββββΊ [...]
Platform (Linux, ..) manages compatibility and authentication
β²
|
βΌ
System (ssh/ssh) provides api for run, read, write and delete operations
β²
|
βΌ
Parser (curl, uptime, ..) may deserializable input and may produces serializable output
β²
|
βΌ
Rest Api calls parser with input and sends output
Default log level is info but can be configured via enviroment variable RUST_LOG=<level>.
Following levels are available: error, info, warn, debug and trace.
export RUST_LOG=debug
Default configuration file will be created if not exist.
listen: 127.0.0.1:3000max_token_expiration: 86400ssl: none- generate self-signed with
--self-signed-alt-names <SELF_SIGNED_ALT_NAMES> - use custom path with
--ssl-stored-file-path <SSL_STORED_FILE_PATH>otherwise config file is used
ssl: !text
private_key: |
-----BEGIN PRIVATE KEY-----
MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQg2NM5eV2EUGFZ6suv
...
JSrw+JDAvHd3jyZ8+7Wy1/A8xYC7W426tFQedCnkByKRU5z+aFhUEmVI
-----END PRIVATE KEY-----
certificate: |
-----BEGIN CERTIFICATE-----
MIIBWDCB/6ADAgECAhQrkZ5jvY51i+tbj4DrWnz1FCVzvTAKBggqhkjOPQQDAjAh
...
58hQAojT4pDVI1IXn5+zSQg8XlSM0p0+5wIhANs1ZK8ghDWaLNq1BSB2iYtWtGll
6gA7uQG96wn6qLiT
-----END CERTIFICATE-----ssl: !file
private_key_path: /etc/boofi/cert.key
certificate_path: /etc/boofi/cert.pem- each endpoint localhost/ssh has its own path
- authentication is not shared
http://localhost:3000/localhost/<path/resources>
- you can choose between basic and bearer
- ever request needs authentication
- authentication goes through
suorssh
- path:
/token - use
getmethod to generate a new token- basic authentication is required
- use
deletemethod to delete a token- token authentication is required
- path:
/files - shows existing file modules with their documentation
- arguments
- examples
- platform compatibility
- pattern to match files e.g. regex or absolute path
- path:
/files/ - shows the directory content if path is a directory otherwise the file content
- fallback file module parser is
text
- path:
/files/<target filesystem path>- example:
/files/etc/passwd
- example:
- file content is parsed via file modules
textfile module works as fallback and returns file content (wrapped in json)- use http method
GETto read,POSTto write andDELETEto remove a file- arguments depends on the file module
- enforce a file module by using
?name=<file module name>
- path:
/apps - shows all available app modules with their usage
- arguments
- expected output
- examples
- platform compatibility
- path:
/apps/<name> - run a program with supported arguments
- returns structured/parsed (maybe limited) output
- use http method
POST - asynchronous run is supported via
?async=true- it returns a task id
- a list of apps are expected
[{
"name": "ls",
"input": {
"path": "/tmp"
}
}, {
"name": "sh",
"input": {
"command": "ls /tmp"
}
}]- path:
/task - tasks are apps which runs in background and no http response is required
- path:
/task/<id>
- check out
src/appsorsrc/filesfor examples - custom errors are located in each file/app module and needs to be converted in
src/error.rs - test utils are placed in
src/utils.rs
- implement
FileBuilderand `File - use
use crate::files::prelude::*; file_metadata!can be useful
- implement
AppBuilderandApp - use
use crate::apps::prelude::*; - a program may needs input and may produce output. both needs to be parsed
app_metadata!can be useful