
letkite
com.letkite/letkite
Run commands and manage files on your own machines. Needs a LetKite account; OAuth sign-in.
Documentation
letkite-router
OpenWrt packages and the LuCI app for the LetKite agent.
LetKite lets AI assistants on your account reach your machines, and, through a router, the devices behind it (a NAS, a printer, a camera's admin page, a PC to wake), within limits you set on each machine. On a router, the agent can also wake computers on the LAN and manage the router itself.
This repository contains:
letkite-agent: an OpenWrt package that installs the LetKite agent.luci-app-letkite: Services → LetKite in LuCI. It shows the agent's status, pairs the router with your account (a code and a QR code), pauses and resumes the agent, sets its permissions, routes the LAN devices you choose through your account's rules, and shows its log.
What this is not. The agent itself is not here. It is a closed-source program, built and signed by LetKite, and published on get.letkite.com. This repository is the MIT-licensed packaging and LuCI app around it. The package does not contain the program: it downloads one exact release, checks its SHA-256, and installs it (How the program is verified).
For router and device makers
We work with router, NAS and device makers to preinstall or integrate the LetKite agent:
- firmware images with the agent built in;
- OEM feeds;
- LuCI branding;
- joint testing on your hardware;
- new architectures, such as mipsel.
Write to contact@letkite.com with the subject starting with [Router partnership]. Please include:
- your company;
- the devices and SoCs;
- the OpenWrt version or vendor SDK;
- expected volumes;
- your timeline.
Please do not post this in a public issue.
Supported
| OpenWrt | 25.12 (apk) and 24.10 (opkg). Vendor firmware based on other OpenWrt versions is not supported yet. |
| Architectures | x86_64; aarch64 (MediaTek MT798x, Rockchip, Raspberry Pi, armsr…); ARMv7 with a VFPv3 FPU (IPQ40xx, mvebu, armsr…) |
| Not supported | MIPS (mipsel, e.g. MT7621; mips), ARMv7 without VFPv3 (some BCM53xx), ARMv5/v6 |
| Hardware | 256 MB of RAM or more. Free flash for two copies of the program (about 16 MB), because an update writes the new copy before removing the old one. |
On an unsupported router, the install stops with a message that names the reason, and nothing is installed.
Install from the LetKite feed
OpenWrt 25.12 (apk):
wget -O /etc/apk/keys/letkite-apk.pem https://get.letkite.com/openwrt/keys/letkite-apk.pem
echo 'https://get.letkite.com/openwrt/25.12/packages.adb' >> /etc/apk/repositories.d/customfeeds.list
apk update
apk add luci-app-letkite
OpenWrt 24.10 (opkg):
wget -O /tmp/letkite-usign.pub https://get.letkite.com/openwrt/keys/letkite-usign.pub
opkg-key add /tmp/letkite-usign.pub
echo 'src/gz letkite https://get.letkite.com/openwrt/24.10' >> /etc/opkg/customfeeds.conf
opkg update
opkg install luci-app-letkite
luci-app-letkite pulls in letkite-agent. Install only letkite-agent if you don't use LuCI. Translations: luci-i18n-letkite-zh-cn, -ja, -ko, -fr, -de.
The packages are architecture-independent (all), so there is one feed per OpenWrt version.
Install over SSH
Without the feed, the install script does the same job: it downloads the agent, checks it against the release's SHA256SUMS, and installs it in /opt/letkite-agent. Log in as root and run:
wget -qO- https://get.letkite.com/install.sh | sh
To pair the router as part of the install, use the command shown in the dashboard under Add device → Router (OpenWrt). It is the same line followed by -s -- enroll ….
Pairing in LuCI
- Open Services → LetKite → Overview. An unclaimed router automatically shows a large code, a QR code and a countdown.
- At the dashboard, choose Add device → Enter the code, enter the displayed code, sign in and approve. The id
/devicelink and QR code are alternatives. - LuCI shows success with the node name. While the page stays open, expired codes are replaced automatically. Closing it stops browser polling and requests for new codes; the service can finish the current request until its code expires. A refusal requires Try again.
Automatic claim needs an agent with the Card A claim contract (newer than 1.9.1). With older agents, including the pinned 1.6.1, LuCI shows a Pair button and uses the existing enrollment flow. The package pin must only be advanced with scripts/release-table.py after that release is published.
Preinstall in firmware: owner claims it
Set /etc/config/letkite in the image (or with UCI before installing the package):
config letkite 'main'
option claim '1'
At runtime, package post-install and the first-boot /etc/uci-defaults/90-letkite-claim run the shared setup script. With claim=1, it runs letkite-agent install --claim when there is no identity or setup file. Existing /etc/letkite/setup.toml (custom gateway, CA, name, tags) and enrolled identities are preserved; plain install starts their service. At post-install, a failed claim attempt warns and falls back to plain install so older agents do not fail package installation. First boot remains strict: an unsuccessful setup is retried on the next boot. First boot also runs with claim=0 when setup.toml exists, and skips setup if the agent service already exists. A maker’s own uci-defaults script that sets claim=1 must sort before 90-letkite-claim. The default is claim=0; opening LuCI can also initialize claim mode on an ordinary fresh installation.
The package pre-install download is skipped in Image Builder/buildroot. Include a verified agent with claim support at files/opt/letkite-agent/letkite-agent (executable), together with the packages and the UCI option; otherwise the first-boot script reports a missing binary and cannot start the service. Never include node.key, agent.toml or tokens. A production setup file may be empty. Keys are generated on the device; sysupgrade preserves the configuration and agent installation. SSH login displays a local-file-only reminder to run letkite-agent claim while unclaimed.
See device-integration.md §5 and §5.1 for setup.toml, first-boot behavior and the exact CLI/JSON contract (status --json --refresh, enrollment, install --claim). LuCI uses the short status-with-refresh call through a write-authorized rpcd method; read-only status never requests or exposes codes, and read-only logs filter claim/code lines.
Pause disconnects the agent for 30 minutes, an hour, a day, a custom time, or until you resume it. Permissions shows the router's local ceiling (see Permissions). LAN routing chooses the devices that follow your account's routing rules (see LAN routing). Log shows the agent's lines from logread.
Permissions
The router's local ceiling, /etc/letkite/ceiling.toml, is the most AI assistants may ever do on this router, whatever your LetKite account allows: the dashboard can narrow it but never exceed it. Only root can change it. Services → LetKite → Permissions shows it.
Switches. Seven of its keys are true or false, and LuCI turns them on and off:
| Switch | On means |
|---|---|
handover | someone at the device may hand it over to AI assistants and leave (meant for desktops) |
direct | direct peer-to-peer transfers with the account's other devices |
updates | the agent installs newer releases signed by LetKite |
env | the environment variables set in the dashboard are written on the router, for the commands run there |
accelerate | traffic to LetKite's own servers goes through its access points |
telemetry | the agent sends its crash reports (version, system, where it failed; never commands, paths or output) |
mesh | the router joins the account's mesh network, so its other devices can reach it as the account's rules allow |
Turning on handover, direct, env or mesh asks for confirmation first, because each widens what AI assistants on the account can do or reach on this router. The other three are about how the agent itself runs.
LuCI saves a switch with letkite-agent ceiling set <switch> <true|false>, which changes only that line of the file. The agent reads its ceiling only when it starts, so LuCI then restarts it (/etc/init.d/letkite-agent restart); the router is offline for LetKite for a few seconds.
Other limits. The rest of the ceiling is not true or false, so LuCI shows it read-only:
| Key | What |
|---|---|
shell | off or full: whether AI assistants may run commands, shell sessions and terminals here. (sandboxed needs Landlock, which OpenWrt's kernel does not have.) |
files | the most of the file system they may be granted; [] is nothing, ["*"] no limit |
deny | paths always hidden |
gui, gui_apps | screen access; off and [] on a router |
tunnel_targets | where tunnels may connect, such as "192.168.1.0/24" or "192.168.1.10:80" |
keep_awake, local_control | power, and who at the device may pause the connection |
To change them, edit the file over SSH, check it, and restart the agent:
vi /etc/letkite/ceiling.toml
letkite-agent ceiling --path /etc/letkite/ceiling.toml # prints what the agent reads, or the error
/etc/init.d/letkite-agent restart
Every key must be present and unknown keys are refused. The agent does not start with a ceiling it cannot read; LuCI then shows why.
LAN routing
Devices on the router's LAN (phones, TVs, a guest's laptop) can follow your LetKite account's routing rules (the dashboard's Routing: AI tools, your own rules, or everything) without the agent installed on them. Choose them under Services → LetKite → LAN routing: tick Route chosen devices, then the devices (from the router's DHCP leases, or a MAC address you add), and Save. The agent picks the change up within 5 seconds; nothing restarts.
What happens:
- The agent adds its own nftables table,
inet letkite_lan(fw4's rules are not changed). It redirects the TCP of the chosen devices (by MAC address) to the agent on port 7892, and only when it comes in on an interface of fw4'slanzone; nothing that arrives on the WAN, a VPN or another tunnel is touched. Traffic to the router itself and to private, link-local and mesh addresses is left alone. - The agent takes the site's name from the TLS handshake (SNI) or the HTTP
Hostheader, and decides as the rules say: direct, through LetKite's exit, or refused. Connections without a name are decided by their address. - Block QUIC (on by default) refuses the chosen devices' UDP port 443. Browsers then fall back to TCP, which the rules apply to; without it, sites that use QUIC bypass the rules.
- Nothing is routed while routing is off for this router (in the dashboard, with
route = "off"in the ceiling, orletkite-agent route off). The same holds when the switch is off or no device is chosen, and while the agent is paused (Pause, orletkite-agent pause): the table is removed and made again on resume.
If the agent stops, the LAN keeps working. The chosen devices stay in the redirect for 15 seconds at a time, and the running agent renews them every 5 seconds. If the agent is stopped, crashes or hangs, they go straight out again within 15 seconds. A clean stop removes the table at once, and so does removing the package.
The settings are in /etc/config/letkite:
config lanroute 'lan'
option enabled '1'
option block_quic '1'
list client 'aa:bb:cc:dd:ee:ff'
# option port '7892'
letkite-agent route status shows a lan line: how many devices are routed, or why not.
Not routed yet: UDP (other than refusing QUIC), DNS (devices keep using the router's resolver), and whole interfaces or VLANs. Routing needs fw4 (OpenWrt 22.03 or later). Only devices on the lan firewall zone are routed; LuCI marks a device on another zone (a typical guest network) as not routed. The lan zone's input policy must be accept (the default), or the redirected connections would be refused; LuCI warns when it is not.
Uninstall
apk del -r letkite-agent # 25.12
opkg remove --force-removal-of-dependent-packages letkite-agent # 24.10
This removes letkite-agent together with what depends on it (luci-app-letkite and its translations).
Removing letkite-agent runs the agent's own letkite-agent uninstall, which stops and removes its procd service and sysupgrade keep list, and then deletes /opt/letkite-agent. /etc/letkite stays. It holds the node key, the enrollment and the ceiling, so installing again brings back the same node. To forget the node completely, also delete that directory and remove the router in the dashboard:
rm -rf /etc/letkite
How the program is verified
The chain of trust is feed signature → package → pinned SHA-256:
-
Your package manager installs
letkite-agentonly from a feed index signed with LetKite's feed key: usign on 24.10, an apk v3 key on 25.12. The index lists each package's hash. -
The package's pre-install script carries a table generated from the agent release: the version and the SHA-256 of the program for each architecture (
packages/letkite-agent/files/release). -
The script downloads
https://get.letkite.com/agent/v<version>/letkite-agent-router-linux-<arch>(the router build: the agent without the desktop parts, kept within a router's flash budget;letkite-agent-linux-<arch>, the full build, for releases from before the router build), checks it withsha256sum, and installs it only on an exact match. On a mismatch, an unsupported CPU, too little flash or a failed download, the script fails, the install command fails, and no program and no service are left on the router. opkg (24.10) then stops, so the package is not installed at all. apk-tools (25.12) goes on after a failed pre-install script: it keeps a record of the package, which holds only the release table and is flagged with a script error.apk del -r letkite-agentremoves it. -
On install and on upgrade, a program already in
/opt/letkite-agentis kept when it is newer than the table (the agent updated itself since). One of the same version is kept only if its SHA-256 matches the pin; otherwise the script replaces it with the pinned program, checked as above. That is how a router that runs the full build (installed, or updated to, before the router build) moves to the router build of the same version. An older program is replaced too.
The table is regenerated only from a release whose release.json carries a valid Ed25519 signature from one of LetKite's agent release keys (keys/agent-release-keys.txt, the same keys the agent itself trusts). SHA256SUMS must also agree with release.json. scripts/release-table.py does this; the scheduled bump workflow runs it and opens a pull request, and CI checks the pinned table against the signed release on every change.
Afterwards, the agent installs its own procd service (letkite-agent install). It then updates itself: it installs only releases signed with the same release keys, verifies their size and SHA-256, and rolls back an update that does not come up.
Why apk audit stays clean. The package does not own /opt/letkite-agent/letkite-agent; the program file is not in the package. The agent replaces that file when it updates itself, and a file the package owned would then show up as modified. The package owns the release table, setup helper, UCI configuration, first-boot script and SSH reminder. The init script and the sysupgrade keep list belong to the agent, which writes them on install and removes them on uninstall, so the package and the agent never disagree about the service.
Security
Please report vulnerabilities privately to contact@letkite.com with the subject starting with [Security]. Do not open a public issue. See SECURITY.md.
Contributing
See CONTRIBUTING.md. Every commit needs a Signed-off-by line (DCO).
License
MIT, see LICENSE. This covers this repository only. The LetKite agent is distributed by LetKite under its own terms. The vendored QR code library is MIT licensed, see THIRD_PARTY_NOTICES.md.
No installation packages available.