diff --git a/scripts/ci/compile-macos.sh b/scripts/ci/compile-macos.sh index c5d276e..75aa601 100755 --- a/scripts/ci/compile-macos.sh +++ b/scripts/ci/compile-macos.sh @@ -225,6 +225,10 @@ cat > "${WORK}/sysext.entitlements" <com.apple.developer.networking.networkextension packet-tunnel-provider-systemextension com.apple.security.app-sandbox + + com.apple.security.network.client + com.apple.security.network.server com.apple.security.application-groups ${APP_GROUP} @@ -275,6 +279,12 @@ case "$MACH" in "${APP_GROUP}"*) ;; *) echo "ERROR: NEMachServiceName(${MACH:-}) 必须以 App Group(${APP_GROUP}) 为前缀,否则 sysextd 校验失败 Code=6" >&2; exit 1 ;; esac +# 沙箱 sysext 无 network.client/server = 无权对外建连 → 隧道起了也连不上节点(v1.1.2 事故)。 +SE_NC="$(/usr/libexec/PlistBuddy -c 'Print :com.apple.security.network.client' "${WORK}/se.signed.plist" 2>/dev/null || true)" +SE_NS="$(/usr/libexec/PlistBuddy -c 'Print :com.apple.security.network.server' "${WORK}/se.signed.plist" 2>/dev/null || true)" +echo " sysext network.client=${SE_NC:-} network.server=${SE_NS:-}" +[ "$SE_NC" = "true" ] || { echo "ERROR: sysext 缺 com.apple.security.network.client —— 沙箱扩展无权出站,隧道连不上节点" >&2; exit 1; } +[ "$SE_NS" = "true" ] || { echo "ERROR: sysext 缺 com.apple.security.network.server" >&2; exit 1; } echo " OK: ${APP_GROUP}" # ── [7/7] 公证(notarytool,API key 三件套) + staple + 打包 ────────────────── diff --git a/scripts/local_test.sh b/scripts/local_test.sh index dffa965..1f87af1 100755 --- a/scripts/local_test.sh +++ b/scripts/local_test.sh @@ -112,6 +112,10 @@ PLIST com.apple.developer.networking.networkextension packet-tunnel-provider-systemextension com.apple.security.app-sandbox + + com.apple.security.network.client + com.apple.security.network.server com.apple.security.application-groups ${APP_GROUP} @@ -142,6 +146,13 @@ verify_app_group(){ "$APP_GROUP"*) ;; *) die "NEMachServiceName($mach)必须以 App Group($APP_GROUP)为前缀,否则 sysextd 校验失败 Code=6" ;; esac + # 沙箱 sysext 无 network.client/server = 无权对外建连 → 隧道起了也连不上节点(v1.1.2 事故)。 + local se_nc se_ns + se_nc="$(/usr/libexec/PlistBuddy -c 'Print :com.apple.security.network.client' "$WORK/se.ents.plist" 2>/dev/null || true)" + se_ns="$(/usr/libexec/PlistBuddy -c 'Print :com.apple.security.network.server' "$WORK/se.ents.plist" 2>/dev/null || true)" + echo " sysext network.client=${se_nc:-<缺失>} network.server=${se_ns:-<缺失>}" + [ "$se_nc" = "true" ] || die "sysext 缺 com.apple.security.network.client —— 沙箱扩展无权出站,隧道连不上节点" + [ "$se_ns" = "true" ] || die "sysext 缺 com.apple.security.network.server" echo " ✅ 一致($APP_GROUP)" }