Commit Graph

22 Commits

Author SHA1 Message Date
Андрей Бобырев
fb8bf83ce1 docs: живее README, скрины и понятнее вступление
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-17 06:59:43 +03:00
Андрей Бобырев
515f0ec282 fix: use start-stop-daemon for autossh background launch in tunnel script
- Replace setsid/nohup with start-stop-daemon -S -b as primary daemon
  method (setsid fails silently when script runs inside curl|sh pipe)
- Same fix in init.d S99kdns_tun start/restart cases

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-28 10:22:26 +03:00
Андрей Бобырев
2d3ea7ad11 docs: полная переработка README — туннель, логины/пароли, ошибки, советы
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-28 09:34:40 +03:00
Андрей Бобырев
61e273f05b fix(tunnel): AUTOSSH_GATETIME=0 + setsid + log file for diagnostics
Background autossh kept exiting because of two things:
1. autossh's gate-time guard (default 30s): if first ssh dies "too fast"
   autossh treats it as failure and gives up. Setting GATETIME=0 disables it.
2. nohup+subshell on BusyBox doesn't always fully detach. Try setsid first
   (proper new session, no controlling tty) and fall back to nohup subshell.

Also write autossh diagnostics to /tmp/kdns_tun.log and dump it on failure
so the user can see the real reason instead of just "не запустился".

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 22:51:42 +03:00
Андрей Бобырев
3f2d621d02 fix(tunnel): close stdin so autossh survives backgrounding; add quick "+ Тоннель" button
Background autossh died immediately because nohup left stdin attached to the
closed curl pipe — autossh saw EOF and bailed. Add </dev/null and wrap in
subshell so the process is fully detached from the install script's session.

Also add an "+ Тоннель" button next to "+ Добавить": creates a router with a
placeholder base URL and opens the tunnel modal in one click — for routers
without a public IP that have nothing to put in the base URL field yet.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 22:30:43 +03:00
Андрей Бобырев
61d80ebc22 fix(tunnel): one-liner curl|sh; keypair generated on VPS; on-page copy fallback
aarch64-k3.10 Entware lacks sshpass, cronie, and openssh-keygen. Generate the
ed25519 keypair on the VPS (where ssh-keygen is always present) and ship the
private key to the router inside the install script.

The router only sees a short curl|sh one-liner — easy to copy, immune to
markdown auto-linkification of .sh paths that mangled previous attempts.

- _gen_ed25519_keypair / _add_pubkey_to_authorized_keys helpers
- /tunnel-cmd: generate keypair on first call, store priv+pub on router record,
  add pub to ~/.ssh/authorized_keys, return one-liner
- /tunnel-script: returns full install script with private key embedded
  (text/plain), token-authenticated, single-use
- removed /tunnel-register-key endpoint (router no longer generates the key)
- copy button: select on-page text + execCommand fallback for non-HTTPS;
  if both fail, leave selected so user can Cmd+C manually

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 22:12:15 +03:00
Андрей Бобырев
b140cdac43 fix(tunnel): SSH key auth instead of sshpass; init.d boot persistence; copy fallback
aarch64-k3.10 Entware does not have sshpass or cronie packages. Switch to ed25519
SSH key auth and persist via /opt/etc/init.d/S99kdns_tunnel instead of cron.

- /api/routers/{rid}/tunnel-cmd: drop VPS_SSH_PASS dependency, generate one-time
  registration token, build install script that:
    1. opkg install autossh + openssh-keygen
    2. ssh-keygen ed25519 if not exists
    3. curl POST pubkey to new register-key endpoint with token
    4. autossh -i <key>  (no sshpass)
    5. /opt/etc/init.d/S99kdns_tunnel for boot autostart
- /api/routers/{rid}/tunnel-register-key: new endpoint, token-auth, appends pubkey
  to ~/.ssh/authorized_keys with kdns-tunnel-{rid} comment for de-dup
- copy button: fallback to document.execCommand('copy') for non-HTTPS contexts
  (navigator.clipboard requires secure context — UI runs on plain http)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 22:03:40 +03:00
Андрей Бобырев
cc31234e91 fix(tunnel): install cronie, start crond, killall watchdog; add tunnel-status endpoint
- opkg install now includes cronie so crond is actually present
- /opt/etc/init.d/S10crond start runs after install so cron watchdog fires
- cron watchdog switches from pgrep (not always in PATH) to killall -0 autossh
- killall autossh instead of pkill before re-launching (works in BusyBox)
- GET /api/routers/{rid}/tunnel-status: checks if tunnel port is listening on VPS localhost
- "⟳ Проверить связь" button in tunnel modal calls the new endpoint

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 21:54:34 +03:00
Андрей Бобырев
d48b7b2023 feat: reverse SSH tunnel for routers without public IP
UI: «⇄ Тоннель» button next to «Тест» — opens modal with autossh
install command for the router and an auto-applied localhost RCI URL.
Backend: GET /api/routers/{id}/tunnel-cmd allocates a free port
(starts at TUNNEL_PORT_START) and returns the shell command;
DELETE /api/routers/{id}/tunnel clears the assignment.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 20:57:05 +03:00
Андрей Бобырев
80c7859f2d docs: polish wording for public audience
Rename informal quickstart heading to neutral Quickstart.
2026-04-27 04:19:13 +03:00
Андрей Бобырев
f6fd0a6d62 docs: add beginner quickstart and troubleshooting
Add step-by-step setup notes and common RCI/HTTP Proxy troubleshooting; align SSH port example to 22.
2026-04-27 04:14:35 +03:00
Андрей Бобырев
903e211697 docs: add Entware install snippet
Add a short Entware/SSH installation cheat sheet (not required for RCI mode) for router maintenance.
2026-04-27 03:18:13 +03:00
andrey271192
6b7d1fa70c README.md 2026-04-25 18:40:47 +03:00
Андрей Бобырев
584028ae60 feat: uninstall.sh and README one-command server removal
Made-with: Cursor
2026-04-25 18:30:12 +03:00
Андрей Бобырев
adcf95ff4a fix(ui): author links only in bottom bar (match strip style)
Made-with: Cursor
2026-04-25 13:05:32 +03:00
Андрей Бобырев
6f7345de4d fix(ui): router row onclick quotes broke delete/test/edit/toggle
Use single-quoted onclick/onchange so JSON.stringify(id) does not break HTML.
Encode router id in API paths; handle test errors and delete failures.

Made-with: Cursor
2026-04-25 12:47:45 +03:00
Андрей Бобырев
4f42da9a0e Per-router RCI creds + .env fallback; parse user:pass@ URL; fix apply/checkbox (kdns-sel), save groups on toggle; update.sh
Made-with: Cursor
2026-04-25 01:42:16 +03:00
Андрей Бобырев
ef946e37f2 feat: scan interfaces via RCI; show Keenetic login + password status (no secret in UI)
Made-with: Cursor
2026-04-25 00:45:55 +03:00
Андрей Бобырев
e1d6e6bb81 fix(auth): empty ADMIN_PASSWORD in .env now falls back to admin; strip passwords
Made-with: Cursor
2026-04-25 00:40:47 +03:00
Андрей Бобырев
a2e565d615 Merge origin/main: resolve README conflict
Made-with: Cursor
2026-04-24 22:49:44 +03:00
Андрей Бобырев
3e97743e07 Initial: FastAPI DNS routes manager for legacy Keenetic (RCI, port 8001)
Made-with: Cursor
2026-04-24 22:45:28 +03:00
andrey271192
e85a50c22c Initial commit 2026-04-24 20:44:23 +03:00