tuna-tiny
tuna-tiny is a tunnel client of about 2 MB. It runs a single HTTP or TCP tunnel and does nothing else. It is meant for OpenWrt and MikroTik routers, embedded devices, FROM scratch containers and CI.
There are builds for every Linux architecture Go supports: amd64, 386, arm64, armv5, armv6, armv7, mips, mipsle, mips64, mips64le, riscv64, loong64, ppc64, ppc64le, s390x. See What is not supported for the limits. For Windows, macOS and FreeBSD, use tuna-cli.
How it differs from tuna-cli
tuna-tiny is built on the Go SDK and does one thing: keeps a tunnel up, reconnecting after a dropped connection and keeping the address. Everything else is only in the full tuna-cli:
- Tunnels: middleware (password, headers, IP filtering for HTTP, webhook signature verification), traffic inspector, file server, WebDAV, HTTPS applications, a config file with several tunnels.
- Services: tunnels as system services with
tuna service. - Sign-in: through the browser with
tuna login. tuna-tiny works only with an API key. - Platform: secrets, monitors, mesh, domains and the rest of Tuna.
Authentication
tuna-tiny accepts only an API key with the tunnels:connect permission: the "For tunnels" preset or "Launch tunnels". Pass the key in the TUNA_API_KEY variable or with the --api-key flag. The variable is safer, since the flag shows up in ps. More on keys in Sessions and API keys.
Installation
- Linux
- Alpine
- Docker
- OpenWrt
- MikroTik
Download the binary for your architecture and make it executable:
curl -fLo tuna-tiny https://releases.tuna.am/tuna-tiny/latest/tuna-tiny_linux_amd64
chmod +x tuna-tiny
Builds: amd64, 386, arm64, armv5, armv6, armv7, mips, mipsle, mips64, mips64le, riscv64, loong64, ppc64, ppc64le, s390x. The URL is https://releases.tuna.am/tuna-tiny/latest/tuna-tiny_linux_<build>. The armv5 build runs on any 32-bit ARM.
The binary is static and depends on neither system libraries nor system root certificates. For Windows, macOS and FreeBSD, use tuna-cli.
Packages are available for x86_64, x86, aarch64, armhf, armv7, riscv64, ppc64le, s390x and loongarch64. The OpenRC service runs tuna-tiny as nobody and restarts it 30 s after a crash.
K=tuna@fd6ba1797a0fb356fb4aa79dbbc8ce2a43346700b64e9f20be2d759e2724549c.rsa.pub
wget -O /etc/apk/keys/$K https://code.tuna.am/api/packages/tuna/alpine/key
echo https://code.tuna.am/api/packages/tuna/alpine/stable/main >> /etc/apk/repositories
apk add tuna-tiny
Save the key under exactly this name. With any other name apk rejects the repository with an UNTRUSTED signature error.
Set the key and arguments in /etc/conf.d/tuna-tiny:
TUNA_API_KEY="tak_xxx"
TUNA_TINY_ARGS="http 8080 -s my-app"
Start the service:
rc-update add tuna-tiny
rc-service tuna-tiny start
For a second tunnel, create another service instance with its own config, /etc/conf.d/tuna-tiny.ssh:
ln -s tuna-tiny /etc/init.d/tuna-tiny.ssh
The yuccastream/tuna-tiny image is built FROM scratch and is about 2 MB. Running it in Docker, Podman and Docker Compose is covered on the Containers page.
The package installs the /usr/bin/tuna-tiny binary, the /etc/init.d/tuna-tiny service and the /etc/config/tuna-tiny config. It needs about 2 MB of free space: check with df -h /overlay.
OpenWrt 25.12 and later
Add the repository and install the package. Updates come with apk upgrade.
K=tuna@fd6ba1797a0fb356fb4aa79dbbc8ce2a43346700b64e9f20be2d759e2724549c.rsa.pub
wget -O /etc/apk/keys/$K https://code.tuna.am/api/packages/tuna/alpine/key
echo https://code.tuna.am/api/packages/tuna/alpine/openwrt/main > /etc/apk/repositories.d/tuna.list
apk update && apk add tuna-tiny
Save the key under exactly this name. With any other name apk rejects the repository with an UNTRUSTED signature error.
OpenWrt 24.10 and earlier
There is no opkg repository, so the package is installed from a file. To update, download and install the new file the same way.
. /etc/openwrt_release
wget -O /tmp/tuna-tiny.ipk "https://releases.tuna.am/tuna-tiny/latest/openwrt/tuna-tiny_${DISTRIB_ARCH}.ipk"
opkg install /tmp/tuna-tiny.ipk
Package checksums are in tuna-tiny_openwrt_checksums.txt in the same directory, the signature in tuna-tiny_openwrt_checksums.txt.sig, the key is tuna.asc.
Configuration
/etc/config/tuna-tiny already contains two disabled tunnels: luci, the router web interface over HTTP, and ssh, SSH over TCP. Each config tunnel section is a separate tunnel.
Enable the LuCI tunnel:
uci set tuna-tiny.main.api_key=tak_xxx
uci set tuna-tiny.luci.enabled=1
uci commit tuna-tiny
/etc/init.d/tuna-tiny enable
/etc/init.d/tuna-tiny start
logread -e tuna-tiny
The public tunnel address appears in the log.
Options of a config tunnel section:
| Option | Meaning |
|---|---|
enabled | 1 runs the tunnel, 0 disables it |
protocol | http or tcp |
addr | local address: 80, 192.168.1.10:8080 |
subdomain, domain | HTTP: reserved subdomain or custom domain |
port, proxy_protocol | TCP: reserved port or its alias, PROXY protocol version |
cidr_allow, cidr_deny | TCP: subnet lists, list cidr_allow '203.0.113.0/24' |
api_key | key for this tunnel, if it differs from the one in main |
After editing the config, run /etc/init.d/tuna-tiny reload. The key reaches the process through an environment variable and does not show up in the process list.
If a tunnel stops with a permanent error (revoked key, deleted tunnel), the service tries to start it once a minute. Temporary errors, such as a dropped connection, tuna-tiny handles itself without a restart. A package update keeps the config and restarts the service if it is enabled.
Without a package
You can install the binary by hand. Pick the build by DISTRIB_ARCH from /etc/openwrt_release:
DISTRIB_ARCH | Build |
|---|---|
mips_* | linux_mips |
mipsel_* | linux_mipsle |
mips64_* | linux_mips64 |
mips64el_* | linux_mips64le |
aarch64_* | linux_arm64 |
arm_cortex-a* with _vfp or _neon in the name | linux_armv7 |
arm_arm1176* | linux_armv6 |
other arm_*, including arm_cortex-a7 and arm_cortex-a9 without FPU | linux_armv5 |
x86_64 | linux_amd64 |
i386_* | linux_386 |
riscv64_* | linux_riscv64 |
loongarch64_* | linux_loong64 |
powerpc_*, armeb_* | not supported |
wget -O /usr/bin/tuna-tiny https://releases.tuna.am/tuna-tiny/latest/tuna-tiny_linux_mipsle
chmod +x /usr/bin/tuna-tiny
If the router has no ca-bundle package and wget cannot download over HTTPS, download the binary on your computer and copy it over:
scp -O tuna-tiny_linux_mipsle root@192.168.1.1:/usr/bin/tuna-tiny
The -O flag is needed because the OpenWrt SSH server (dropbear) does not support SFTP. tuna-tiny itself does not need ca-bundle: the root certificates are built into the binary.
tuna-tiny runs in a RouterOS 7 container. Containers are available only on arm, arm64 and x86 devices (including CHR). MikroTik devices on MIPS, SMIPS, PowerPC and TILE are not supported.
Preparation
-
Enable containers. Confirm the change with the button on the device or a cold reboot. Then install the
containerpackage./system/device-mode/update container=yes -
Create a network for the container:
/interface/veth/add name=veth-tuna address=172.17.0.2/24 gateway=172.17.0.1/interface/bridge/add name=containers/ip/address/add address=172.17.0.1/24 interface=containers/interface/bridge/port add bridge=containers interface=veth-tuna/ip/firewall/nat/add chain=srcnat action=masquerade src-address=172.17.0.0/24/interface/list/member add list=LAN interface=containersThe last command is needed if the tunnel leads to the router itself: Winbox, WebFig or SSH. The default configuration allows them only from
LAN. If there is noLANlist (CHR, a router without the default configuration), skip the command: without firewall rules, access is already open. -
Set the key and the allowed subnets:
/container/envs/add list=tuna key=TUNA_API_KEY value=tak_xxx/container/envs/add list=tuna key=TUNA_CIDR_ALLOW value=203.0.113.0/24
Installing from a registry
Create the container from Docker Hub. The image is about 2 MB and fits in the router's internal storage.
/container/config/set registry-url=https://registry-1.docker.io tmpdir=tmp
/container/add remote-image=yuccastream/tuna-tiny:latest interface=veth-tuna \
root-dir=tuna-tiny envlist=tuna cmd="tcp 172.17.0.1:8291" \
name=tuna logging=yes start-on-boot=yes
If Docker Hub is unavailable, pull the same image from the mirror in the code.tuna.am registry:
/container/config/set registry-url=https://code.tuna.am tmpdir=tmp
/container/add remote-image=tuna/tuna-tiny:latest interface=veth-tuna \
root-dir=tuna-tiny envlist=tuna cmd="tcp 172.17.0.1:8291" \
name=tuna logging=yes start-on-boot=yes
Installing from a tar file
Without any registry, the router can download a ready-made image tar file itself. Platform: amd64 for CHR, arm64, armv7, armv5 for hEX Refresh.
/tool/fetch url=https://releases.tuna.am/tuna-tiny/latest/routeros/tuna-tiny_routeros_arm64.tar
/container/add file=tuna-tiny_routeros_arm64.tar interface=veth-tuna \
root-dir=tuna-tiny envlist=tuna cmd="tcp 172.17.0.1:8291" \
name=tuna logging=yes start-on-boot=yes
Checksums are next to it in tuna-tiny_routeros_checksums.txt, the signature in tuna-tiny_routeros_checksums.txt.sig. Verify the signature with the GPG key, the same one used for tuna-cli packages.
Starting
/container/start tuna
/log/print where topics~"container"
The example exposes the router's Winbox through a TCP tunnel, reachable only from the addresses in TUNA_CIDR_ALLOW.
Do not expose the router's Winbox, WebFig or SSH without TUNA_CIDR_ALLOW: bots will brute-force them.
Usage
Without a reserved subdomain (-s, subdomain in UCI) or port (-p, port), the tunnel address changes after every restart of tuna-tiny or the router. For routers and unattended devices, reserve the address.
tuna-tiny http <addr> [--api-key KEY] [-s SUBDOMAIN] [-d DOMAIN] [--log-format text|json]
tuna-tiny tcp <addr> [--api-key KEY] [-p PORT] [--proxy-protocol 1|2]
[--cidr-allow CIDR]... [--cidr-deny CIDR]...
[--log-format text|json]
tuna-tiny version
addr is the local address: 8080, 10.0.0.1:8080, http://localhost:8080 or unix:///path/to.sock.
| Flag | Variable | Meaning |
|---|---|---|
--api-key | TUNA_API_KEY | API key with the tunnels:connect permission |
-s | TUNA_SUBDOMAIN | HTTP: reserved subdomain |
-d | TUNA_DOMAIN | HTTP: custom domain |
-p | TUNA_TCP_PORT | TCP: reserved port or its alias |
--proxy-protocol | TUNA_PROXY_PROTOCOL | TCP: PROXY protocol version, 1 or 2 |
--cidr-allow | TUNA_CIDR_ALLOW | TCP: allow only these subnets; the flag can be repeated, the variable takes a comma-separated list |
--cidr-deny | TUNA_CIDR_DENY | TCP: reject these subnets |
--log-format | TUNA_LOG_FORMAT | text (default) or json |
The variable names are the same as in tuna-cli. A flag takes precedence over its variable.
Subnets are checked by the Tuna node, not by tuna-tiny, so unwanted connections never reach the device. That is why tuna-tiny has --cidr-allow even though it has no middleware.
Web interface over HTTP
export TUNA_API_KEY=tak_xxx
tuna-tiny http 80 -s my-router
tuna-tiny prints a public address such as https://my-router.ru.tuna.am, which opens the router's web interface. The my-router subdomain has to be reserved; without -s the address is dynamic.
An HTTP tunnel in tuna-tiny cannot be protected with a password yet: it has no middleware. Publish only services with their own authentication, and if you need a password or IP filtering, use tuna-cli.
SSH over TCP
tuna-tiny tcp 22 --cidr-allow 203.0.113.0/24
SSH will be reachable only from the 203.0.113.0/24 network.
JSON logs
With --log-format json, tuna-tiny writes one JSON line per event to stdout. This is easier to parse for wrappers and log collectors.
{"time":"2026-12-01T10:00:00Z","event":"connected","url":"https://my-router.ru.tuna.am"}
The event field is one of connected, reconnecting, reconnected, banner, session_expiring, terminated, local_error, error. Depending on the event, the line also has url, message, reason, error, retry_in and expires_in (in seconds).
Behavior
- After a dropped connection, tuna-tiny reconnects and keeps the public address. The pause between attempts is 1 to 15 s.
- After a process or router restart, the address changes unless it is reserved: the tunnel session lives only in the process memory.
- tuna-tiny retries temporary server errors on its own. It exits with code 1 only on permanent ones: a wrong or revoked key, a deleted tunnel, a plan limit.
- The
Hostheader and the PROXY protocol header reach the service unchanged. - API requests go through
HTTPS_PROXYif it is set. Connections to Tuna nodes are direct. - On startup, tuna-tiny logs a message with a link to this page if a new version is out. The message comes once, on the first connection: a tuna-tiny that has been running for months learns about the new version only after a restart. It does not update itself: update the package or the binary.
- On startup, tuna-tiny sends anonymous usage statistics, just like tuna-cli: OS, architecture, version, command and flag names without values.
Memory
tuna-tiny uses 12–14 MB of RAM. About 5 MB of that is unpacked code, since the binary is compressed with UPX. On devices with 32 MB of RAM this is noticeable. If memory is short, set the Go runtime variables GOMEMLIMIT and GOGC: memory use goes down at the cost of CPU load.
What is not supported
- 32-bit PowerPC (OpenWrt
mpc85xx,apm821xx) and 64-bit PowerPC before POWER8 (OpenWrtqoriq); - big-endian ARM (
armeb, oldixp4xx) and ARM OABI; - ARC, Xtensa, SPARC, m68k, SuperH, Tilera (MikroTik CCR1xxx);
- MIPS before MIPS32r1, IBM Z before z196;
- Linux kernels before 3.2, or before 5.19 for
loong64.
These are Go compiler limitations: it does not build for these platforms.