Skip to content
metaneutronsPublic

About

CLI, MCP server, and Rust client library for UGREEN NAS (UGOS) management

Topics

Resources

Contributing

Security policy

Stars

14 stars

Watchers

1 watching

Forks

Repository files navigation

ugos-cli

CI MSRV License: GPL v3

CLI, MCP server, and Rust client library for managing UGREEN NAS (UGOS) devices.

UGOS ships a web UI but no CLI and no API documentation. Reaching past it with virsh/qemu makes UGOS lose track of its own VMs, so this project drives the same (undocumented) API the web UI uses — reverse-engineered from its bundles and verified against real hardware.

Covers virtual machines, Docker, files, downloads, system monitoring, logs and users.

⚠️ Work in Progress — A large subset of the UGOS API, not all of it. See the implementation status for what is covered and what is deliberately left out.

Crates

Crate Description
ugos-client API client library — auth, types, API calls
ugos-cli Command-line interface
ugos-mcp MCP server for AI-assisted NAS management

Quick Start

CLI

# Set credentials (or use the --host and --user flags)
export UGOS_HOST=192.168.1.10
export UGOS_USER=admin          # UGOS_USERNAME works too
export UGOS_PASSWORD=<password>

# Or read the password from stdin, for example from a secret store
pass show nas/admin | ugos-cli --password-stdin vm list

# Authenticator-app two-factor (type 1, the only factor supported).
# UGOS_OTP is one code and is spent on the first login, so it cannot renew a
# session. UGOS_OTP_SECRET is the TOTP secret (base32, or an otpauth:// URI)
# and is not a flag: a flag would show up in ps and the shell history.
# A fresh code is generated on every login, including after the session
# expires. See Authentication below for what storing the secret costs.
export UGOS_OTP_SECRET=<base32-secret-or-otpauth-uri>
# UGOS_OTP=123456 ugos-cli info

# List VMs
ugos-cli vm list

# Show VM details
ugos-cli vm show CachyOS

# Power management
ugos-cli vm start CachyOS
ugos-cli vm stop CachyOS
ugos-cli vm stop --force CachyOS

# Snapshots
ugos-cli vm snapshot list CachyOS
ugos-cli vm snapshot create CachyOS      # UGOS names it after the creation time

# Create a VM
ugos-cli vm create debian --cores 4 --memory 8g --disk 50g \
    --iso /volume1/iso/debian.iso

# Print the request body instead of creating anything (works offline)
ugos-cli vm create debian --cores 4 --memory 8g --disk 50g --dry-run

# Upload an ISO, from a local file or a URL
ugos-cli image upload ~/Downloads/debian.iso
ugos-cli image upload https://example.org/debian.iso --name debian-13

# Host load and all VMs in one call
ugos-cli overview

# System log, filterable — the KVM audit log is `vm log`
ugos-cli log --module login --size 10
ugos-cli vm log list

# User accounts
ugos-cli user list
ugos-cli user me
ugos-cli user show anna
ugos-cli user create anna --email anna@example.org --group family   # asks for the password
ugos-cli user update anna --description "Anna B." --disable
ugos-cli user update anna --expires 2027-01-31
ugos-cli user delete anna            # refuses a home folder with files, unless --force
ugos-cli user permissions anna       # what anna may do on each share
ugos-cli user permit anna media=read docs=write
ugos-cli user password-rules --min-length 10
ugos-cli user invite status          # the sign-up link, its applications
ugos-cli group list
ugos-cli group create family --member anna --member ben
ugos-cli group permit family media=read

# Browse the NAS
ugos-cli fs ls /volume1/download
ugos-cli fs volumes
ugos-cli fs put ./backup.tar.gz /volume1/backups
ugos-cli fs get /volume1/backups/backup.tar.gz

# Filesystem snapshots of shares and home folders (not VM snapshots)
ugos-cli snapshot folders
ugos-cli snapshot list backup
ugos-cli snapshot create backup --desc "before the migration"
ugos-cli snapshot clone backup 3 backup-recovered

# Shared folders (the SMB shares) and their access rules
ugos-cli share list
ugos-cli share show media
ugos-cli share create media --quota 500g --dry-run   # print the request first
ugos-cli share create media --quota 500g
ugos-cli share update media --hide-in-network
ugos-cli share acl show media
ugos-cli share acl set media user:anna=rw group:family=read
ugos-cli share delete media                          # deletes the folder's files too

