fork: REALITY client must carry shortId; default camo moved off www.microsoft.com

Verified 22.11.2026 (xray 26.7.28 + 26.11.9, matrix of 4 version pairs):
- REALITY authenticates fine both directions ONLY when the client
  realitySettings includes "shortId"; without it the server silently
  falls back to passthrough ("received real certificate").
- dest www.microsoft.com is broken for REALITY MITM (Microsoft now
  serves post-quantum cert chains); www.cloudflare.com / www.apple.com /
  www.google.com / download.windowsupdate.com / www.jetbrains.com all work.
- hub transport: expose shortId in summary/payload/uci line; agent reads
  uci reality_short_id and emits "shortId" in realitySettings.

NOTE: new tag-form VLESS reverse (Rvs, PR #5101) does NOT register its
control connection when the bridge transport is REALITY on xray >= 26.7
(portal logs show handshake auth OK but no v1.rvs.cool request;
security=none works). See XTLS/Xray-core #6242 #6248. Reverse-over-REALITY
e2e therefore blocked pending core-version bisect (26.4.25) or upstream fix.
This commit is contained in:
cyril committed 2026-11-22 12:15:22 +03:00
1 parent 9b7a89257b
commit d482ed97c4
4 files changed
+88 -2

No files matched your search

+29
View File
@@ -0,0 +1,29 @@
# FORK.md — изменения форка (cyril/luci-app-owrt-remote)
Форк `kzolotarev95/luci-app-owrt-remote`. Зеркало upstream: `~/mirrors/luci-app-owrt-remote.git` (GitHub origin), push-копия в Gitea `11.11.11.106:3000/cyril/luci-app-owrt-remote` (pull-зеркало отключено; ресинк вручную, наши коммиты — поверх upstream main).
## Наш коммит: REALITY для hops роутер↔хаб
`VLESS+Reality` вместо `security=none` (см. `docs/REALITY_TRANSPORT.md`):
- `vps/owrt-remote-hub.py`
- профиль транспорта `STATE_DIR/transport.json` (x25519-пара через бинарь xray, shortId, dest/SNI, fingerprint); env `OWRT_REMOTE_TRANSPORT` (`reality` по умолчанию, `none` — как upstream), `OWRT_REMOTE_REALITY_DEST`, `OWRT_REMOTE_REALITY_FINGERPRINT`, `OWRT_REMOTE_XRAY_BINARY`;
- reality streamSettings в `make_server_xray_config()` и `make_router_xray_config()`;
- uci-строки `security`, `reality_public_key`, `reality_server_name`, `reality_fingerprint` в генерируемом конфиге роутера;
- блок `transport` в heartbeat `hub_update`;
- `reload_vps_xray` пишет конфиг в candidate-файл, гоняет `xray -test` и только потом подменяет — кривой конфиг не убьёт живой туннель.
- `files/usr/sbin/owrt-remote` — те же поля uci + валидация + reality streamSettings в `render_client_config`, compat-probe по security, возрастная проверка ядра для reality (< 24.2.14 — заменить).
- `files/etc/config/owrtremote`, поля формы в `files/www/cgi-bin/owrt-remote`, `PKG_RELEASE:=3`.
## Известные проблемы upstream, на которые наткнулись
- **XTLS/Xray-core#7259**: REALITY-серверы >= 26.9.8 отвергают client hello («received real certificate (potential MITM or redirection)»), работает на 26.7.28. Хабы держим на **xray-core 26.7.28**, пока upstream не починит. Проверка матрицы версий — в `docs/REALITY_TRANSPORT.md`.
## Как ресинкать с upstream
```
git -C ~/mirrors/luci-app-owrt-remote.git fetch origin
git -C ~/mirrors/luci-app-owrt-remote.git merge --ff-only origin/main # или rebase нашей ветки
# конфликты вероятны в owrt-remote-hub.py (make_server/client configs) — сверять с docs/REALITY_TRANSPORT.md
git -C ~/forks/luci-app-owrt-remote fetch && git -C ~/forks/luci-app-owrt-remote rebase main
```
+47
View File
@@ -0,0 +1,47 @@
# REALITY-транспорт hops роутер↔хаб (наш форк)
## Суть
Upstream: один VLESS-inbound хаба на `:8443` c `network=tcp, security=none`.
Роутер дIAL-OUTит к хабу; reverse-порталы (LuCI/SSH) живут за тем же conn.
Без TLS: весь трафик и логин-данные в панели — открытым текстом внутри hops.
Форк: тот же единственный inbound, но `security=reality` — полноценное TLS-рукопожатие,
замаскированное под handshake публичного сайта-прикрытия (`dest`), без CA-сертификатов
и продлений. Аутентификация по-прежнему per-router UUID (LuCI + SSH = два UUID).
## Где что генерируется
- Хаб: `transport.json` в `STATE_DIR` (`/var/lib/owrt-remote/`), создаётся лениво
(`xray x25519` → приват/публик, `shortId` = 8 hex, `dest`=SNI из env).
- Серверный inbound: `privateKey`, `serverNames=[SNI]`, `shortIds=[shortId]`,
`dest=<SNI>:443`, `xver=0`.
- Клиент (роутер): `publicKey`, `serverName`, `fingerprint` (chrome). shortId клиенту
не нужен (сервер кодирует его в «фейковом» сертификате).
- Конфиг роутера хаб отдаёт готовыми `uci set owrtremote.main.security/reality_*`
(карточка роутера / print-openwrt-config / панельный «Xray настройки» на роутере).
- Heartbeat остаётся отдельным HTTPS-каналом (через панель/Pangolin), к xray не относится.
## Пин версии xray на хабе (важно!)
Upstream-регрессия **XTLS/Xray-core#7259**: REALITY-сервер 26.9.8+ не принимает
рукопожатия клиентов (клиент: `received real certificate (potential MITM or redirection)`).
Практика 22.11.2026: связка 26.11.9↔26.11.9 не работает, ~~26.7.28~~ (см. таблицу матрицы
в коммите форка/заметку хаба) — хаб держим на **26.7.28**, пока upstream не выпустит фикс.
Обновление хаба на новую версию core — только после повторного прогона e2e-матрицы
(hub-generators → две локации xray → reverse-туннель через reality).
## Смена camouflage-домена
env хаба: `OWRT_REMOTE_REALITY_DEST=download.windowsupdate.com`, рестарт `owrt-remote`,
затем пересоздать конфиги роутеров (карточка → новая команда uci; shortId/pk те же, если
не трогать transport.json). Удаление `transport.json` = новая x25519-пара и новый shortId
⇒ всем роутерам нужны новые конфиги.
## Совместимость / откат
`OWRT_REMOTE_TRANSPORT=none` + рестарт = ровно upstream-поведение (но генератор конфига
роутера продолжит писать `security=none`, роутер-агент умеет оба).
Старые агенты (без полей security) не работают с reality-hub — роутер нужно обновить
(установить ipk/файлы этого форка).
+3 -1
View File
@@ -702,6 +702,7 @@ render_client_config() (
flow="$(uci_get vless_flow '')"
security="$(uci_get security none)"
reality_pk="$(uci_get reality_public_key '')"
reality_sid="$(uci_get reality_short_id '')"
reality_sni="$(uci_get reality_server_name '')"
reality_fp="$(uci_get reality_fingerprint chrome)"
reverse_tag="$(uci_get reverse_tag reverse-in)"
@@ -737,8 +738,9 @@ render_client_config() (
die "reality_server_name: содержит пробел или управляющий символ"
fi
case "$reality_fp" in ''|*[!a-zA-Z0-9_-]*) die "reality_fingerprint: ожидается отпечаток без пробелов (chrome, firefox, safari, ios, android)" ;; esac
case "$reality_sid" in *[!0-9a-fA-F]*) die "reality_short_id: ожидается hex (0-9a-f)" ;; esac
transport_stream='"security": "reality",
"realitySettings": {"show": false, "fingerprint": "'"$(json_escape "$reality_fp")"'", "serverName": "'"$(json_escape "$reality_sni")"'", "publicKey": "'"$(json_escape "$reality_pk")"'"}'
"realitySettings": {"show": false, "fingerprint": "'"$(json_escape "$reality_fp")"'", "serverName": "'"$(json_escape "$reality_sni")"'", "publicKey": "'"$(json_escape "$reality_pk")"'", "shortId": "'"$(json_escape "$reality_sid")"'"}'
else
transport_stream='"security": "none"'
fi
+9 -1
View File
@@ -121,7 +121,12 @@ DEFAULT_VLESS_PORT = int(os.environ.get("OWRT_REMOTE_VLESS_PORT", "8443"))
# no CA-issued certificates, no renewal. Per-router UUIDs still authenticate.
# Set OWRT_REMOTE_TRANSPORT=none to fall back to upstream behavior.
TRANSPORT_MODE = os.environ.get("OWRT_REMOTE_TRANSPORT", "reality").strip().lower()
REALITY_DEST = os.environ.get("OWRT_REMOTE_REALITY_DEST", "www.microsoft.com").strip()
# NOTE: do NOT default to www.microsoft.com — Microsoft now serves post-quantum
# (ML-DSA) cert chains and REALITY cannot re-sign them; the handshake silently
# falls back to passthrough ("received real certificate"). Verified working
# 22.11.2026 (xray 26.7.28 + 26.11.9, any direction): www.cloudflare.com,
# www.apple.com, www.google.com, download.windowsupdate.com, www.jetbrains.com.
REALITY_DEST = os.environ.get("OWRT_REMOTE_REALITY_DEST", "www.cloudflare.com").strip()
REALITY_FINGERPRINT = os.environ.get("OWRT_REMOTE_REALITY_FINGERPRINT", "chrome").strip()
TRANSPORT_FILE = STATE_DIR / "transport.json"
XRAY_BINARY = os.environ.get("OWRT_REMOTE_XRAY_BINARY", "/usr/local/bin/xray")
@@ -4686,6 +4691,7 @@ def transport_public_summary():
return {
"mode": "reality",
"publicKey": profile["publicKey"],
"shortId": profile["shortId"],
"serverName": profile["serverName"],
"fingerprint": profile.get("fingerprint", "chrome"),
}
@@ -4721,6 +4727,7 @@ def transport_client_stream():
"fingerprint": profile.get("fingerprint", "chrome"),
"serverName": profile["serverName"],
"publicKey": profile["publicKey"],
"shortId": profile["shortId"],
},
}
@@ -5064,6 +5071,7 @@ def build_openwrt_config_payload(row, hub_url, vps_host_override="", public_url_
if profile.get("mode") == "reality":
payload["security"] = "reality"
payload["reality_public_key"] = profile["publicKey"]
payload["reality_short_id"] = profile["shortId"]
payload["reality_server_name"] = profile["serverName"]
payload["reality_fingerprint"] = profile.get("fingerprint", "chrome")
return payload