-
Notifications
You must be signed in to change notification settings - Fork 0
User Guide Remote Protocol Reference
Prev: Remote Mode | Up: User Guide | Next: Using Native rqp Packages
This page is wire-level and schema reference for ReqPack remote mode. Use Remote Mode for operational workflow.
Remote profiles and remote users live in:
$XDG_CONFIG_HOME/reqpack/remote.lua- fallback:
~/.config/reqpack/remote.lua
remote.lua may be written in multiple equivalent ways.
Accepted patterns:
- file returns table containing
profilesand/orusers - file sets global
profiles = { ... } - file sets global
users = { ... } - file returns plain profiles table when no
userstable exists - file returns plain users table when no
profilestable exists
If file does not exist, ReqPack behaves as if no profiles/users are defined.
Minimal example:
profiles = {
dev = {
host = "127.0.0.1",
port = 4545,
protocol = "auto",
token = "secret",
},
}Supported profile fields:
hosturlportprotocoltokenusernamepassword
Validation rules:
- profile must resolve non-empty host
- port must be
1..65535 - invalid profiles are skipped
host or url can include:
- raw host
- host plus port
- scheme plus host plus port
- IPv6 bracket form such as
[::1]:4545
Parsing rules:
- if endpoint contains scheme, scheme may set protocol
- if endpoint contains path, path is ignored after host/port extraction
- explicit
portfield overrides port parsed fromhostorurl
Scheme-to-protocol mapping:
-
tcp://-> text -
text://-> text -
json://-> json -
http://-> http -
https://-> https
Explicit protocol strings:
autotextjsonhttphttps
Important current limitation:
-
httpandhttpsare parsed but both client and server reject them as not implemented
Example:
users = {
admin = {
token = "secret",
isAdmin = true,
},
operator = {
username = "operator",
password = "hunter2",
},
}Supported user fields:
tokenusernamepasswordisAdmin
Validation rules:
- user must have token or password
- if password exists and username is omitted, username defaults to user id
- invalid user entries are skipped
Auth is required when any of these exist:
- at least one valid
usersentry - server fallback
--token - server fallback
--usernameplus--password
Resolution order:
- if valid
usersregistry exists, server authenticates againstusers - otherwise server falls back to CLI
--tokenor--username/--password
This means valid users table overrides fallback CLI credentials.
Session identity tracks:
- authenticated state
- user id
- admin flag
- auth type string such as
token,basic,fallback-token,fallback-basic,none
Text mode is default server behavior unless --json forces JSON-only mode.
Token auth:
auth token secret
Basic auth:
auth basic admin hunter2
If auth succeeds, server returns empty successful frame. If auth fails, server returns text error frame.
Request is one line of plain text command.
Response header is:
OK <length>
or:
ERR <length>
Then server sends exactly <length> bytes of plain-text response body.
Client must read exact byte count, not wait for prompt.
These close connection cleanly:
quitexit
JSON mode is line-oriented and one-shot friendly.
Request shape:
{"command":"list apt","token":"secret"}Supported request fields:
commandtokenusernamepassword
Success response:
{"ok":true,"output":"...plain text command output..."}Failure response:
{"ok":false,"error":"...plain text error output..."}Notes:
- JSON mode does not support interactive shell
- JSON mode does not support local file upload
- built-in client rejects JSON profile with no forwarded command
-
rqp serve --remote --jsonforces JSON protocol for every connection - normal text-mode server can still auto-detect raw JSON request line when first line looks like JSON object
-
protocol = jsonuses JSON client mode -
protocol = textuses text client mode -
protocol = autocurrently behaves like text client mode
Text protocol supports special upload command for remote install of one local file.
Client detects upload only for:
install ... <local regular file>- exactly one local file target
Client sends header line shaped like:
__reqpack_upload_install__ <size> <filename> <commandTemplate>
Then streams exactly <size> raw bytes.
Server-side envelope fields are:
- payload size
- uploaded filename
- command template containing placeholder
__REQPACK_REMOTE_UPLOAD_PATH__
Server behavior:
- writes upload to temp file under system temp
reqpack/remote-upload/ - sanitizes filename to safe basename chars
- substitutes temp path into command template
- executes resulting ReqPack command
- removes temp file after command finishes
Restrictions:
- only regular files
- one local file per install command
- text protocol only
- readonly server rejects upload after draining payload bytes
Readonly-safe actions are:
listsearchinfooutdatedsbomaudit
Readonly still rejects requests if any request writes output file.
So these are blocked in readonly mode:
installremoveupdateensuresbom --output ...audit --output ...
Admin-only commands handled directly by remote runtime are:
shutdownconnections countconnections listreload-config
Admin privilege comes from remote user entry isAdmin = true.
rqp serve parsing rules:
- exactly one of
--stdinor--remoteis required -
--tokencannot be combined with--username/--password -
--usernameand--passwordmust appear together - protocol flags require
--remote - remote-only flags are rejected in stdin mode
-
--portmust be1..65535 -
--max-connectionsmust be> 0
Built-in rqp remote client behavior:
- forwarded command runs once and exits
- no forwarded command starts interactive text session
- interactive client tokenizes shell-like quoting; malformed quotes make command invalid locally
- upload helper rewrites local path to remote placeholder before sending upload frame
These names exist in config and parser surface, but are not implemented:
serve --remote --httpserve --remote --https- remote profiles with
protocol = "http" - remote profiles with
protocol = "https"
Document them only as placeholders, not supported features.
Prev: Remote Mode | Up: User Guide | Next: Using Native rqp Packages
- 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