# File services: SMB, FTP, NFS, rsync and WebDAV
ugos-cli smb status                  # state, settings, discovery services
ugos-cli smb set workgroup=HOME encryption=force
ugos-cli smb discovery --bonjour on --time-machine media
ugos-cli ftp settings                # what a setting is called and takes
ugos-cli ftp start port=2121         # FTPS; plain FTP needs --force
ugos-cli nfs status
ugos-cli webdav start http-port=5005 https-port=5006
ugos-cli rsync start account=backup  # asks for the password

# Hardware, power, time and terminal
ugos-cli hw fan show
ugos-cli hw power show
ugos-cli hw ups show
ugos-cli time show
ugos-cli time set --timezone Europe/Berlin
ugos-cli terminal show               # SSH and Telnet; switching on needs --force
ugos-cli lang set auto

# Network, and the Storage Manager (read only)
ugos-cli net list
ugos-cli net set eth0 --ipv4 dhcp
ugos-cli net bond create --help
ugos-cli pool list
ugos-cli disk smart nvme1

# SAN Manager: iSCSI
ugos-cli san lun create vmstore --size 500G --volume "Volume 1" --thin
ugos-cli san group create hosts --iqn iqn.1998-01.com.vmware:esx1
ugos-cli san target create vmtarget --lun vmstore
ugos-cli san target delete vmtarget --with-lun --force   # deletes the data

# Recycle bins, file versions, the Log Center
ugos-cli recycle list
ugos-cli recycle restore "/volume1/media/#recycle/film.mkv"
ugos-cli version set media --enable on --keep 5
ugos-cli version history /volume1/media/notes.txt
ugos-cli logcenter notify set --level critical
ugos-cli logcenter export ./log.csv

# Firmware, configuration backup, thumbnails
ugos-cli update status
ugos-cli update install --force      # restarts the NAS
ugos-cli backup save ./backup_restore.ugb
ugos-cli index status
ugos-cli system about

# Let the NAS fetch a file straight from the internet
ugos-cli download add https://example.org/big.iso
ugos-cli download list

# NAS hardware, firmware and live readings
ugos-cli system info
ugos-cli system stat
ugos-cli system processes --limit 10

# How much space KVM uses, per volume and per VM
ugos-cli storage df

# Docker containers
ugos-cli docker ps
ugos-cli docker show nginx
ugos-cli docker create nginx --image nginx:latest --publish 8080:80
ugos-cli docker start nginx
ugos-cli docker logs nginx --lines 50
ugos-cli docker logs nginx --follow          # until Ctrl-C
ugos-cli docker exec nginx nginx -t          # a command in the container, its exit status is ours
ugos-cli docker shell nginx                  # an interactive terminal, like the web UI

# Docker images, networks, updates and compose projects
ugos-cli docker images                       # with the containers that use each image
ugos-cli docker pull redis:7
ugos-cli docker network-ls
ugos-cli docker network-show traefik
ugos-cli docker network-check               # subnets that may shadow other networks
ugos-cli docker updates                      # what has a newer image
ugos-cli docker project-ls
ugos-cli docker project-logs myapp --lines 100
ugos-cli docker project-create myapp --file ./compose.yaml

# What was done in the Docker app (not the output of a container)
ugos-cli docker oplog --failed --limit 20

# Passthrough hardware
ugos-cli usb list
ugos-cli passthrough list

# Remote console
ugos-cli vnc list
ugos-cli vnc generate CachyOS

# Other resources
ugos-cli network list
ugos-cli storage list
ugos-cli image list
ugos-cli info

# JSON output, for scripting
ugos-cli -o json vm list

--password still works, but an argument shows up in the process list and the shell history, so ugos-cli prints a warning when it is used. Prefer UGOS_PASSWORD or --password-stdin. When both UGOS_PASSWORD and --password-stdin are present, stdin wins.

The password of an account that user create or user update --new-password sets is no flag either. It is asked for on the terminal (twice, without echo), taken from UGOS_NEW_PASSWORD, or read from stdin with --new-password-stdin. Stdin cannot serve both this and --password-stdin; the command says so.

Every command group has more than is shown here; ugos-cli <group> --help lists the rest.

Library

