fix 证书

This commit is contained in:
anlicheng 2026-05-26 20:44:46 +08:00
parent 958f9009bc
commit f252e537db
5 changed files with 62 additions and 12 deletions

20
Tun/TunDebug.entitlements Normal file
View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.developer.networking.networkextension</key>
<array>
<string>packet-tunnel-provider</string>
</array>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.application-groups</key>
<array>
<string>group.com.jihe.punchnetmac</string>
</array>
<key>com.apple.security.network.client</key>
<true/>
<key>com.apple.security.network.server</key>
<true/>
</dict>
</plist>

View File

@ -571,7 +571,7 @@
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = punchnet/punchnet.entitlements; CODE_SIGN_ENTITLEMENTS = punchnet/punchnetDebug.entitlements;
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Mac Developer"; "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Mac Developer";
CODE_SIGN_STYLE = Manual; CODE_SIGN_STYLE = Manual;
@ -591,10 +591,10 @@
); );
MACOSX_DEPLOYMENT_TARGET = 15.6; MACOSX_DEPLOYMENT_TARGET = 15.6;
MARKETING_VERSION = 1.0; MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.jihe.punchnetmac.dev; PRODUCT_BUNDLE_IDENTIFIER = com.jihe.punchnetmac;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = MacPunchnetTestDev; "PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = MacPunchnetTest;
SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0; SWIFT_VERSION = 5.0;
}; };
@ -709,7 +709,7 @@
C8A77F352DD1E77B00195617 /* Debug */ = { C8A77F352DD1E77B00195617 /* Debug */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
CODE_SIGN_ENTITLEMENTS = Tun/Tun.entitlements; CODE_SIGN_ENTITLEMENTS = Tun/TunDebug.entitlements;
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Mac Developer"; "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Mac Developer";
CODE_SIGN_STYLE = Manual; CODE_SIGN_STYLE = Manual;
@ -728,10 +728,10 @@
); );
MACOSX_DEPLOYMENT_TARGET = 15.6; MACOSX_DEPLOYMENT_TARGET = 15.6;
MARKETING_VERSION = 1.0; MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.jihe.punchnetmac.dev.tun; PRODUCT_BUNDLE_IDENTIFIER = com.jihe.punchnetmac.tun;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = MacPunchnetTunTestDev; "PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = MacPunchnetTunTest;
SKIP_INSTALL = YES; SKIP_INSTALL = YES;
SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0; SWIFT_VERSION = 5.0;

View File

@ -37,7 +37,7 @@ struct SystemConfig {
.dev: EnvConfig( .dev: EnvConfig(
serverHost: "test.punchsky.com", serverHost: "test.punchsky.com",
stunAssistHost: "test.punchsky.com", stunAssistHost: "test.punchsky.com",
tunBundleId: "com.jihe.punchnetmac.dev.tun", tunBundleId: "com.jihe.punchnetmac.tun",
localizedDescription: "punchnetmac-dev" localizedDescription: "punchnetmac-dev"
), ),
.prod: EnvConfig( .prod: EnvConfig(

View File

@ -128,11 +128,13 @@ class VPNManager {
let env = SystemConfig.getCurrentEnvConfig() let env = SystemConfig.getCurrentEnvConfig()
for manager in managers { for manager in managers {
guard let protocolConfiguration = manager.protocolConfiguration as? NETunnelProviderProtocol, // guard let protocolConfiguration = manager.protocolConfiguration as? NETunnelProviderProtocol,
protocolConfiguration.providerBundleIdentifier == env.tunBundleId else { // protocolConfiguration.providerBundleIdentifier == env.tunBundleId else {
try await manager.removeFromPreferences() // try await manager.removeFromPreferences()
continue // continue
} // }
// TODO Debug
try await manager.removeFromPreferences()
} }
let managersAfterCleanup = try await NETunnelProviderManager.loadAllFromPreferences() let managersAfterCleanup = try await NETunnelProviderManager.loadAllFromPreferences()

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.developer.networking.networkextension</key>
<array>
<string>packet-tunnel-provider</string>
</array>
<key>com.apple.developer.networking.vpn.api</key>
<array>
<string>allow-vpn</string>
</array>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.application-groups</key>
<array>
<string>group.com.jihe.punchnetmac</string>
</array>
<key>com.apple.security.files.user-selected.read-only</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
<key>com.apple.security.network.server</key>
<true/>
<key>keychain-access-groups</key>
<array/>
</dict>
</plist>