feat(sec): 签名鉴权 2B (agent-221) — meow_verify 多公钥数组+v2签名块(含ts,未来宽限,兼容v1)+meow_sign verify子命令+产签README; svc_power 面板身份精确路径绑定(删启发式,3反例验证)

meow_verify→6c2e8ed2; svc_power→306df962; qemu+宿主全过
This commit is contained in:
MeowOS committed 2026-08-31 15:36:45 +08:00
1 parent 249b6224ab
commit 05a19a9ea3
13 files changed
+497 -78

No files matched your search

Binary file not shown.
+20 -1
View File
@@ -642,6 +642,25 @@ static int is_sys_identity(const caller_t *c)
return 0;
}
/* MeowPanel 精确绑定(2B):仅当 exe **精确命中登记路径** 才予 os.meow.panel 系统身份。
* 替代 2A 的启发式 `strstr(exe,"/MeowPanel/")||strstr(exe,"meowpanel")`——后者过宽(任何路径含该
* 子串即被放行,如 `/.../MeowPanel/evil` 或 `/usr/bin/foomeowpanel`)。面板本体为外置卡组件
* (无卡不 import),路径登记 = `meowpanel.conf` 的 `exec`(`MeowOS/opt/MeowPanel/meowpanel`)。
* 面板二进制更新(换 md5)不影响路径登记,无需重编本服务;「精确绑定」靠路径唯一性 + 唯一二进制位。
* 诚实标注:若攻击者以 root 在本路径放恶意二进制,仍获 os.meow.panel——但该情形 root 本可为所欲为
* (MPK_SIGNATURE_DESIGN §8 天花板);本绑定只把「启发式误放行」收紧为「明确路径登记」。
* 如需更强(绑定面板二进制 md5),可在此按路径读文件算 md5 比对登记表——首版以路径登记为准。 */
static const char *const k_panel_exe[] = {
"/usr/data/mnt/sd_0/MeowOS/opt/MeowPanel/meowpanel",
NULL
};
static int exe_is_panel(const char *exe)
{
int i;
for (i = 0; k_panel_exe[i]; i++) if (strcmp(exe, k_panel_exe[i]) == 0) return 1;
return 0;
}
/* 由 exe 路径判身份(纯函数,便于宿主自测 + 生产共用)。前提:out 已 memset(kind 缺省 CALL_OTHER)。
* - exe 前缀 /usr/data/mnt/sd_0/MeowAPPs/ → MeowAPP 包(kind=CALL_PKG,pkg=目录名)
* - 否则命中系统二进制 allowlist → CALL_SYS
@@ -667,7 +686,7 @@ static void classify_exe(const char *exe, caller_t *out)
char tmp[MEOW_APP_ID_MAX];
if (strcmp(exe, "/usr/bin/meow_launcherd") == 0) {
snprintf(tmp, sizeof tmp, "%s", "os.meow.launcher");
} else if (strstr(exe, "/MeowPanel/") || strstr(exe, "meowpanel")) {
} else if (exe_is_panel(exe)) {
snprintf(tmp, sizeof tmp, "%s", "os.meow.panel");
} else if (strncmp(exe, "/usr/bin/meow_", 14) == 0) {
/* 截取 "meow_xyz"(去 "/usr/bin/" 前缀)作近似别名 */
Binary file not shown.
Binary file not shown.
+14 -1
View File
@@ -45,9 +45,22 @@ int main(void)
classify_exe("/usr/bin/meow_svc_power", &c);
CHECK(c.kind == CALL_SYS); /* /usr/bin/meow_* 前缀批准 */
/* 2B 精确绑定:仅精确命中登记路径(meowpanel.conf 的 exec)才予 os.meow.panel。
* 旧启发式(路径含 /MeowPanel/ 或 meowpanel 子串)会被过宽放行,今已收紧为精确路径登记。 */
memset(&c, 0, sizeof c);
classify_exe("/usr/data/mnt/sd_0/MeowOS/opt/MeowPanel/meowpanel", &c);
CHECK(c.kind == CALL_SYS && strcmp(c.pkg, "os.meow.panel") == 0);
/* 反例:路径含 /MeowPanel/ 或 meowpanel 子串但并非精确登记路径 → 不再放行(CALL_OTHER) */
memset(&c, 0, sizeof c);
classify_exe("/usr/data/mnt/sd_0/MeowOS/opt/MeowPanel/backend/meowpanel", &c);
CHECK(c.kind == CALL_SYS && strcmp(c.pkg, "os.meow.panel") == 0);
CHECK(c.kind == CALL_OTHER);
memset(&c, 0, sizeof c);
classify_exe("/usr/data/mnt/sd_0/MeowOS/opt/MeowPanel/evil", &c);
CHECK(c.kind == CALL_OTHER);
memset(&c, 0, sizeof c);
classify_exe("/usr/bin/meowpanel_fake", &c);
CHECK(c.kind == CALL_OTHER); /* 含 "meowpanel" 但非 /usr/bin/meow_* 精确前缀、非登记路径 */
memset(&c, 0, sizeof c);
classify_exe("/usr/data/meow/settings_tool", &c);