You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: documentation/source/rdfm_linux_device_client.md
+59-1Lines changed: 59 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -132,7 +132,7 @@ Consider the following example:
132
132
]
133
133
```
134
134
135
-
:::{note} Since the file gives the capacity to run arbitrary binaries, its permissions should be set to `-rw-r--r--`.
135
+
:::{note} Since the file gives the capacity to run arbitrary binaries, its permissions must be set to `-rw-r--r--`.
136
136
:::
137
137
138
138
#### name `string`
@@ -151,6 +151,64 @@ A list of arguments for the given executable.
151
151
152
152
Number of milliseconds between each time a logger is ran. In the case of a logger taking more than `tick` to execute, it is killed and the client reports a timeout error.
153
153
154
+
### RDFM actions config
155
+
156
+
The JSON structured `/var/lib/rdfm/actions.conf` file contains a list of actions that can be executed on the device.
157
+
Each action contains a command to execute and a timeout.
158
+
Identifiers are used in `action_exec` messages sent from the server to select the action to execute.
159
+
Name and description can be used for user-friendly display.
160
+
Actions defined in the configuration can be queried using `action_list_query`.
161
+
162
+
Example configuration:
163
+
```json
164
+
[
165
+
{
166
+
"Id": "echo",
167
+
"Name": "Echo",
168
+
"Command": ["echo", "Executing echo action"],
169
+
"Description": "Description of echo action",
170
+
"Timeout": 1.0
171
+
},
172
+
{
173
+
"Id": "sleepTwoSeconds",
174
+
"Name": "Sleep 2",
175
+
"Command": ["sleep", "2"],
176
+
"Description": "Description of sleep 2 seconds action",
177
+
"Timeout": 3.0
178
+
},
179
+
{
180
+
"Id": "sleepFiveSeconds",
181
+
"Name": "Sleep 5",
182
+
"Command": ["sleep", "5"],
183
+
"Description": "This action will timeout",
184
+
"Timeout": 3.0
185
+
}
186
+
]
187
+
```
188
+
189
+
:::{note} Since the file gives the capacity to run arbitrary binaries, its permissions must be set to `-rw-r--r--`.
190
+
:::
191
+
192
+
#### Id `string`
193
+
194
+
Identifier used in execution requests, must be unique.
195
+
196
+
#### Name `string`
197
+
198
+
Human readable name, should be unique.
199
+
200
+
#### Command `[]string`
201
+
202
+
Command to execute, the first elements is an executable, others are arguments.
203
+
204
+
#### Description `string`
205
+
206
+
Human readable action description.
207
+
208
+
#### Timeout `float`
209
+
210
+
Maximum duration of command execution in seconds, command is killed if it doesn't finish in the time provided.
211
+
154
212
## Testing server-device integration with a demo Linux device client
155
213
156
214
For development purposes, it's often necessary to test server integration with an existing device client.
Copy file name to clipboardExpand all lines: documentation/source/server_operation.md
+15-1Lines changed: 15 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -102,10 +102,24 @@ By default it is assumed that the device does not provide any capabilities.
102
102
103
103
This capability indicates that a device supports spawning a reverse shell.
104
104
The following methods must be supported by the device:
105
-
-`shell_attach`
105
+
106
+
##### Method - `shell_attach`
106
107
107
108
A device with the `shell` capability should react to `shell_attach` messages by connecting to a shell WebSocket at `/api/v1/devices/<shell_attach.mac_addr>/shell/attach/<shell_attach.uuid>`.
108
109
This establishes a connection between the requesting manager and the device.
109
110
This WebSocket can then be used to stream the contents of the shell session and receive user input.
110
111
The format of messages sent over this endpoint is implementation defined.
111
112
However, generally the shell output/input are simply sent as binary WebSocket messages containing the standard output/input as raw bytes.
113
+
114
+
#### Capability - `action`
115
+
116
+
This capability indicates that a device supports execution of predefined actions.
117
+
The following methods must be supported by the device:
118
+
119
+
##### Method - `action_list_query`
120
+
121
+
Return a list of actions supported by the device.
122
+
123
+
##### Method - `action_exec`
124
+
125
+
Attempt to queue action execution and immediately respond with the `action_exec_control` message indicating success or failure. Action execution result is sent later via `action_exec_result` message.
0 commit comments