github wangwanjie/gately v0.6.8.4

one hour ago

Security / 安全修复

本版本修复了以下影响 v0.6.8.2 及更早版本的安全问题。This release fixes the following issue affecting v0.6.8.2 and earlier.

  • 通知渠道密钥可能出现在投递错误中(低):Telegram Bot Token、Bark 设备 Key、Server酱 SendKey 等放在请求地址中,连接失败时错误信息带出完整地址,写入通知模块日志与「最近发送」记录,只读账号和只有通知读权限的 API 令牌也能看到。现在错误信息中的渠道密钥替换为 ***。「最近发送」只在内存中,升级重启即清除;运行日志中可能留有旧记录,推送失败过的渠道建议更换密钥(GHSA-p368-wcp9-rv4q)。 / Notification channel secrets could appear in delivery errors (low): Telegram bot tokens, Bark device keys, ServerChan SendKeys and similar secrets are part of the request address, and a failed connection put the full address into the notification log and Recent deliveries, readable by read-only accounts and API tokens with notification read access. Channel secrets in error messages are now replaced with ***. Recent deliveries are kept in memory only and are cleared by the upgrade restart; run logs may still contain old entries, so consider rotating the secrets of channels that failed to deliver (GHSA-p368-wcp9-rv4q).

中文

改配置不再把自己关在门外

  • 保存后确认,超时自动回滚:在管理后台保存端口转发、协议分流、Web 服务或全局设置后,页面经一条新连接确认后台仍能访问;确认不了时默认 90 秒后自动恢复改动前的配置,期间弹出倒计时可立即回滚,重启 3 次仍未确认也会回滚。「系统设置 › 访问控制」可关闭或调整等待秒数(30–600);回滚发出「配置变更」通知。脚本和 API 令牌的保存不受影响。
  • 保存前提醒访问路径:追溯当前访问经过的端口转发、协议分流与 Web 站点,改动会影响这条路径时(改端口、停用、删除、换到本机无法监听的地址等)先说明原因并高亮受影响的一跳;「系统设置 › 访问控制」可查看当前访问路径。
  • 批量修改一起生效:「暂存,稍后一起生效」,横幅列出暂存的规则与监听,「全部生效」后整批确认、整批回滚,也可「放弃修改」;全部生效前先列出无法启动的监听。
  • 命令行回滚:gately rollback 列出待确认的改动与最近 15 次配置保存,按编号撤销,或用 -last、-pending、-config 配合 -version;Gately 运行中 2 秒内恢复并重启,未运行时直接改写配置文件。
  • 删除配置文件前先存入配置历史,删除也能撤销。

通知:失败重试与补推

  • 推送失败按 10、30、60 秒重试(默认 3 次,0–10);仍失败的消息进入补推队列,渠道恢复后按时间顺序补发,重启后继续(默认保留 24 小时,0–168,0 为关闭;每个渠道最多 100 条)。渠道已有积压时新消息只尝试一次、失败即排在积压之后。
  • 「最近发送」显示「等待补推」「已补推」与尝试次数,横幅按渠道统计待补推数量并可清空。

