Skip to content
Back to skills

Openwrt Owl

CSecurity

Configures zero-flash OpenWrt Low-power (openwrt-owl) blackout mode over SSH while keeping 2.4 GHz Wi-Fi online. Use for UPS autonomy optimization, IoT outage detection, or eco-mode.

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 3, 2026
ai-agentsshellbashrailstestinggitapi

Works with

  • claude code
  • cursor
  • terminal
  • cli
  • api

Security analysis

C68/100
  • highPerforms destructive filesystem operations
  • criticalModifies startup scripts or system services for persistence

Pro scans all 11 files and shows the line behind each finding

Scanned December 5, 2026

npx -y skills add kxust/openwrt-owl --skill openwrt-owl --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Openwrt Owl?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Openwrt Owl
[![Security: C — Skills Directory](https://www.skillsdirectory.com/api/skills/kxust-openwrt-owl/badge)](https://www.skillsdirectory.com/skills/kxust-openwrt-owl)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: openwrt-owl
description: "Configures zero-flash OpenWrt Low-power (openwrt-owl) blackout mode over SSH while keeping 2.4 GHz Wi-Fi online. Use for UPS autonomy optimization, IoT outage detection, or eco-mode."
license: MIT
compatibility: "Requires SSH access (Dropbear-safe BatchMode or --askpass) to OpenWrt 22.03-25.12+ (opkg or apk). Compatible with Antigravity, Claude Code, OpenAI Codex, Cursor, GitHub Copilot, and Gemini CLI."
metadata:
  author: openwrt-owl
  version: "1.0.0"
---

# OpenWrt Low-power (`openwrt-owl`) Provisioner

Deploy a zero-flash, outage-aware low-power daemon (`owld`) under `procd` on an OpenWrt router (`22.03`–`25.12+`) to extend Mini-UPS / LiFePO4 battery autonomy during power outages while keeping 2.4 GHz Wi-Fi online.

All relative paths below (`scripts/`, `references/`, `assets/`) are relative to **this skill directory** (e.g., `.agents/skills/openwrt-owl/` or `.claude/skills/openwrt-owl/`).

**Language rule:** Present all discovery tables, interactive choices, warnings, and approval summaries in **English by default** (or match the language the user writes in — never adopt Ukrainian from `README.uk.md` or repository notes unless the user writes in Ukrainian).

**Wizard & Progress Tracking Rule (NEVER dump all questions at once):**
- Track progress explicitly across the **6 phases** (use your client's live step/checklist widget if available, or start responses with `[Step X/6 · <Phase>]`): `1. Discovery` -> `2. Guided Setup` -> `3. Plan Review` -> `4. Deploy` -> `5. 60s Safe Test` -> `6. Enable`.
- In **Phase 2 (`Guided Setup`)**, compute total questions `N` right after Discovery (`N = 4` base questions, or `N = 5` if conditional `Q5` hardware/services exist) and label every prompt clearly as **`Question Y of N`** (and show what remains).
- **Ask ONE question topic per turn** (unless the user already answered several choices upfront, in which case skip answered ones and adjust `Y of N`). Never send an overwhelming wall of 4–5 unrelated questions at once in plain chat. If the IDE provides an interactive choice widget (`ask_question`), you may follow `Q1` (table review) with clean structured choice widgets for `Q2–Q4`.

## Mandatory Execution Order

### 1. Read-Only Discovery (NEVER skip)
Run [scripts/probe_router.sh](./scripts/probe_router.sh) before touching anything on the router (canary arguments are optional on the first pass):
```sh
sh "<skill-dir>/scripts/probe_router.sh" [--askpass] root@<router-ip> [candidate_ip_or_mac ...]
```
- **SSH Auth Hygiene:** Try default `BatchMode=yes` (SSH keys) first. If it fails with `Permission denied`, prefer asking the user to add their SSH public key in LuCI (`System -> Administration -> SSH-Keys`) or run `probe_router.sh --askpass` locally in their own terminal rather than asking them to paste their `root` password in chat. Use `--askpass` / `SSH_ASKPASS` only when the user explicitly chooses password auth.
- **Silent Version & Command Preflight (do NOT clutter output when clean):** Silently verify OpenWrt release (`>= 22.03`, e.g. `22.03`, `23.05`, `24.10`, `25.12+`/`SNAPSHOT`) and `compat_check`. Use `pkg_manager` (`apk` vs `opkg`) and fall back to `scp -O` if `tar_present=0`. If everything is compatible (`compat_check=ok` and release >= `22.03`), say nothing extra about command checks to the user; stop or warn **only** if a blocker/bug applies (OpenWrt `< 22.03`, `ubus_wireless=0` OEM fork, `missing!=none`, `ping_w=0`, `wifi_cli=none` -> `smart` idle counting unavailable, or `24.10.0` `ath10k` calibration bug).
- **Inspect Discovery Output:**
  - `board_name`, `model`, OpenWrt release, `pkg_manager`, `overlay_free_kb`, and existing install state (`owl_installed`, `owl_running`, `legacy_eco_blackout`). If `legacy_eco_blackout=1`, plan to stop/remove it cleanly in Phase 4 before installing `owl` to prevent conflicting daemons and reclaim `/overlay` space.
  - 2.4 / 5 / 6 GHz radios, `disabled` flags, `mode` (`ap` vs `sta`/`mesh`/`wds`), MLO (`*-mld*`), VLANs, DFS channels (`52–144`), and `wpad` WNM capability.
  - Switch architecture (`swconfig` vs DSA `lan*` vs multi-NIC), `ethtool`, `/sys/class/leds/` + `power_led_timer`, `/etc/rc.button/`, `cpufreq`, `SQM`/`mwan3`/Filogic WED, `nut`/`hwmon`, `poe_ubus`, `usb_mount`, `power_service`, and active `$SSH_CONNECTION` path.
  - `[CANDIDATES_AND_DHCP]`: active 2.4 GHz / LAN devices (`hostname`, `ip`, `mac`, `static_dhcp=yes|no`, offline PC-side `vendor`, `mac_type=universal|laa_random`) and existing static DHCP leases.
- **Consult Hardware References (on demand right after Discovery):**
  - If target uses `swconfig` (e.g. `ath79`, AR8337/AR8327) or has 8 MiB flash (`tplink,archer-c6-v2` / Archer A6 v2 EU) -> read [ath79-and-8mb-flash.md](./references/ath79-and-8mb-flash.md).
  - If target uses DSA, ARM/MediaTek Filogic/x86, `cpufreq`, 2.5GbE, or USB UPS (`nut`) -> read [dsa-and-cpufreq.md](./references/dsa-and-cpufreq.md).
  - If user wants to pause non-critical services, USB disks, or PoE ports during outages -> read [power-hooks.md](./references/power-hooks.md).

### 2. Guided Setup Wizard & Safety Guardrails
1. **Collect User Preferences Sequentially (NEVER dump all questions at once; skip nothing required):**
   Determine total question count `N` (`4` by default, or `5` if Phase 1 detected conditional `>= 2500 Mbps` `ethtool` ports or `usb_mount`/`poe_ubus`/`power_service`). Track progress explicitly with **`Question Y of N`** and ask **only one question topic per turn** (unless the user already specified answers upfront):

   - **Question 1 of N — 230 V Outage Detectors (`canary_ip` / `canary_mac`, wired port):**
     - Show discovered `[CANDIDATES_AND_DHCP]` 2.4 GHz / LAN devices (`hostname`, `ip`, `mac`, `static_dhcp`, **`OUI / Wi-Fi Module`** from `vendor`, `mac_type`), active wired LAN ports, and any `nut`/`hwmon` sensors.
     - **Explain OUI / Wi-Fi Module honestly & avoid guessing roles:** Tell the user that OUI values like `Tuya_WiFi_module`, `Espressif_WiFi_module`, `Fn-Link_WiFi_module`, `Bouffalo_WiFi_module`, or `Hi-Flying_WiFi_module` identify the **embedded Wi-Fi chip/module**, not the appliance type — e.g. both a smart plug (`lwip0`) and an air conditioner, fridge, or TV box can share a `Tuya_WiFi_module` or `Espressif_WiFi_module` OUI. Never label any candidate "best canary" before the user confirms how it is powered; use strict technical verdicts instead:
       - **Pass 1 (initial discovery, before live ICMP ping):**
         - `mac_type=universal` on 2.4 GHz: *"Eligible candidate (2.4 GHz) — confirm it is on 230 V mains (no UPS, not turned off at wall switch); live ping will be verified next"*.
         - Wired LAN: *"Eligible if powered directly by 230 V (no UPS) and auto-links on power return"*.
         - `mac_type=laa_random`: *"Unsuitable — randomized MAC (likely phone/laptop)"*.
       - **Pass 2 (`[CANARY_CHECK]` after user picks candidates, or if candidate IPs were passed upfront):**
         - `OK_SAFE_CANARY` (`ping_ok=1`): *"Verified — 2.4 GHz/LAN, ICMP ping OK"*.
         - `REJECT_ON_5G_OR_6G`: *"Unsuitable — 5/6 GHz client (deadlock risk)"*.
         - `UNREACHABLE_ICMP` (`ping_ok=0`): *"No ICMP reply right now — confirm device is online or choose another"*.
     - Mention that offline/deep-sleep appliances (e.g. a fridge in power-save) will not appear until active, and NEVER upload LAN MAC addresses to external lookup APIs without explicit user consent.
     - Ask **Question 1 of N** cleanly (and wait for reply before proceeding to Question 2):
       1. *"Which 2–3 always-on devices from this list plug directly into 230 V mains (NOT on UPS) and stay connected in standby?"*
       2. *"Do you also have a wired LAN device without UPS (`canary_sw_port` / `canary_net_iface`) that auto-links when 230 V returns (ErP off)?"*
       - **Default plan behavior (no extra prompt):** Assume Static DHCP (`MAC -> IP`) will be pinned in `/etc/config/dhcp` for any selected canary currently showing `static_dhcp=no` (storing both `canary_ip` and `canary_mac` in `/etc/config/owl`), and list those exact `MAC -> IP` reservations in the Phase 3 approval table so the user can review or opt out before any `/etc/config/dhcp` write happens.
     - Re-run `sh "<skill-dir>/scripts/probe_router.sh" [--askpass] root@<router-ip> <chosen_ips_or_macs...>` right after the user selects candidates to confirm live `[CANARY_CHECK]` verdicts before finalizing Phase 3.

   - **Question 2 of N — 5/6 GHz Wi-Fi Behavior & Power-Saving Profile (`profile`, activates after recommended `30 s × 3` = ~`90 s` blackout confirmation; `recovery_cycles='1'` = ~`30 s` return):**
     Let the user choose explicitly whether and when 5/6 GHz Wi-Fi turns off during a blackout:
     - `aggressive` **(Recommended) — Always turn 5/6 GHz off during blackout:** turns LEDs and 5/6 GHz Wi-Fi off immediately upon ~90 s blackout confirmation (maximum savings; all clients use 2.4 GHz).
     - `smart` — **Turn 5/6 GHz off when idle:** LEDs off immediately; disables 5/6 GHz Wi-Fi after `4` min idle (`0` clients or `< 500 kbps`; user may customize `idle_minutes` / `traffic_threshold_kbps`).
     - `comfort` — **Never turn 5/6 GHz off:** turns LEDs off only (keeps 5/6 GHz running throughout the blackout).
     *(Include any 2.4 vs 5/6 GHz SSID-mismatch warning right alongside this question so the user can choose `aggressive`, `smart`, or `comfort` knowingly; always respect the user's explicit choice even if SSIDs differ.)*

   - **Question 3 of N — LED Behavior (`manage_leds` / `power_led_heartbeat`):**
     - Blink power/status LED every 5 s (`80 ms` on / `4920 ms` off) while turning other LEDs off (`manage_leds='1'`, `power_led_heartbeat='1'`) **(Recommended when `power_led_timer=1`)**.
     - Turn all LEDs off during blackout (`manage_leds='1'`, `power_led_heartbeat='0'`) *(recommended fallback if `power_led_timer=0`)*.
     - Leave LEDs untouched (`manage_leds='0'`).

   - **Question 4 of N — Physical Mode-Toggle Button (`--button`):**
     - `wps` / `rfkill` / `both` **(Recommended when detected in `[LEDS_AND_BUTTONS]`)**: short press (`<= 3 s`) toggles Normal <-> Low-Power (`FORCE_NORMAL` / `FORCE_OWL`) and holds until canary grid status flips (`ONLINE <-> OFFLINE`), then auto-resets to `AUTO`; long press (`> 3 s`) keeps stock behavior.
     - `none`: do not modify router buttons (fallback when no `wps`/`rfkill` button is present).

   - **Question 5 of 5 (Conditional — ONLY if detected in Phase 1):**
     - **If ports >= 2500 Mbps & `ethtool_present=1` (confirmed by `ethtool_modes`):** Skip all WAN/reassigned WAN ports (`wan_ports` in `[SWITCH_AND_NET]`), canary ports, and `eth0` (`swconfig`), then ask for each remaining eligible port: *"Port `<port>` is at `<speed>` Mbps. Step down speed during blackout (~2 s drop; only `1000` or `100` Mbps modes available): `no (0)` / `1000 Mbps` (plan <= 1 Gbps) / `100 Mbps` (plan <= 100 Mbps)? Any extra ports that must not be touched (`protected_port`)?"*
     - **If USB storage (`usb_mount!=none`), PoE-out (`poe_ubus=1`), or services (`power_service=...`: `transmission`, `qbittorrent`, `ksmbd`, `samba4`, `minidlna`) are detected:** Ask: *"Pause torrents/Samba/DLNA, safely unmount non-root USB drives, or turn off non-essential PoE ports during blackout via `/etc/owl.d/`?"*
2. **Enforce Hard Guardrails:**
   - **Zero-Flash Runtime:** NEVER put `uci commit wireless` or LED UCI writes inside runtime loops; `owld` keeps all state in `/tmp/owl`.
   - **Privacy / Local-Only Default:** NEVER send router device tables or MAC addresses to third-party web lookup services automatically.
   - **No 5/6 GHz Canary Deadlock:** REJECT any candidate canary IP/MAC associated with a 5 GHz or 6 GHz interface (`REJECT_ON_5G_OR_6G`).
   - **No Single Wired Canary Trap:** Do NOT rely solely on a wired desktop/TV link (`canary_sw_port` / `canary_net_iface`) unless auto-link-on-AC-restore (ErP off) is confirmed; pair wired detection with >= 1 Wi-Fi 2.4 GHz IoT canary.
   - **2.4 GHz Fallback Required:** Confirm 2.4 GHz AP is enabled and check `[WIRELESS]` `ssid='...'` + `networks='...'`. Even when `allow_vlan_mismatch=0` passes VLAN parity, if the 5/6 GHz SSID differs from the 2.4 GHz SSID, explicitly warn the user before choosing `aggressive` or `smart` that clients will only fail over to 2.4 GHz if they already have that 2.4 GHz SSID saved with auto-join (otherwise recommend unifying SSIDs or choosing `comfort`).
   - **802.11v / `wpad-basic` Crash Guard:** NEVER add `option bss_transition '1'` unless `ubus -v list hostapd.*` shows WNM support (`wnm_disassoc_imminent`).
   - **Driver & Switch Red Lines:** NEVER `rmmod` Wi-Fi kernel modules (`ath10k_pci`). NEVER call `swconfig ... set disable` or `swconfig ... set link` on AR8216/AR8337. NEVER recommend `flow_offloading` if SQM or `mwan3` is active.
   - **8 MiB Flash Guard:** NEVER run `opkg`/`apk` system package installs when free `/overlay` < `600 KiB` (`openwrt-owl` itself is only ~`46 KiB` of shell scripts; `install.sh` requires `>= 64 KiB` free `/overlay`).
   - **Port Blacklist & Discrete Speed Guard:** NEVER touch WAN (standard or reassigned custom ports), CPU switch port (`eth0` on `swconfig`), canary ports, or the active SSH ingress port. `owld` auto-protects upstream WAN ports via `firewall`/`network` (`wan*`, `bridge-vlan`, `ubus`, default route); still add active SSH ingress or non-WAN uplinks to `protected_port`. Ethernet PHY speed only steps down to discrete modes (`100` or `1000` Mbps via `ethtool`, never arbitrary rates like `300` Mbps); NEVER enable `downshift_2500m='1'` unless `ethtool_present=1`, `ethtool_modes` confirms support, and the user verified their speed budget (`downshift_speed='1000'` for <= 1 Gbps; `'100'` ONLY for <= 100 Mbps).
   - **DFS Warning:** Warn the user if 5 GHz is on a DFS channel (`52–144`), as recovery takes >= 60s CAC; recommend non-DFS channels (`36–48`).
   - **Dropbear-Safe Transfer:** NEVER use bare `scp file root@ip:/path` (fails on OpenSSH 9+ without SFTP server). Stream over SSH (`ssh ... 'cat > /path' < localfile` or `tar | ssh`) or use `scp -O`.

### 3. Plan Review & Explicit User Approval
Before writing ANY file to the router, show a concise summary table:
1. Detected hardware, OpenWrt version, free `/overlay` KiB, any legacy `eco-blackout` cleanup planned, and Wi-Fi/firmware caveats (e.g. `24.10.0` 5 GHz calibration bug, DFS channels, `ath10k-ct`).
2. Eligible 5/6 GHz radios vs skipped radios (STA/mesh/MLO/VLAN), plus any 2.4 vs 5/6 GHz SSID mismatch warning.
3. Selected outage detectors (`canary_ip` + `canary_mac`, wired ports, or `nut`/`hwmon`) and the exact Static DHCP leases (`MAC -> IP`) planned by default in `/etc/config/dhcp` for any `static_dhcp=no` canaries (explicitly noted so the user can approve or opt out).
4. Chosen profile (`aggressive` | `smart` | `comfort`), timings (`poll_interval`, `outage_cycles`, `recovery_cycles`), LED behavior (`manage_leds` / `power_led_heartbeat`), button target (`wps` | `rfkill` | `both` | `none`), and any optional multi-gig downshift (`downshift_2500m`/`downshift_speed`/`protected_port`) or `/etc/owl.d/` hooks.
5. Exact files to be deployed (`/usr/sbin/owld`, `/etc/init.d/owl`, `/etc/config/owl`, optional `/etc/rc.button/<btn>`, optional `/etc/owl.d/`, `/etc/sysupgrade.conf`).

Wait for explicit human confirmation before proceeding.

### 4. Deploy Assets (Dropbear-Safe)
If `legacy_eco_blackout=1` was detected and approved for removal, stop/disable and remove the old `eco-blackout` files first so `/overlay` space is freed and daemons do not conflict.

Stream [assets/](./assets/) into `/tmp/owl-pkg` and invoke `install.sh` (which checks `/overlay >= 64 KiB`, preserves existing UCI config, safely backs up any existing button script to `<btn>.orig` such as `wps.orig`/`rfkill.orig`, sets permissions, and registers `/etc/sysupgrade.conf`). If the router uses password authentication instead of SSH keys, omit `-o BatchMode=yes` and use an interactive TTY prompt or `SSH_ASKPASS` in Phases 4–6.
- From POSIX shell (`sh`/`bash`/`zsh`):
```sh
tar --format=ustar -C "<skill-dir>/assets" -cf - . | ssh -o BatchMode=yes -o ConnectTimeout=5 root@<ip> 'mkdir -p /tmp/owl-pkg && tar -C /tmp/owl-pkg -xf - && sh /tmp/owl-pkg/install.sh --button <wps|rfkill|both|none> && rm -rf /tmp/owl-pkg'
```
- Or from Windows PowerShell (5.1 or 7+) / any OS using legacy SCP (`scp -O`, avoids SFTP requirement and binary pipe issues; run as separate commands without `&&` in PowerShell 5.1):
```powershell
ssh -o BatchMode=yes -o ConnectTimeout=5 root@<ip> 'rm -rf /tmp/owl-pkg'
scp -O -r "<skill-dir>/assets" root@<ip>:/tmp/owl-pkg
ssh -o BatchMode=yes -o ConnectTimeout=5 root@<ip> 'sh /tmp/owl-pkg/install.sh --button <wps|rfkill|both|none> && rm -rf /tmp/owl-pkg'
```
If Static DHCP leases in the Phase 3 plan were approved (pinned by default for `static_dhcp=no` canaries unless the user opted out), create them in `/etc/config/dhcp` (`uci add dhcp host`, `uci commit dhcp`, `/etc/init.d/dnsmasq reload`).

Explicitly apply ALL approved `owl.main` UCI settings via `uci set` / `uci add_list` (`uci -q delete` old lists first if reconfiguring): `enabled='0'`, `profile`, `manage_leds`, `power_led_heartbeat`, `poll_interval`, `outage_cycles`, `recovery_cycles`, `canary_ip`, `canary_mac` (and any approved wired/downshift/sensor options), then `uci commit owl`. Do NOT skip setting `profile` or `power_led_heartbeat`, because the template `owl.uci` ships with `profile='smart'` and `power_led_heartbeat='0'`. Keep `option enabled '0'` until Phase 5 passes.

### 5. 60-Second Safe Timed Test (Dead-Man's Switch)
1. Stop any pre-existing `owl` instance so it cannot interfere with the test, then validate config:
   ```sh
   ssh -o BatchMode=yes root@<ip> '/etc/init.d/owl stop 2>/dev/null || true; /usr/sbin/owld --check-config'
   ```
   If `$SSH_CONNECTION` was traced to a 5/6 GHz client, warn the user before Step 5.3 that Wi-Fi/SSH will pause briefly (~5–10s) while roaming to 2.4 GHz.
2. Arm non-blocking 60-second automatic rollback before testing:
   ```sh
   ssh -o BatchMode=yes root@<ip> 'mkdir -p /tmp/owl && touch /tmp/owl/deadman.armed && (sleep 60; [ -f /tmp/owl/deadman.armed ] && /usr/sbin/owld --restore; rm -f /tmp/owl/deadman.armed) </dev/null >/dev/null 2>&1 & echo ARMED'
   ```
3. Run `--test-owl` and verify status, 2.4 GHz connectivity, canary ping reachability, LED/heartbeat state, and logs:
   ```sh
   ssh -o BatchMode=yes root@<ip> '/usr/sbin/owld --test-owl && logread -e owl | tail -n 15'
   ```
4. Once 2.4 GHz connectivity and low-power state are confirmed, disarm and restore immediately, then wait ~5 s and verify that disabled 5/6 GHz radios actually recovered (`"up": true`, critical on `ath10k-ct`):
   ```sh
   ssh -o BatchMode=yes root@<ip> 'rm -f /tmp/owl/deadman.armed && /usr/sbin/owld --restore && sleep 5 && ubus call network.wireless status | grep -E "\"radio[0-9]\"|\"up\":|\"ifname\":"'
   ```

### 6. Enable & Verify Service
Only after Phase 5 restore succeeds (including verified 5/6 GHz recovery), set `enabled '1'`, enable and start the `procd` service, and confirm live status (`enabled=1`, `state=NORMAL`, `override=AUTO`, running `pid`):
```sh
ssh -o BatchMode=yes root@<ip> 'uci set owl.main.enabled=1 && uci commit owl && /etc/init.d/owl enable && /etc/init.d/owl start && sleep 3 && /usr/sbin/owld --status'
```

Files in this skill

  • SKILL.md16.6 KB
  • assets/install.sh6.3 KB
  • assets/owl.init1 KB
  • assets/owl.uci1.8 KB
  • assets/owld42.2 KB
  • assets/wps.button1.2 KB
  • references/ath79-and-8mb-flash.md3 KB
  • references/dsa-and-cpufreq.md2.9 KB
  • references/power-hooks.md1.3 KB
  • scripts/iot-oui.tsv24.7 KB
  • scripts/probe_router.sh22 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.