-
Notifications
You must be signed in to change notification settings - Fork 0
User Guide Remote Mode
Prev: Output and Report Formats | Up: User Guide | Next: Remote Protocol Reference
ReqPack has two automation-oriented serve modes:
-
rqp serve --stdin: read commands from stdin until EOF. -
rqp serve --remote: start a TCP server and execute commands from remote clients.
This page covers remote TCP mode, remote.lua semantics, auth, supported protocols, and operational caveats.
Examples:
rqp serve --remote --bind 127.0.0.1 --port 4545 --token secret
rqp serve --remote --json --readonly --max-connections 4Important flags:
-
--bind <addr>: default127.0.0.1 -
--port <n>: default4545 -
--token <value>: fallback token auth -
--username <name>and--password <value>: fallback basic auth -
--readonly: allow only read-only commands -
--max-connections <n>: concurrent client limit -
--json: force JSON Lines protocol for all clients -
--httpand--https: reserved for future work, not implemented yet
Client profiles and server-side user definitions live in remote.lua.
Path:
$XDG_CONFIG_HOME/reqpack/remote.lua- fallback:
~/.config/reqpack/remote.lua
Minimal example:
profiles = {
dev = {
host = "127.0.0.1",
port = 4545,
protocol = "auto", -- auto | text | json | http | https
token = "secret",
},
}
users = {
admin = {
token = "secret",
isAdmin = true,
},
}Notes:
- a profile can use
hostorurl -
hostorurlcan include host, port, and optional scheme; explicitportfield wins if both are present -
protocolcan beauto,text,json,http, orhttps -
httpandhttpsprofiles currently fail because those protocols are not implemented - a server user can authenticate with token, or with username/password basic auth
- for basic auth,
usernamedefaults to the user ID if omitted - if at least one valid
usersentry exists, server prefers that user registry instead of fallback--tokenor--username/--password - in built-in
rqp remoteclient,autocurrently behaves like text mode; use explicitjsonif you want JSON client mode
Examples:
rqp remote dev list apt
rqp remote dev install apt curlBehavior:
- if you pass a command, rqp sends it once and exits
- if you pass only the profile name, rqp starts an interactive text session
- interactive sessions therefore require text-mode behavior; do not use
protocol = "json"if you want an interactive shell
Example interactive flow:
rqp remote dev
list apt
search npm react
exit
There are two related behaviors to understand:
- server behavior: when server runs without
--json, it speaks text protocol and can also auto-detect raw JSON requests per connection - built-in
rqp remoteclient behavior:protocol = "json"uses JSON mode, whileprotocol = "text"andprotocol = "auto"both use text client mode today
Use --json only when you want to force JSON Lines for every client.
Text mode is the default and the most capable mode.
It supports:
- interactive sessions,
- token auth,
- basic auth,
- local file upload for
install <system> <local-file>.
Token auth handshake:
auth token secret
Basic auth handshake:
auth basic admin hunter2
Server replies with a text frame shaped like:
OK <length>
<plain text output>
or
ERR <length>
<plain text output>
<length> is byte length of response body, so custom clients should read exact body size rather than waiting for a prompt.
JSON mode is for one-shot programmatic commands. It does not support interactive sessions.
Example request:
{"command":"list apt","token":"secret"}Example success response:
{"ok":true,"output":"...plain text command output..."}Example failure response:
{"ok":false,"error":"...plain text error output..."}Important limitation:
- JSON mode does not support local file upload.
- if you need
install <system> <local-file>, use text mode.
rqp can upload a local file through the text protocol when you run a remote install command that targets one local file.
Examples that work in text mode:
rqp remote dev install rqp ./my-tool.rqp
rqp remote dev install dnf ./package.rpmRestrictions:
- only regular files are supported
- only one local file per install command
- text protocol only
If a remote user has isAdmin = true, the session can run these server commands:
shutdownconnections countconnections listreload-config
These are not normal package-manager commands. They are server control commands handled directly by the remote runtime.
Read-only mode is useful for dashboards, observability, and safe remote queries.
Allowed actions in readonly mode:
listsearchinfooutdatedsbomaudit
Blocked in readonly mode:
installremoveupdateensure- any command that writes an output file through
outputPath
That means even sbom or audit are rejected in readonly mode if they try to write a file on the server.
serve --remote reloads its baseline behavior from normal config.lua too.
Useful keys:
remote = {
readonly = false,
maxConnections = 16,
}CLI flags win over config.
For example, if you start with --readonly, the server stays readonly even if config.lua says otherwise.
- Bind to
127.0.0.1unless you deliberately want remote access from outside the host. - Prefer explicit
usersinremote.luaover a single fallback token. - Use
--readonlyfor query-only automation. - Use JSON mode for simple machine-to-machine calls and text mode for human sessions or uploads.
- Do not document or depend on
http/httpsyet; they are placeholders today.
Prev: Output and Report Formats | Up: User Guide | Next: Remote Protocol Reference
- User Guide
- Getting Started
- Command Reference
- Configuration
- Configuration Reference
- Security, Audit, and SBOM
- Output and Report Formats
- Remote Mode
- Remote Protocol Reference
- Using Native
rqpPackages - Troubleshooting