Server/Access Control

From Bondix Wiki
Revision as of 10:46, 16 November 2023 by Red (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

saneserver 20230619 introduces access control settings for its webinterface. When creating a user in /etc/saneserver.json, the following properties can now be populated:

{"target": "server", "action": "add-user", 
 "user": "xxx", "password": "xxx", 
 "write": true, "read": true,
 "allowedSections": [], "blockedSections": [], 
 "allowedEnvironments": [], "blockedEnvironments": [], 
 "allowedTunnel": [], "blockedTunnel": [],
 "allowedFunctions": {}, "blockedFunctions": {}
}

The new parameters are optional. In essence, there are both whitelists and blacklists for access to webinterface sections, tunnels, environments and functions.

If a whitelist is empty, access is always permitted, otherwise only items in the whitelist (and not on the blacklist) accessible.

When "read" or "write" is set, general reading and writing capabilities are set (to e.g. create users with read-only access).Otherwise, a function access list can be created for custom access.

Sections

The following sections are available:

  • status (aka Overview page)
    • get (read) -> returns status overview page details
  • environment
    • get (read) -> get environment settings
    • set (write) -> set environment settings
    • create (write) -> creates a new environment
    • delete (write) -> removes an environment
    • create-tunnel (write) -> creates a new tunnel
    • reset-tunnel (write) -> resets/reconnects a tunnel
    • reset-channel (write) -> resets/reconnects a tunnel channel
    • delete-tunnel (write) -> removes a tunnel
    • list (read) -> returns a list of environments
    • get-tunnel (read)
    • set-tunnel (write)
  • tunnel
    • disconnect-all (write) -> disconnect all tunnels
    • create (write) -> creates a new tunnel
    • reset (write) -> resets/reconnects a tunnel
    • reset-channel (write) -> resets/reconnects a tunnel channel
    • get (read) -> gets tunnel information & settings
    • set (write) -> updates tunnel settings
    • delete (write) -> removes a tunnel
  • license
    • scan (write) -> starts scanning for license files (offline)
    • rename (write) -> renames the current instance (online)
    • changelicense (write) -> change license type (online)
    • activate (write) -> activate a new license (online)
    • get (read) -> return detailed license information
  • log
    • get (read) -> get log lines

Example: User can only access the "env0" environment, cannot add/delete or modify environments, or access the license page.

{"target": "server", "action": "add-user", "user": "me", "password": "honk", 
 "allowedEnvironments": ["env0"], "blockedFunctions": { "environment": ["set", "create", "delete"]}}}

Remarks

  • When an environment is renamed, access control will no longer match to it's specified name.
  • there is an overlap of functions in environments & tunnels (create-tunnel etc). They are redundant.
  • Environment read access is required to access its tunnels.