2026-10-08 22:31:59 +03:30
2026-10-08 22:31:59 +03:30
2026-10-08 22:31:59 +03:30

RouterShelf

USB file sharing for small Linux routers: public read-only web access and optional private Finder access over SMB.

RouterShelf serves a chosen directory with a dark NAIS listing, file downloads, copied links, and DPL playlists. It uses a small Go executable, automatic Let's Encrypt certificates, and an optional Padavan-style supervisor. A MikroTik gateway provides public port forwarding and LAN hairpin access.

This repository includes the implementation and the practical guide for configuring, operating, backing up, and removing it. It also preserves an earlier LAN status-dashboard experiment as a standalone example.

RouterShelf is one product with two independently runnable executables. The web service remains public, unauthenticated and read-only. The new experimental routershelf-smb service provides authenticated browsing and optional file management through Finder, without a web domain or certificates.

For private Finder access, start with the SMB guide, implementation decision, and validation limits.

Capabilities

  • Directory navigation and file downloads, with HEAD and byte-range support.
  • Static pages from the same root: automatic index.html and inline HTML/CSS/JavaScript/assets.
  • Automatic HTTPS for one configured hostname; HTTP challenge handling and HTTPS redirects.
  • Embedded theme assets; no nginx, PHP runtime, database, or frontend build required.
  • GET/HEAD only, hidden-path filtering, escaped filenames, and filesystem root confinement.
  • Optional independent SMB executable with signed authentication, explicit folder selection and read-only/read-write modes.
  • Optional USB-aware restart supervision and dedicated IPv4/IPv6 firewall rules on the tested firmware.

The public file service has no authentication. HTTPS protects transport; every file placed in the shared directory is available to anyone who can reach the service. Read security boundaries before deploying.

Get started

  1. Read the network and storage guide to identify the gateway, service host, USB mount, and access accounts.
  2. Follow installation and HTTPS setup, replacing every example value with private deployment settings.
  3. Use the operations guide for health checks, backups, updates, rollback, and removal.

Build and test from the repository root:

make test
make build-mipsle
make build-smb-mipsle # optional independent Finder service

The cross-build writes dist/routershelf-linux-mipsle. The deployment guide explains its installed filename and router paths. Configure deployment without editing source or supervisor code:

cp .env.example .env
# Edit .env privately, then validate it and print the gateway plan.
ROUTERSHELF_ENV_FILE="$PWD/.env" sh deploy/padavan/supervisor.example.sh --check-config
make nat-plan

Read environment configuration for available values, precedence, installation, and reloading. .env is ignored by Git; .env.example is tracked. Gateway changes are still applied manually from the printed plan.

See static-page behavior for index precedence and supported assets.

Use the stress-test guide for bounded load phases, router telemetry and private reports. The runner uses Python 3.10+ with no third-party packages.

Repository layout

cmd/routershelf/             HTTP/HTTPS application and behavior tests
cmd/routershelf-smb/         Independent private SMB executable and config tests
internal/smbwire/            Adapted Apache-2.0 SMB protocol source and tests
internal/theme/nais/         Licensed NAIS assets embedded in the executable
internal/theme/assets.go     Asset embedding boundary
deploy/padavan/              Environment-driven firmware supervisor
examples/status-dashboard/  Separate legacy BusyBox/Netcat dashboard
docs/                       Setup, operations, architecture, and deployment history
.github/                    CI and issue/pull-request templates
scripts/nat-plan.sh          Gateway plan derived from private environment
.env.example                Public web configuration template
.smb.example.json           Public SMB template; real credentials stay private
Makefile                    Local checks and MIPS little-endian build
project.json                Project identity and compatibility metadata

See architecture for the separation between application, theme, firmware, and gateway responsibilities. The deployment history records work completed on the original hardware and what remains unverified. The status dashboard tutorial describes the earlier LAN-only example; it is not the public HTTPS server.

Compatibility and validation

The original deployment used a Neterbit NW-651D with Padavan-derived firmware, Linux 3.4.113, BusyBox 1.24.2, about 128 MiB RAM, and a MIPS little-endian CPU. Its gateway was a MikroTik LHG5 running RouterOS 6.49.22. The tested compiler was Go 1.26.5. Other router firmware, CPU architectures, and newer toolchains require target testing.

On the original device, HTTPS issuance, trusted downloads, HTTP redirects, read-only access checks, theme rendering, and a playlist download were checked. Full reboot, future certificate renewal, sustained load, and authenticated FTP transfer were not verified. The environment-driven supervisor is validated separately; hardware validation is recorded in the deployment history.

Contributing and publishing

Read CONTRIBUTING.md. Keep deployment configuration, certificate caches, keys, router exports, USB data, logs, and generated binaries out of Git. All tracked deployment examples use placeholder values. This local repository has no configured remote and has not been published.

Project code is MIT licensed; the embedded SMB implementation retains its Apache-2.0 license. NAIS retains its upstream MIT license. Dependency and theme attribution is collected in THIRD_PARTY_NOTICES.md.

S
Description
Read-only HTTPS file sharing from USB storage on a small Linux router.
Readme MIT
256 KiB
0 Stars 1 Watchers 0 Forks
Languages
Go 80.2%
Python 13.5%
Shell 3%
JavaScript 1.3%
CSS 1.3%
Other 0.7%