3 Puppet::Type.newtype(:apt_key) do
6 This type provides Puppet with the capabilities to manage GPG keys needed
7 by apt to perform package validation. Apt has it's own GPG keyring that can
8 be manipulated through the `apt-key` command.
11 source => 'http://apt.puppetlabs.com/pubkey.gpg'
16 If Puppet is given the location of a key file which looks like an absolute
17 path this type will autorequire that file.
23 if self[:content] and self[:source]
24 fail('The properties content and source are mutually exclusive.')
28 newparam(:id, :namevar => true) do
29 desc 'The ID of the key you want to manage.'
30 # GPG key ID's should be either 32-bit (short) or 64-bit (long) key ID's
31 # and may start with the optional 0x, or they can be 40-digit key fingerprints
32 newvalues(/\A(0x)?[0-9a-fA-F]{8}\Z/, /\A(0x)?[0-9a-fA-F]{16}\Z/, /\A(0x)?[0-9a-fA-F]{40}\Z/)
34 if value.start_with?('0x')
35 id = value.partition('0x').last.upcase
44 desc 'The content of, or string representing, a GPG key.'
48 desc 'Location of a GPG key file, /path/to/file, ftp://, http:// or https://'
49 newvalues(/\Ahttps?:\/\//, /\Aftp:\/\//, /\A\/\w+/)
53 if self[:source] and Pathname.new(self[:source]).absolute?
59 desc 'The key server to fetch the key from based on the ID. It can either be a domain name or url.'
60 defaultto :'keyserver.ubuntu.com'
62 newvalues(/\A((hkp|http|https):\/\/)?([a-z\d])([a-z\d-]{0,61}\.)+[a-z\d]+(:\d{2,5})?$/)
65 newparam(:keyserver_options) do
66 desc 'Additional options to pass to apt-key\'s --keyserver-options.'
69 newproperty(:fingerprint) do
71 The 40-digit hexadecimal fingerprint of the specified GPG key.
73 This property is read-only.
79 The 16-digit hexadecimal id of the specified GPG key.
81 This property is read-only.
85 newproperty(:short) do
87 The 8-digit hexadecimal id of the specified GPG key.
89 This property is read-only.
93 newproperty(:expired) do
95 Indicates if the key has expired.
97 This property is read-only.
101 newproperty(:expiry) do
103 The date the key will expire, or nil if it has no expiry date.
105 This property is read-only.
109 newproperty(:size) do
111 The key size, usually a multiple of 1024.
113 This property is read-only.
117 newproperty(:type) do
119 The key type, one of: rsa, dsa, ecc, ecdsa
121 This property is read-only.
125 newproperty(:created) do
127 Date the key was created.
129 This property is read-only.