use ugos_client::{UgosClient, Credentials};
use ugos_client::api::kvm::KvmApi;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let creds = Credentials {
        username: "admin".into(),
        password: "<password>".into(),
        otp: None,
        otp_secret: None,
    };

    let client = UgosClient::connect("192.168.1.10", 9443, creds).await?;
    let vms = client.vm_list().await?;

    for vm in &vms {
        println!("{}: {}", vm.vir_display_name, vm.status);
    }

    Ok(())
}

MCP Server

Configure in your MCP client (e.g. Kiro, Claude Desktop):

{
  "mcpServers": {
    "ugos": {
      "command": "ugos-mcp",
      "env": {
        "UGOS_HOST": "192.168.1.10",
        "UGOS_USER": "admin",
        "UGOS_PASSWORD": "<password>"
      }
    }
  }
}

Multiple NAS targets are supported:

{
  "mcpServers": {
    "ugos": {
      "command": "ugos-mcp",
      "env": {
        "UGOS_HOST_1": "192.168.1.10",
        "UGOS_USER_1": "admin",
        "UGOS_PASSWORD_1": "<password>",
        "UGOS_NAME_1": "nas1",
        "UGOS_HOST_2": "192.168.1.11",
        "UGOS_USER_2": "admin",
        "UGOS_PASSWORD_2": "<password>",
        "UGOS_NAME_2": "nas2"
      }
    }
  }
}

The server covers what the CLI covers: shared folders, user accounts, groups and their permissions, the file services, hardware and time, the network, the SAN Manager, recycle bins, file versions, the Log Center, firmware and backup, and in Docker the logs, the app's own log, networks, updates and commands inside containers (ugos_docker_exec runs code in a container, usually as root). Reading is open. Everything that changes goes through the same checks as ugos-cli and is read back, so a request UGOS answered with success and did not carry out comes back as an error.

The tools do what the CLI does, including what is dangerous. Passwords (for ugos_user_create, ugos_user_update, rsync, CHAP) and roles are parameters of the tools, and so is force. That means they pass through the model and its logs. Switch off or gate the tools a model should not have: an MCP client can allow tools one by one, and the delete, reset, restore, install, empty and password tools are the ones to look at first.

What --force is for in the CLI, force is for here, with the same guard in front of it. A tool refuses what restarts the NAS, deletes data, cuts connections, opens a way in or cannot be undone, and says so in a message that tells the model to ask the user and repeat with force. A model that repeats it without asking has been told not to.

Agent skill

An AI coding tool works better with ugos-cli when it knows the tool is there: when to reach for it instead of virsh or the web UI, how to pass credentials without typing a password into a chat, and which commands change or remove something and need your yes first. ugos-cli ships an Agent Skill for that. Its command reference is generated from the binary that installs it, so it matches the build.

ugos-cli skill             # where it is, and what would happen
ugos-cli skill --install   # install where it is missing, after asking
ugos-cli skill --decline   # stop offering it
ugos-cli skill --remove    # take out the copies ugos-cli installed

The skill goes only into the skill folders of AI tools found on the machine, such as ~/.claude/skills for Claude Code and ~/.agents/skills, which Codex, Gemini CLI and GitHub Copilot read. Nothing is installed without your consent, and a place you declined is not offered again. A copy ugos-cli installed and nobody edited is brought up to the running version without asking, after any command that connects to a NAS. A copy you edited is left alone.

ugos-cli never asks a question during a normal command, so scripts and CI are never blocked. At most it prints one line on stderr, once, when you run a command in a terminal and an AI tool without the skill is installed. Set UGOS_NO_SKILL_HINT=1 to silence it. skill --install asks only on a terminal; without one it needs --yes. The packages (Homebrew, .deb, AUR) do not install the skill, and ugos-mcp does not touch any files.

Creating and updating VMs

vm create and vm update map directly onto the fields of the CreateVirtualMachine and UpdateVirtualMachine request bodies and take the same flags. Device flags are repeatable and take either a short form or a key=value,... list; sizes accept k, m, g and t suffixes, and a bare number means MiB. UGOS itself counts in KiB — the CLI converts, so --disk 40g really is 40 GiB.

# Two disks on different buses, two NICs, two ISOs, USB passthrough
ugos-cli vm create win11 \
    --os windows --os-version win11 \
    --cores 8 --memory 16g \
    --disk size=60g,bus=ide \
    --disk size=500g,bus=sata \
    --iso /volume1/iso/win11.iso \
    --iso /volume1/iso/virtio-drivers.iso \
    --nic name=vnet-bridge0,type=e1000e \
    --nic name=vnet-nat,type=e1000e,mac=52:54:00:12:34:56 \
    --usb vendor-id=0x8087,product-id=0x0033,bus-id=1,device-id=4 \
    --graphics qxl --keyboard de --autostart
