Skip to content

Latest commit

 

History

History
29 lines (22 loc) · 1.89 KB

File metadata and controls

29 lines (22 loc) · 1.89 KB

Based on code from https://github.com/kr/mitm.

To build:

  1. Install Go 1.19 (amd64), which requires macOS High Sierra 10.13 or higher.

1.1 Additional Go versions can be found under "Archived versions" on the Go releases page.

1.2 Although this could technically be built with an earlier version of Go, the advantage of using this version (at a minimum) is that it uses Apple's native system framework for certificate validation, which improves performance, and means the proxy respects the certificate trust settings in Keychain Access.

  1. In /usr/local/go/src/crypto/x509/root_darwin.go, change:
-	policies := macOS.CFArrayCreateMutable()
-	defer macOS.ReleaseCFArray(policies)
 	sslPolicy := macOS.SecPolicyCreateSSL(opts.DNSName)
-	macOS.CFArrayAppendValue(policies, sslPolicy)
+	defer macOS.CFRelease(sslPolicy)

-	trustObj, err := macOS.SecTrustCreateWithCertificates(certs, policies)
+	trustObj, err := macOS.SecTrustCreateWithCertificates(certs, sslPolicy)
  1. Build normally with go build.
  2. Place the aquaproxy binary in Package/Aqua\ Proxy/AquaProxy as aquaproxy-64
  3. Install Go 1.13. You may need to switch to an older OS at this point; the author uses Mavericks.
  4. Use Go 1.13 to build 32-bit AquaProxy with GOARCH=386 go build.
  5. Place the 32 bit aquaproxy binary in binary in Package/Aqua\ Proxy/AquaProxy as aquaproxy-32
  6. Run gen_compat_build.sh to inject needed compatibility libraries and lipo the slices together. Afterwards, delete the individual aquaproxy-64 and aquaproxy-32

Note: If you choose to rebuild libMacPortsLegacySupport, make sure to run the build on Snow Leopard and use make ARCHS="i386 x86_64" so the binary will be compatible with all supported systems.