Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
98 lines (71 sloc) 1.91 KB

keychain

Use the keychain resource to manage keychains. Under the hood, the keychain resource executes the security command in the security_cmd library.

Syntax

The full syntax for all of the properties available to the keychain resource is:

keychain 'keychain name' do
  keychain                      String # path to selected keychain
  kc_passwd                     String # password for selected keychain
end

Actions

:create

      Create a keychain as specified by the keychain property. This is the default action.

:delete

      Delete a keychain as specified by the keychain property.

:lock

      Lock a keychain as specified by the keychain property. If no keychain is specified, the default keychain will be locked instead.

:unlock

      Using the kc_passwd property, unlock a keychain as specified by the keychain property. If no keychain is specified, the default keychain will be unlocked instead.

Examples

Create a keychain

keychain 'test' do
  keychain '/User/edward/Library/Keychains/test.keychain'
  kc_passwd 'test'
  action :create
end

Delete a keychain

keychain 'test' do
  keychain '/User/edward/Library/Keychains/test.keychain'
  action :delete
end

Create a login keychain

keychain 'login' do
  keychain '/User/edward/Library/Keychains/login.keychain'
  kc_passwd 'login_password'
  action :create
end

Lock a keychain

keychain 'test' do
  keychain '/User/edward/Library/Keychains/test.keychain'
  action :lock
end

Unlock a keychain

keychain 'test' do
  keychain '/User/edward/Library/Keychains/test.keychain'
  kc_passwd 'test'
  action :unlock
end
You can’t perform that action at this time.