证书:飞牛系统证书(#105)

  • 证书来源新增「飞牛系统证书」:选择飞牛「设置 → 安全性 → 证书」中的域名,每 30 分钟跟随飞牛续期读取最新证书(有完整链时用完整链),变化后自动加载与部署。fpk 直接可用;Docker 需按原路径只读挂载 /usr/trim/etc/network_cert_all.conf 与 /usr/trim/var/trim_connect/ssls,并以 root 运行。

存储占用

  • 「系统设置 › 网络与运行」新增存储占用:配置目录所在分区容量、配置目录总大小,以及运行日志、访客审计、配置历史、备份、证书、托管程序、通知补推队列、File Browser 数据等分类占用与路径。

修复

  • 入侵防护:管理后台端口在模块启动前登记为开放端口,诱饵端口范围包含管理端口时不再因诱饵监听抢先占用而导致每次重启都退出;启动模块期间不设置诱饵端口;frps、EasyTier、FTP 被动端口等登记的端口暂未监听时也不作诱饵;诱饵端口随端口变化重新计算;临时 HTTP-01 监听不被诱饵拦下。
  • Web 服务:站点后端是本实例另一个 Web 监听(443 站点 → 本机 444 监听 → 管理后台)时原样转发后台登录 Cookie,不再登录后立即 401。

升级提示

  • Docker 拉取新镜像后重建容器;OpenWrt 覆盖安装新的 .apk / .ipk;飞牛在应用中心手动安装新版 .fpk;其他方式可在「系统设置」中在线升级。

English

Config changes that cannot lock you out

  • Confirm after saving, automatic rollback: after saving port forwarding, protocol routing, web services or global settings in the admin UI, the page confirms over a new connection that the admin UI is still reachable; if it cannot, Gately restores the previous configuration after 90 seconds by default. A countdown dialog offers Roll back now, and 3 starts without a confirmation also roll back. Turn it off or set the wait (30–600 s) under Settings › Access Control; a rollback sends a Config changes notification. Saves from scripts and API tokens are not affected.
  • Access path warning before saving: Gately traces the port forwarding rules, protocol routes and web sites your current request went through, and before a change that affects that path (port change, disabling, deleting, a listen address this machine cannot use) explains why and highlights the affected hop. Settings › Access Control shows the current access path.
  • Batch changes: Stage, apply together later; a banner lists the held rules and listeners, Apply all confirms and rolls back the whole batch, or Discard changes. Listeners that would fail to start are listed before applying.
  • CLI rollback: gately rollback lists the pending change and the 15 latest config saves and undoes one by number, or with -last, -pending, -config plus -version. A running Gately restores and restarts within 2 seconds; otherwise the config files are rewritten directly.
  • Deleting a config file keeps its last content in config history, so deletions can be undone.

Notifications: retries and resending

  • Failed pushes are retried after 10, 30 and 60 seconds (3 times by default, 0–10); messages that still fail are queued and resent in order once the channel recovers, also after a restart (24 hours by default, 0–168, 0 turns it off; at most 100 per channel). While a channel has a backlog, new messages are tried once and queued behind it.
  • Recent deliveries show Pending resend, Resent and the number of attempts; a banner counts queued messages per channel with Clear.

Certificates: fnOS system certificates (#105)

  • New certificate source fnOS system certificate: pick a domain from fnOS Settings → Security → Certificates; Gately follows fnOS renewals every 30 minutes (full chain when available) and reloads and deploys the certificate when it changes. Works out of the box in the fpk; with Docker, mount /usr/trim/etc/network_cert_all.conf and /usr/trim/var/trim_connect/ssls read-only at the same paths and run as root.

Storage usage

  • Settings › Network & Runtime shows storage usage: the capacity of the partition holding the config directory, the config directory size, and usage by category (run logs, visitor audit, config history, backups, certificates, managed programs, notification resend queue, File Browser data and more) with their paths.

Fixes

  • Intrusion protection: the admin UI ports are registered as open before modules start, so a trap port range including the admin port no longer lets Gately's own trap listener take it and make Gately exit on every restart; no trap ports while modules start; ports registered by frps, EasyTier, the FTP passive range and others are never traps even while not listening; trap ports follow port changes; the temporary HTTP-01 listener is no longer caught by a trap.
  • Web services: a site whose backend is another web listener of the same instance (443 site → local 444 listener → admin UI) passes the admin cookies on, so signing in through it no longer returns 401.

Upgrading

  • Docker: pull the new image and recreate the container; OpenWrt: install the new .apk / .ipk over the old one; fnOS: install the new .fpk from the App Center; other deployments can upgrade online from Settings.

Don't miss a new gately release

NewReleases is sending notifications on new releases.