Skip to content

Force Proxy to any Windows/MacOS/Linux Application TCP and UDP traffic

#29

Sourav Kalal5a1a89fe2cf2
diff --git a/.gitignore b/.gitignore
index f5bc961..fe2b894 100644
--- a/.gitignore
+++ b/.gitignore
@@ -20,6 +20,7 @@ Windows/output/ProxyBridge_CLI.pdb
MacOS/ProxyBridge/.env
MacOS/ProxyBridge/output/
MacOS/ProxyBridge/build/
+MacOS/ProxyBridge/provision/**
# Xcode
xcuserdata/
diff --git a/MacOS/ProxyBridge/ProxyBridge.xcodeproj/project.pbxproj b/MacOS/ProxyBridge/ProxyBridge.xcodeproj/project.pbxproj
index eebd57f..99ff2f9 100644
--- a/MacOS/ProxyBridge/ProxyBridge.xcodeproj/project.pbxproj
+++ b/MacOS/ProxyBridge/ProxyBridge.xcodeproj/project.pbxproj
@@ -300,7 +300,7 @@
MACOSX_DEPLOYMENT_TARGET = 13.0;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
- ONLY_ACTIVE_ARCH = YES;
+ ONLY_ACTIVE_ARCH = NO;
SDKROOT = macosx;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
@@ -358,6 +358,7 @@
MACOSX_DEPLOYMENT_TARGET = 13.0;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
+ ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
SWIFT_COMPILATION_MODE = wholemodule;
};
@@ -503,7 +504,8 @@
8466A1F72EC63C5600A8C2E5 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
- CODE_SIGN_ENTITLEMENTS = extension/extension.entitlements;
+ CODE_SIGN_ENTITLEMENTS = extension/extensionRelease.entitlements;
+ CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = L4HJT32Z59;
@@ -531,6 +533,7 @@
MARKETING_VERSION = 3.0;
PRODUCT_BUNDLE_IDENTIFIER = com.interceptsuite.ProxyBridge.extension;
PRODUCT_NAME = "$(inherited)";
+ PROVISIONING_PROFILE_SPECIFIER = "";
REGISTER_APP_GROUPS = YES;
SKIP_INSTALL = YES;
STRING_CATALOG_GENERATE_SYMBOLS = YES;
diff --git a/MacOS/ProxyBridge/ProxyBridge.xcodeproj/xcshareddata/xcschemes/ProxyBridge.xcscheme b/MacOS/ProxyBridge/ProxyBridge.xcodeproj/xcshareddata/xcschemes/ProxyBridge.xcscheme
new file mode 100644
index 0000000..71faa96
--- /dev/null
+++ b/MacOS/ProxyBridge/ProxyBridge.xcodeproj/xcshareddata/xcschemes/ProxyBridge.xcscheme
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Scheme
+ LastUpgradeVersion = "2600"
+ version = "1.7">
+ <BuildAction
+ parallelizeBuildables = "YES"
+ buildImplicitDependencies = "YES"
+ buildArchitectures = "Automatic">
+ <BuildActionEntries>
+ <BuildActionEntry
+ buildForTesting = "YES"
+ buildForRunning = "YES"
+ buildForProfiling = "YES"
+ buildForArchiving = "YES"
+ buildForAnalyzing = "YES">
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "8466A1D22EC63B9400A8C2E5"
+ BuildableName = "ProxyBridge.app"
+ BlueprintName = "ProxyBridge"
+ ReferencedContainer = "container:ProxyBridge.xcodeproj">
+ </BuildableReference>
+ </BuildActionEntry>
+ </BuildActionEntries>
+ </BuildAction>
+ <TestAction
+ buildConfiguration = "Release"
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+ shouldUseLaunchSchemeArgsEnv = "YES"
+ shouldAutocreateTestPlan = "YES">
+ </TestAction>
+ <LaunchAction
+ buildConfiguration = "Release"
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+ launchStyle = "0"
+ useCustomWorkingDirectory = "NO"
+ ignoresPersistentStateOnLaunch = "NO"
+ debugDocumentVersioning = "YES"
+ debugServiceExtension = "internal"
+ allowLocationSimulation = "YES">
+ <BuildableProductRunnable
+ runnableDebuggingMode = "0">
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "8466A1D22EC63B9400A8C2E5"
+ BuildableName = "ProxyBridge.app"
+ BlueprintName = "ProxyBridge"
+ ReferencedContainer = "container:ProxyBridge.xcodeproj">
+ </BuildableReference>
+ </BuildableProductRunnable>
+ </LaunchAction>
+ <ProfileAction
+ buildConfiguration = "Release"
+ shouldUseLaunchSchemeArgsEnv = "YES"
+ savedToolIdentifier = ""
+ useCustomWorkingDirectory = "NO"
+ debugDocumentVersioning = "YES">
+ <BuildableProductRunnable
+ runnableDebuggingMode = "0">
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "8466A1D22EC63B9400A8C2E5"
+ BuildableName = "ProxyBridge.app"
+ BlueprintName = "ProxyBridge"
+ ReferencedContainer = "container:ProxyBridge.xcodeproj">
+ </BuildableReference>
+ </BuildableProductRunnable>
+ </ProfileAction>
+ <AnalyzeAction
+ buildConfiguration = "Release">
+ </AnalyzeAction>
+ <ArchiveAction
+ buildConfiguration = "Release"
+ revealArchiveInOrganizer = "YES">
+ </ArchiveAction>
+</Scheme>
diff --git a/MacOS/ProxyBridge/ProxyBridge/ProxyBridgeRelease.entitlements b/MacOS/ProxyBridge/ProxyBridge/ProxyBridgeRelease.entitlements
index 70d7710..cdc9491 100644
--- a/MacOS/ProxyBridge/ProxyBridge/ProxyBridgeRelease.entitlements
+++ b/MacOS/ProxyBridge/ProxyBridge/ProxyBridgeRelease.entitlements
@@ -4,6 +4,10 @@
<dict>
<key>com.apple.developer.networking.networkextension</key>
<array>
+ <string>dns-proxy</string>
+ <string>app-proxy-provider-systemextension</string>
+ <string>packet-tunnel-provider</string>
+ <string>content-filter-provider</string>
<string>app-proxy-provider</string>
</array>
<key>com.apple.developer.system-extension.install</key>
diff --git a/MacOS/ProxyBridge/build.sh b/MacOS/ProxyBridge/build.sh
index ac62cf2..6f45111 100755
--- a/MacOS/ProxyBridge/build.sh
+++ b/MacOS/ProxyBridge/build.sh
@@ -13,90 +13,39 @@ SCHEME_NAME="ProxyBridge"
OUTPUT_DIR="$SCRIPT_DIR/output"
PKG_NAME="ProxyBridge-v3.0-Universal-Installer.pkg"
PKG_PATH="$OUTPUT_DIR/$PKG_NAME"
-ARCHIVE_PATH="$SCRIPT_DIR/build/${PROJECT_NAME}.xcarchive"
-EXPORT_PATH="$SCRIPT_DIR/build/Export"
APP_NAME="${PROJECT_NAME}.app"
+APP_PATH="$OUTPUT_DIR/$APP_NAME"
LICENSE_FILE="$SCRIPT_DIR/../../LICENSE"
-SIGN_APP=${SIGN_APP:-""}
SIGN_PKG=${SIGN_PKG:-""}
NOTARIZE=${NOTARIZE:-""}
APPLE_ID=${APPLE_ID:-""}
TEAM_ID=${TEAM_ID:-""}
APP_PASSWORD=${APP_PASSWORD:-""}
-echo "Building ProxyBridge Universal Installer..."
+echo "Creating PKG installer from notarized app..."
-if [ ! -d "$OUTPUT_DIR" ]; then
- mkdir -p "$OUTPUT_DIR"
+# Check if app exists
+if [ ! -d "$APP_PATH" ]; then
+ echo "Error: $APP_NAME not found in $OUTPUT_DIR"
+ echo "Please export the notarized app from Xcode to the output folder first."
+ exit 1
fi
+# Remove old PKG if exists
if [ -f "$PKG_PATH" ]; then
+ echo "Removing old PKG..."
rm -f "$PKG_PATH"
fi
-echo "Cleaning build directory..."
-rm -rf "$SCRIPT_DIR/build"
-mkdir -p "$SCRIPT_DIR/build"
-
-echo "Building universal binary (ARM64 + x86_64)..."
-xcodebuild archive \
- -project "${PROJECT_NAME}.xcodeproj" \
- -scheme "$SCHEME_NAME" \
- -configuration Release \
- -archivePath "$ARCHIVE_PATH" \
- -destination "generic/platform=macOS" \
- ARCHS="arm64 x86_64" \
- ONLY_ACTIVE_ARCH=NO \
- CODE_SIGN_IDENTITY="" \
- CODE_SIGNING_REQUIRED=NO \
- CODE_SIGNING_ALLOWED=NO
-
-if [ $? -ne 0 ]; then
- echo "Build failed!"
- exit 1
-fi
-
-echo "Build completed successfully!"
-
-echo "Exporting archive..."
-xcodebuild -exportArchive \
- -archivePath "$ARCHIVE_PATH" \
- -exportPath "$EXPORT_PATH" \
- -exportOptionsPlist "${SCRIPT_DIR}/ExportOptions.plist"
-
-if [ $? -ne 0 ]; then
- echo "Export failed, copying app manually..."
- mkdir -p "$EXPORT_PATH"
- cp -R "${ARCHIVE_PATH}/Products/Applications/${APP_NAME}" "$EXPORT_PATH/"
-fi
-
-if [ ! -d "$EXPORT_PATH/$APP_NAME" ]; then
- echo "App not found at $EXPORT_PATH/$APP_NAME"
- exit 1
-fi
+echo "Verifying app signature..."
+codesign --verify --verbose=2 --deep --strict "$APP_PATH"
echo "Verifying universal binary..."
-lipo -info "$EXPORT_PATH/$APP_NAME/Contents/MacOS/$PROJECT_NAME"
+lipo -info "$APP_PATH/Contents/MacOS/$PROJECT_NAME"
-if [ -n "$SIGN_APP" ]; then
- echo "Signing application..."
-
- codesign --force --sign "$SIGN_APP" \
- --timestamp \
- --options runtime \
- --entitlements "$SCRIPT_DIR/extension/extension.entitlements" \
- "$EXPORT_PATH/$APP_NAME/Contents/Library/SystemExtensions/com.interceptsuite.ProxyBridge.extension.systemextension"
-
- codesign --force --sign "$SIGN_APP" \
- --timestamp \
- --options runtime \
- --entitlements "$SCRIPT_DIR/ProxyBridge/ProxyBridgeRelease.entitlements" \
- "$EXPORT_PATH/$APP_NAME"
-
- echo "Verifying application signature..."
- codesign --verify --verbose=2 "$EXPORT_PATH/$APP_NAME"
-fi
+echo "Verifying universal binary..."
+lipo -info "$APP_PATH/Contents/MacOS/$PROJECT_NAME"
echo "Creating PKG installer..."
@@ -104,13 +53,14 @@ COMPONENT_DIR="$SCRIPT_DIR/build/component"
TEMP_PKG="$SCRIPT_DIR/build/temp.pkg"
DISTRIBUTION_FILE="$SCRIPT_DIR/build/distribution.xml"
+mkdir -p "$SCRIPT_DIR/build"
mkdir -p "$COMPONENT_DIR"
-cp -R "$EXPORT_PATH/$APP_NAME" "$COMPONENT_DIR/"
+cp -R "$APP_PATH" "$COMPONENT_DIR/"
pkgbuild \
--root "$COMPONENT_DIR" \
--identifier "com.interceptsuite.${PROJECT_NAME}" \
- --version "1.0.0" \
+ --version "3.0.0" \
--install-location "/Applications" \
"$TEMP_PKG"
@@ -135,7 +85,7 @@ cat > "$DISTRIBUTION_FILE" << 'EOF'
<choice id="com.interceptsuite.ProxyBridge" visible="false">
<pkg-ref id="com.interceptsuite.ProxyBridge"/>
</choice>
- <pkg-ref id="com.interceptsuite.ProxyBridge" version="1.0.0" onConclusion="none">temp.pkg</pkg-ref>
+ <pkg-ref id="com.interceptsuite.ProxyBridge" version="3.0.0" onConclusion="none">temp.pkg</pkg-ref>
</installer-gui-script>
EOF
diff --git a/MacOS/ProxyBridge/extension/extension.entitlements b/MacOS/ProxyBridge/extension/extension.entitlements
index 2658e1b..7ad7f59 100644
--- a/MacOS/ProxyBridge/extension/extension.entitlements
+++ b/MacOS/ProxyBridge/extension/extension.entitlements
@@ -4,7 +4,7 @@
<dict>
<key>com.apple.developer.networking.networkextension</key>
<array>
- <string>app-proxy-provider</string>
+ <string>app-proxy-provider-systemextension</string>
</array>
<key>com.apple.security.application-groups</key>
<array>
diff --git a/MacOS/ProxyBridge/extension/extensionRelease.entitlements b/MacOS/ProxyBridge/extension/extensionRelease.entitlements
index 7ad7f59..1274914 100644
--- a/MacOS/ProxyBridge/extension/extensionRelease.entitlements
+++ b/MacOS/ProxyBridge/extension/extensionRelease.entitlements
@@ -4,7 +4,11 @@
<dict>
<key>com.apple.developer.networking.networkextension</key>
<array>
+ <string>dns-proxy</string>
+ <string>content-filter-provider</string>
<string>app-proxy-provider-systemextension</string>
+ <string>app-proxy-provider</string>
+ <string>packet-tunnel-provider</string>
</array>
<key>com.apple.security.application-groups</key>
<array>