I'm trying to write a script that will import a certificate into a user's keychain, and then force it to be trusted. The certificate by default is untrusted since its a self signed cert.
First command for the cert is this:
That part works fine, the cert is now in the user's keychain but is untrusted.
Next command is this:
I assume that this is working, no error is thrown on that line.
The final command for the cert is this:
If I do the command in terminal, it prompts for the admin username/pass which is fine but when I hit okay, i get no errors and the command prompt but the cert is still untrusted in Keychain app.
What am I missing?
First command for the cert is this:
Code:
sudo -u $USERNAME /usr/bin/security import /Users/Shared/OurCert.cer -k /Users/$USERNAME/Library/Keychains/login.keychain
Next command is this:
Code:
sudo -u $USERNAME /usr/bin/security add-certificates /Users/Shared/OurCert.cer
The final command for the cert is this:
Code:
sudo -u $USERNAME /usr/bin/security add-trusted-cert /Users/Shared/OurCert.cer
What am I missing?