Flag Short form Keys
--disk 40g size, bus, dev, path, order
--iso /path.iso path, dev, order
--nic vnet-bridge0 name, type, mac
--usb — vendor-id, product-id, bus-id, device-id, vendor-name, product-name
--share — passed through verbatim

On create, device names (vda, sda, hda, …) are derived from the bus type and boot order is numbered disks-first, unless dev= or order= says otherwise. On update, a newly added disk is left unnamed on purpose, because UGOS insists on naming it (see below). --usb and --share also accept a raw JSON object when the generated body needs to look different.

Updating

vm update starts from the VM's current configuration, so only what a flag names is changed and everything else is sent back verbatim. The VM has to be shut off — UGOS answers 3002, Fail to edit virtual machine for a running one — and its UUID is always the one of the VM named on the command line.

Besides the flags above, which replace a whole device list, update edits lists incrementally. --set-* picks the entry to change with a match= selector (disk by dev, ISO by dev or path, NIC by name or MAC):

# Grow a disk, keeping its backing file
ugos-cli vm update CachyOS --set-disk match=vda,size=200g

# Attach a second disk and an install ISO, drop a NIC
ugos-cli vm update CachyOS \
    --add-disk 500g \
    --add-iso /volume1/iso/rescue.iso \
    --rm-nic vnet-nat

# Plain resource changes
ugos-cli vm update CachyOS --cores 8 --memory 32g --autostart

# Preview instead of sending
ugos-cli vm update CachyOS --set-nic match=vnet-bridge0,type=e1000 --dry-run
Operation Flags
Replace the whole list --disk, --iso, --nic, --usb, --share
Append one entry --add-disk, --add-iso, --add-nic
Edit one entry --set-disk, --set-iso, --set-nic
Remove one entry --rm-disk, --rm-iso, --rm-nic

Edits run in the order remove, set, add, so a --rm-disk vdb --add-disk 100g pair really does replace that disk rather than cancelling out — though for a pure resize --set-disk is the better tool, since it keeps the existing backing file instead of starting from an empty one. A selector that matches nothing is an error rather than a silent no-op.

Spec files

Anything the flags do not cover can come from a full JSON spec, which the flags then override. For create, --dry-run prints the request body instead of sending it and needs no NAS connection, so specs can be built and inspected offline; for update it still reads the VM's current configuration first.

# Clone the configuration of an existing VM under a new name
ugos-cli -o json vm show CachyOS > spec.json
ugos-cli vm create CachyOS-2 --spec-file spec.json --memory 32g

# Import an OVA (parse, then create from the parsed spec)
ugos-cli -o json ova parse /volume1/ova/appliance.ova > spec.json
ugos-cli vm create appliance --spec-file spec.json

# Inspect what would be sent
ugos-cli vm create test --spec-file - --dry-run < spec.json

A repeatable flag replaces the corresponding list from the spec file rather than appending to it. The UUID in a spec file is never used: create always generates a fresh one, and update always keeps the one of the VM it was pointed at.

What the live tests showed

create and update were verified end to end against a real NAS (UGOS app build 656, 2026-08-18): a VM is created and starts; CPU, memory and disk size are changed and it starts again; a second disk is added and removed; it is renamed, force-stopped and deleted. Five findings from those runs are baked into the client:

  • Sizes are KiB, not bytes — for disks just as for memory. Sending bytes asks for 1024 times the intended size; UGOS accepts the create but the domain then fails to start.
  • keyboardLanguage must be a real QEMU keymap. The web UI sends en-us; a plain en is accepted by CreateVirtualMachine and then makes every start fail with 3037, Failed to start.
  • storageUUID is mandatory on CreateVirtualMachine — without it the answer is 3000, Fail to create virtual machine. The client resolves it from storage_name, so --storage volume1 is enough, but a --dry-run body shows it empty because resolving needs the NAS.
  • UGOS assigns the VM UUID itself and ignores virtualMachineName in the body, so vm create reports the UUID it finds in the listing afterwards.
  • A newly added disk must carry neither dev nor path. UGOS assigns both and answers 3002, Fail to edit virtual machine when the body names them itself, so vm create names its disks and vm update leaves new ones unnamed. Growing an existing disk with --set-disk keeps its backing file.

