Feature: Embed the server TLS certificate in delivered DLLs
Add a "高级 → DLL内嵌TLS证书" toggle (off by default, persisted as
[settings] EmbedTlsInDll). When it is on, ReadKernelDll patches the server's
current TLS anchor into the ServerDll and ShellCode payloads, so clients that
come online through the loaders start their own session over TLS without
waiting for an online push. The plaintext DLL loader in client/main.c is
untouched; only the DLL's fresh connection is protected. The write happens
after SetServer and before CalcMD5FromBytes, and the anchor records the host
part of the master address rather than "ip:port" because the client matches
the anchor against its configured address set. TinyRun has no anchor block and
keeps working as before.
Toggling the switch, and confirming the certificate dialog, rebuild the six
payloads in place, so no server restart is needed after a certificate change.
The payload pointers are replaced as a whole, and the network threads that read
them (SendServerDll and TOKEN_GETVERSION) now take a dedicated critical section
for the full duration of use.
COMMAND_UPDATE no longer clears the tls_disabled marker on the client. Now that
any delivered DLL may carry the anchor, "the payload has an anchor" no longer
means the operator opted this host into TLS, and clearing the marker would
silently flip a host that was explicitly set to plaintext onto TLS against a
plaintext path. Re-enabling TLS stays an explicit action through
COMMAND_TLS_ENABLE and COMMAND_SET_PROTO, which still clear the marker.
Menu and notice strings were added to en_US, zh_TW and de_DE, and the embedded
TLS design document records the new switch and the revised update semantics.
The new menu entry also takes a feature-limits slot so a subordinate master
can hide it like every other 高级 item (see 8807321):
HIDE_MENU_EMBED_TLS_ANCHOR in UIBranding.h, MF_EMBED_TLS_ANCHOR at bit 57
in FeatureFlags.h (the first free one after MF_FILE_SPEED), a row in the
主菜单 tab of CFeatureLimitsDlg, and the matching DeleteMenu on the 高级
menu. The entry still has no bitmap of its own, so it renders without an
icon next to its three siblings.
Co-Authored-By: deepseek-flash
This commit is contained in:
1 parent
8b92f32c47
commit
c66f410831
12 files changed
+210
-45
No files matched your search
@@ -268,6 +268,18 @@ public:
|
||||
Buffer* m_ServerDLL[PAYLOAD_MAXTYPE];
|
||||
Buffer* m_ServerBin[PAYLOAD_MAXTYPE];
|
||||
Buffer* m_TinyRun[PAYLOAD_MAXTYPE] = {};
|
||||
// 内嵌 TLS 信任锚开关(高级→DLL内嵌TLS证书),持久化在 [settings] EmbedTlsInDll。
|
||||
// 勾选后 ReadKernelDll 会把服务端当前证书写进 ServerDll 的锚块,MDLL 客户端上线即 TLS。
|
||||
bool m_bEmbedTlsInDll = false;
|
||||
// 启动时算出的主控地址("ip:port"),重建内核载荷时复用,避免重复解析 FRP/公网 IP。
|
||||
std::string m_masterAddr;
|
||||
// 保护 m_ServerDLL / m_ServerBin / m_TinyRun:网络线程读、UI 线程(换证书/切开关)整体替换。
|
||||
// 读方必须「拿锁取指针 + 用完这一段」,不能只锁赋值那一行。
|
||||
CRITICAL_SECTION m_csPayload;
|
||||
// 按当前开关与证书重新生成三组载荷(删除旧 Buffer,重新 ReadKernelDll)。
|
||||
void ReloadKernelPayloads();
|
||||
// 高级→DLL内嵌TLS证书
|
||||
afx_msg void OnToolEmbedTlsAnchor();
|
||||
MasterSettings m_settings;
|
||||
// 缓存上次检测到的上级 FRP 配置([settings] FrpConfig),由定时器检测外部模块写入的变更。
|
||||
// 检出变更后会热切换 FRPC(首次=启动 / 覆盖=重启 / 撤销=停止),并在主对话框信息列表中给出友好提示。
|
||||
|
||||
Reference in new issue
Block a user