ADVTOOLS / ADVTrustStore

ADVTrustStore is a simple management script to import/list/remove CA certificates to the iOS simulator. It is working for iOS 5 and iOS 6.
355 stars 71 forks source link

Doesn't automatically trust installed cert #12

Open scotthmccoy opened 4 years ago

scotthmccoy commented 4 years ago

Running ./iosCertTrustManager.py -a cert_authority.pem correctly installs my cert but I have to manually visit the General -> About -> Certificate Trust Settings page on each simulator and flip the switch to trust the installed cert.

Somehow Charles' install-charles-ca-cert-for-iphone-simulator.sh script is able to both install and trust their cert on my simulators and they seem to use the same basic mechanism (writing to ls ~/Library/Developer/CoreSimulator/Devices/*/data/Library/Keychains/TrustStore.sqlite3) so I feel like I must be missing something.

Any advice?

NghiaTranUIT commented 4 years ago

Just tested on Proxyman, which use a this script for installing Proxyman CA to iOS Simulators, and it does install & enable the Trust Setting in iOS Simulator 13.2.2 (Xcode 11.2.1).

Which version are you using?

Ref: https://docs.proxyman.io/debug-devices/ios-simulator

scotthmccoy commented 4 years ago

I just tried with the most recent version and it did not trust the cert: image

NghiaTranUIT commented 4 years ago

Look like iOS Simulator 13.3 change the way how to enabled it. Let me test it

NghiaTranUIT commented 4 years ago
Screen Shot 2019-12-12 at 11 32 51

Just tested on Xcode 11.3 and iOS 13.3 Simulator and the script is work well with no extra arguments. Work with Proxyman.

Here is the minimal version of this script: https://gist.github.com/NghiaTranUIT/114e50e327888ff447f96fb7ef541db2

scotthmccoy commented 4 years ago

I tend to wipe my simulators, boot them, wait 60 seconds to make sure they are booted and then run the script. I'm starting to suspect that doing so prevents new certs from being trusted in some way.

I've read somewhere that the TrustStore db doesn't exist until the sim tries to make an https connection, but I've not found that to be true, nor does making the sim navigate to an https page seem to alleviate the problem of the cert not being trusted on installation.

scotthmccoy commented 4 years ago

Also, I don't think this issue is limited to me. it looks like 2 other users are experiencing this same issue but they describe it differently: https://github.com/ADVTOOLS/ADVTrustStore/issues/11

basterboy commented 4 years ago

Hi, I have similar issue. The only difference is the cert is selected as trusted(on Certificate Trust Settings screen) but it doesn't work. I need to flip the toggle to non-trust then switch to trust again to make it work. I use iPhone 11 simulator - 13.3.

Installation steps:

  1. delete existing iPhone 11 sim from Xcode(devices and simulators menu).
  2. create a new one.
  3. launch the simulator.(there is no ./Keychains/TrustStore.sqlite3 db unless you launch the simulator)
  4. close the simulator
  5. run iosCertTrustManager.py script with parameters(-a ./mySert.pem -t /Users/user/Library/Developer/CoreSimulator/Devices/CB2145A4-3D93-457D-91EE-ED85CB25765C/data/Library/Keychains/TrustStore.sqlite3)
  6. there aren't any errors in console. the cert added successfully - Certificate added
  7. launch the simulator again.

I use a self-signed cert, can it be a problem?

sotayamashita commented 3 years ago

FYI: Tested on Xcode 12.2 and iOS 14.2 Simulator. The script which @NghiaTranUIT provided, works well with the mitmproxy.

-- update 2020/12/11 However, I cannot see https://appele.com due to not trusted. :cry: I can see https://google.com 🤔 @NghiaTranUIT Do you have any idea? I am using mitmproxy's certificate for it. Thanks in advance