One difference to the web UI remains: it picks defaults per OS type that this CLI does not — ide plus an e1000e NIC for Windows and other, virtio for Linux. vm create always defaults to virtio, so a Windows guest without virtio drivers needs --disk size=60g,bus=ide --nic name=vnet-bridge0,type=e1000e.

Where UGOS answers with a bare code, the client asks the validators the web UI uses and turns the answer into something readable: a taken VM or network name, a VM asking for more memory than the host has, or a network still attached to VMs. Note that CreateVirtualMachine does not check memory itself — such a VM is created and only fails to start.

Still inferred. USB passthrough and shared-directory bodies have never been sent to a NAS, and a second NIC was accepted but not exercised on a running guest. Use --dry-run to inspect a body before sending it.

Installation

Homebrew (macOS, Linux)

brew install metaneutrons/tap/ugos-cli

Debian and Ubuntu

Take the .deb for your architecture from the latest release and install it with apt, which resolves dependencies for a local file too:

sudo apt install ./ugos-cli_<version>_amd64.deb

An APT repository under deb.metaneutrons.cc is being prepared. It does not serve yet, so do not add it as a source.

Arch Linux

There is no AUR package yet. Use the Linux archive from the releases page.

From GitHub Releases

Every release carries binaries for Linux, macOS and Windows, each on x86_64 and aarch64, plus .deb packages for amd64 and arm64. See the releases page.

See docs/packaging.md for how these are built and verified.

From Source

cargo install --git https://github.com/metaneutrons/ugos-cli ugos-cli
cargo install --git https://github.com/metaneutrons/ugos-cli ugos-mcp

As a library

The crates are not published on crates.io. Depend on the repository directly:

[dependencies]
ugos-client = { git = "https://github.com/metaneutrons/ugos-cli", tag = "v0.9.0" }

API documentation

UGOS publishes no API documentation, so everything here was reconstructed from the web UI's JavaScript bundles and verified against real hardware. The notes are kept because the reasoning is easy to lose and expensive to redo.

Document Covers
api-overview.md Every module found, and which are documented
api-auth.md Login flow, RSA key exchange, session tokens
api-tls.md The version 1 certificate and how it is pinned
api-encryption.md The AES-GCM request wrapping and when UGOS uses it
api-kvm.md Virtual machines, snapshots, networks, storage, images
api-docker.md Containers, images, compose projects
api-files.md File manager, including upload and download
api-downloadcenter.md Queuing downloads for the NAS to fetch
api-system.md Machine info, monitoring, processes, services
api-snapshot.md Filesystem snapshots of shares and homes
api-shares.md Shared folders, their access rules, and the SMB service
api-users.md Accounts, groups, permissions, password policies, invitations, import
api-storage.md The Storage Manager: pools, volumes, disks (read only)
api-network.md Interfaces, DNS, gateways, bonds, bridges, Wi-Fi, traffic control
api-hardware.md Buzzer, CPU, fans, LEDs, power, UPS, GPU, time, language, SSH and Telnet
api-fileservices.md SMB, FTP, NFS, rsync and WebDAV
api-san.md iSCSI targets, LUNs, initiator groups
api-recycle.md Recycle bins and their cleanup plans
api-versions.md The File Version Explorer
api-logcenter.md The event and transfer log, archiving, notifications
api-update.md Firmware, configuration backup, resets, about, thumbnails
packaging.md Release channels, signing and reproducibility
api-backup.md There is no data backup app; the configuration backup is in api-update.md

Implementation Status

Implemented ✅

