2020-12-19 19:23:51 +00:00
|
|
|
# security
|
|
|
|
|
2022-07-28 08:07:40 +01:00
|
|
|
> Administer keychains, keys, certificates and the Security framework.
|
2020-12-19 19:23:51 +00:00
|
|
|
> More information: <https://ss64.com/osx/security.html>.
|
|
|
|
|
2022-07-28 08:07:40 +01:00
|
|
|
- List all available keychains:
|
2020-12-19 19:23:51 +00:00
|
|
|
|
|
|
|
`security list-keychains`
|
|
|
|
|
|
|
|
- Delete a specific keychain:
|
|
|
|
|
2022-07-28 08:07:40 +01:00
|
|
|
`security delete-keychain {{path/to/file.keychain}}`
|
2020-12-19 19:23:51 +00:00
|
|
|
|
|
|
|
- Create a keychain:
|
|
|
|
|
2022-07-28 08:07:40 +01:00
|
|
|
`security create-keychain -p {{password}} {{path/to/file.keychain}}`
|
2021-10-04 15:37:47 +01:00
|
|
|
|
|
|
|
- Set a certificate to use with a website or [s]ervice by its [c]ommon name (fails if several certificates with the same common name exist):
|
|
|
|
|
|
|
|
`security set-identity-preference -s {{URL|hostname|service}} -c "{{common_name}}" {{path/to/file.keychain}}`
|
|
|
|
|
|
|
|
- Add a certificate from file to a [k]eychain (if -k isn't specified, the default keychain is used):
|
|
|
|
|
2022-07-28 08:07:40 +01:00
|
|
|
`security add-certificates -k {{keychain.name}} {{path/to/cert.pem}}`
|
|
|
|
|
|
|
|
- Add a CA certificate to the per-user Trust Settings:
|
|
|
|
|
|
|
|
`security add-trusted-cert -k {{path/to/user-keychain.keychain-db}} {{path/to/ca-cert.pem}}`
|
|
|
|
|
|
|
|
- Remove a CA certificate from the per-user Trust Settings:
|
|
|
|
|
|
|
|
`security remove-trusted-cert {{path/to/ca-cert.pem}}`
|