Hi all. I thought this one was going to be quite easy but it's turining into a challenge.
A mail hosting organization I work with chaged certificates today and I'm trying to get the new cert installed and trusted.
Using a Mac that has trusted this cert, I exported it as a .cer into /private/tmp/certs and packaged it with Composer. I will call this cert mail.lamehost.com.cer.
I then created a test policy to install this .pkg and then run the script. The policy does install the cert in /private/tmp/certs but the script fails.
#!/bin/sh
/usr/bin/security add-trusted-cert -d -r trustAsRoot -k "/Library/Keychains/System.keychain" "/private/tmp/certs/mail.lamehost.com.cer" srm "/private/tmp/certs/mail.lamehost.com.cer"
I've tried trustRoot as well as trustAsRoot, as well as taking away the quotations marks.
I've also tried removing the /usr/bin before security.
But I keep getting the following error:
Script exit code: 2 Script result: Usage: add-trusted-cert [] [certFile] -d Add to admin cert store; default is user -r resultType resultType = trustRoot|trustAsRoot|deny|unspecified; default is trustRoot -p policy Specify policy constraint (ssl, smime, codeSign, IPSec, iChat, basic, swUpdate, pkgSign, pkinitClient, pkinitServer, eap) -a appPath Specify application constraint -s policyString Specify policy-specific string -e allowedError Specify allowed error (certExpired, hostnameMismatch) or integer -u keyUsage Specify key usage, an integer -k keychain Specify keychain to which cert is added -i settingsFileIn Input trust settings file; default is user domain -o settingsFileOut Output trust settings file; default is user domain -D Add default setting instead of per-cert setting certFile Certificate(s) Add trusted certificate(s). Error running script: return code was 2.
My test Mac I'm using is running El Capitan.
Where have I run astray?