Resource Operations
VM list, show, start, stop, force-stop, reboot, force-reboot, delete, create, update
Snapshot list, create, delete, revert, describe
Network list, show, create, update, delete
Storage list (with VM count), usage, add, delete, df (usage per VM)
Image list, upload (file or URL), register, delete, usage
USB (usb) list
PCI passthrough (passthrough) list devices
VNC list links, generate noVNC link
OVA export, parse
Log (log) system log across all modules, the transfer log, filters, time range
VM log (vm log) KVM audit log, list operators
User list, show, create, update (email, description, role, groups, home folder, password, disable, expiry), delete, share permissions, quota per volume, password rules and expiry, second factor off, avatars, invitations, import
Group list, create, edit, delete, share permissions
Host (info, overview) CPU cores and memory; load plus every VM at once
System hardware and firmware info, live CPU/memory/disk/network/fan readings, processes, services
Download queue a URL for the NAS to fetch, list, check, status, remove
Files (fs) list a directory, list volumes, upload, download, create, rename, delete
Filesystem snapshots (snapshot) list folders, list, create, edit, delete, clone
Shared folders (share) list, show, create, update (quota, visibility), delete, show and set access rules
File services (smb, ftp, nfs, rsync, webdav) status, settings, start, set, stop; SMB discovery services and Time Machine targets, SMB cache
Hardware (hw, time, lang, terminal, `system hostname finder`)
Network (net) interfaces, DNS, gateways, proxy, bonds, bridges, Wi-Fi, traffic control
Storage Manager (pool, volume, disk) pools, volumes, disks, SMART, test plans (read only)
SAN Manager (san) iSCSI setting, targets, LUNs, initiator groups
Recycle bins (recycle) switches, bins, list, restore, empty, delete for good, cleanup plans
File versions (version) folder settings, listing at a time, history, copy a version, deleted files
Log Center (logcenter) archive policy and viewer, notifications, file manager logging, clear, export
Firmware (update) status, settings, install, install from a file, signing keys
Configuration backup (backup) save, restore, network reset, factory reset
Machine (`system about ports
Docker container (docker) list with CPU, memory, ports and updates, show, create, start, stop, restart, kill, remove, update, clone, batch-operate, logs (also following), run a command, interactive shell, list and end terminals
Docker image list with the containers that use each one, search, download, delete, export, load (URL/path)
Docker network and updates network-ls, network-show, network-check (subnets that may shadow other networks, also warned about after project-create, project-update and project-start), which images have updates, the update settings
Docker app log (docker oplog) who deployed, started or removed what, with filters and export
Docker registry list/add/delete/switch mirror, HTTP proxy get/set
Docker overview engine status, resource usage
Docker compose (docker project-*) list, show, create, start, stop, restart, remove, logs (also following)
Auth RSA key exchange, PKCS1v1.5 encryption, session tokens, TOTP second factor, auto re-auth
Transport certificate pinning on first use, shared by CLI and MCP server

Docker container create/update were reverse-engineered against the real CreateContainer request body (live-captured 2026-08-06, see docs/api-docker.md) — this caught two bugs that had never actually been exercised against a live NAS: port_mapping was built with wrong field names (hostPort/protocol instead of the real nasPort/portType), and subnet_settings/gpu_ids were entirely missing from ContainerDetail. Both are fixed now; the CLI's docker container create --port flag has been tested end-to-end against a real NAS (nginx container, port mapping, env vars).

Docker compose project management (create/list/show/stop/remove) was reverse-engineered against the live CreateProject/GetProjectListV3/ StopProject/DownProject endpoints (live-captured 2026-08-07, see docs/api-docker.md) and tested end-to-end on a live NAS (a two-service nginx+redis project, created, verified running, stopped, and removed). The start/restart endpoints (StartProject/RestartProject) are implemented by analogy with StopProject and the container-level start/restart pattern but have not been live-verified — confirm before relying on them for anything critical.

Written, not run against a NAS

These are built from the web UI's own code and unit tests, guarded by --force, and have not been run on a real NAS, because that cannot be undone or the NAS tested had nothing to run them against. Check them on a machine you can afford to lose before relying on them:

  • firmware install and install from a file, restoring a configuration backup, the network reset and the factory reset, reboot and power off
  • UPS settings, GPU mode, memory compression off, setting the clock by hand, switching SSH from off, Telnet, a custom fan curve
  • rsync start (the old password could be lost if UGOS reads an empty one differently), the SMB cache clear, a changed FTP port
  • per-account quotas (the NAS offers none; the unit is read from the bundle), the second factor, switching invitations on or off, approving an applicant, importing accounts
  • clearing the log for good (the call was run for a time before the first entry, which removes nothing), archiving
  • Docker: docker updates-set --plan (only the reminder and the time were changed and restored, the days and the type of the schedule are passed through because their meaning is not known), docker terminal-rm --force of a terminal someone else is connected to, docker shell on Windows (the key handling is the same code, it was run on macOS in a pseudo terminal), and the positive case of docker updates (it showed no pending update when it was run)

Not Yet Implemented

Resource Notes
Image rename RenameImage answers successful and renames nothing; field names unknown
OVA import (one step) ova parse reads an OVA into a VM spec; creating the VM from it is still a manual second step
Data backup UGOS has no data backup app. The backup_restore calls are the configuration backup, wired as backup. See docs/api-backup.md
Snapshot restore snapshot/snapshot/restore rolls a folder back; destructive and untestable without risking real data. snapshot clone covers recovery without it — see docs/api-snapshot.md
Recycle search, version download, thumbnail quality The calls are described in the docs; the first two have a replacement (recycle ls, version copy and fs get), the quality values are not in the bundle
Storage Manager changes Pools, volumes and disks are read only
Docker images from Docker Hub (ObtainAllImages), private registry flags Documented in docs/api-docker.md, not wired: docker search covers the first, the second only fills in a label
Non-KVM modules Photo, video, music, antivirus, the vault and the like

Authentication

UGOS uses a multi-step auth flow:

  1. RSA key exchange — POST /verify/check returns an RSA public key
  2. Password encryption — PKCS1v1.5 padding (not OAEP)
  3. Login — POST /verify/login returns a session token + cookies, or, when the account has a second factor, enable_otp and no token
  4. Authenticator code — POST /verify/code/login with a type-1 (authenticator app) code. Other second factors are not supported. The request follows the web client's twoFAVerify shape (trust: false, so ugos-cli is not registered as a trusted device) and has not been confirmed against a live capture of that endpoint
  5. Authenticated requests — cookies + ?token= query parameter

The client handles this automatically, including transparent re-authentication when tokens expire (UGOS error code 1024, about 25 minutes).

UGOS_OTP is a single code, also available as --otp. It is spent on the first login, so the renewal after expiry fails unless you pass a new one. UGOS_OTP_SECRET is the TOTP secret, as base32 or as an otpauth://totp/ URI (HMAC-SHA1, 6 digits and 30 seconds unless the URI says otherwise). It is an environment variable only: a flag would show up in ps and the shell history, and the secret produces valid codes for as long as it is stored. A fresh code is generated on every login, including that renewal. When both are set, the secret is used. ugos-mcp reads the same variables, with _N on numbered targets (UGOS_OTP_SECRET_1). The library crate does not read the environment; put the code or the secret on Credentials.

Storing the secret has a cost. With the password and the secret on one machine, the second factor no longer protects that machine against whoever controls it. It still protects against a leaked password, which is the usual case for a service account. It is also stronger than a trusted device, which can be revoked on the NAS. UGOS shows the secret only once, as a QR code when two-factor authentication is enabled.

Transport security

UGOS serves a self-signed X.509 version 1 certificate, which no ordinary certificate parser will accept. Rather than trusting whatever is presented, the client pins the certificate on first contact and refuses anything else afterwards, the way SSH treats host keys. Fingerprints are stored per host:port in known_hosts.json in the user's config directory.

Flag Effect
(none) Pin on first contact, require a match afterwards
--tls-trust-new Record a changed certificate, for renewals or reinstalls
--tls-insecure Skip the check entirely

The first connection is only as trustworthy as the network it happens on, so the fingerprint is printed for comparison against the device. The handshake signature is verified against the pinned certificate's own key, which is what makes the pin meaningful — see docs/api-tls.md for why that needs handling by hand, and why requests are not all encrypted.

Tested Devices

Model UGOS Version Notes
DXP480T Plus 1.20.0.0142 Reads and every write that can be undone, run against this machine. What was not run is listed above
DXP480T Plus 1.18.1.0098 The KVM, Docker, files, shares and first account commands
DXP480T Plus 1.14.1.0107 Earlier verification
DXP4800 Plus 1.14.x Reported working, not verified here

UGOS moves fields around between builds, so a mismatch is worth reporting. virID vanished from the VM listing in one such build and broke vm list until every field but the name was made optional.

Requirements

  • Rust 1.98+ (edition 2024)
  • Network access to the NAS over HTTPS (port 9443)
  • The KVM app for vm, network, storage, image, usb, vnc and ova; the Docker app for docker. The remaining groups need neither.

License

This project is licensed under the GNU General Public License v3.0, the ugos-client library included. A library would ordinarily be the place for the weaker copyleft of the LGPL; here it is not, because the library serves this project's own programs and every release so far has been GPL.

About

CLI, MCP server, and Rust client library for UGREEN NAS (UGOS) management

Topics

Resources

Contributing

Security policy

Stars

14 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages