bolt 0.21.7 → 0.21.8
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of bolt might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/lib/bolt/transport/ssh/connection.rb +4 -5
- data/lib/bolt/transport/ssh.rb +4 -1
- data/lib/bolt/transport/winrm/connection.rb +3 -4
- data/lib/bolt/transport/winrm.rb +4 -1
- data/lib/bolt/version.rb +1 -1
- data/libexec/apply_catalog.rb +10 -2
- data/vendored/puppet/lib/puppet/application/apply.rb +20 -9
- data/vendored/puppet/lib/puppet/application/cert.rb +3 -1
- data/vendored/puppet/lib/puppet/application/device.rb +22 -5
- data/vendored/puppet/lib/puppet/configurer/fact_handler.rb +5 -1
- data/vendored/puppet/lib/puppet/configurer.rb +15 -2
- data/vendored/puppet/lib/puppet/defaults.rb +36 -25
- data/vendored/puppet/lib/puppet/face/certificate.rb +2 -0
- data/vendored/puppet/lib/puppet/feature/base.rb +0 -3
- data/vendored/puppet/lib/puppet/functions/call.rb +37 -0
- data/vendored/puppet/lib/puppet/functions.rb +5 -0
- data/vendored/puppet/lib/puppet/indirector/ldap.rb +6 -0
- data/vendored/puppet/lib/puppet/node/environment.rb +4 -2
- data/vendored/puppet/lib/puppet/parser/scope.rb +2 -2
- data/vendored/puppet/lib/puppet/pops/adapters.rb +14 -0
- data/vendored/puppet/lib/puppet/pops/evaluator/deferred_resolver.rb +128 -0
- data/vendored/puppet/lib/puppet/pops/evaluator/evaluator_impl.rb +4 -1
- data/vendored/puppet/lib/puppet/pops/functions/dispatch.rb +2 -0
- data/vendored/puppet/lib/puppet/pops/issues.rb +9 -1
- data/vendored/puppet/lib/puppet/pops/loader/static_loader.rb +0 -16
- data/vendored/puppet/lib/puppet/pops/loaders.rb +1 -3
- data/vendored/puppet/lib/puppet/pops/parser/eparser.rb +6 -6
- data/vendored/puppet/lib/puppet/pops/pcore.rb +11 -0
- data/vendored/puppet/lib/puppet/pops/types/type_factory.rb +17 -0
- data/vendored/puppet/lib/puppet/pops/validation/tasks_checker.rb +13 -5
- data/vendored/puppet/lib/puppet/pops.rb +1 -0
- data/vendored/puppet/lib/puppet/provider/service/debian.rb +1 -0
- data/vendored/puppet/lib/puppet/provider/service/smf.rb +2 -3
- data/vendored/puppet/lib/puppet/provider/service/upstart.rb +10 -2
- data/vendored/puppet/lib/puppet/ssl/certificate_authority.rb +6 -84
- data/vendored/puppet/lib/puppet/ssl/certificate_request.rb +11 -3
- data/vendored/puppet/lib/puppet/type/file.rb +3 -0
- data/vendored/puppet/lib/puppet/type/user.rb +17 -3
- data/vendored/puppet/lib/puppet/util/autoload.rb +36 -31
- data/vendored/puppet/lib/puppet/util.rb +2 -0
- metadata +3 -43
- data/vendored/puppet/lib/puppet/indirector/node/write_only_yaml.rb +0 -39
- data/vendored/puppet/lib/puppet/provider/augeas/augeas.rb +0 -573
- data/vendored/puppet/lib/puppet/provider/cisco.rb +0 -9
- data/vendored/puppet/lib/puppet/provider/computer/computer.rb +0 -20
- data/vendored/puppet/lib/puppet/provider/host/parsed.rb +0 -46
- data/vendored/puppet/lib/puppet/provider/interface/cisco.rb +0 -27
- data/vendored/puppet/lib/puppet/provider/macauthorization/macauthorization.rb +0 -298
- data/vendored/puppet/lib/puppet/provider/mcx/mcxcontent.rb +0 -173
- data/vendored/puppet/lib/puppet/provider/mount/parsed.rb +0 -282
- data/vendored/puppet/lib/puppet/provider/mount.rb +0 -76
- data/vendored/puppet/lib/puppet/provider/scheduled_task/win32_taskscheduler.rb +0 -590
- data/vendored/puppet/lib/puppet/provider/selboolean/getsetsebool.rb +0 -47
- data/vendored/puppet/lib/puppet/provider/selmodule/semodule.rb +0 -140
- data/vendored/puppet/lib/puppet/provider/ssh_authorized_key/parsed.rb +0 -105
- data/vendored/puppet/lib/puppet/provider/sshkey/parsed.rb +0 -50
- data/vendored/puppet/lib/puppet/provider/vlan/cisco.rb +0 -28
- data/vendored/puppet/lib/puppet/provider/yumrepo/inifile.rb +0 -315
- data/vendored/puppet/lib/puppet/type/augeas.rb +0 -211
- data/vendored/puppet/lib/puppet/type/computer.rb +0 -66
- data/vendored/puppet/lib/puppet/type/host.rb +0 -95
- data/vendored/puppet/lib/puppet/type/interface.rb +0 -121
- data/vendored/puppet/lib/puppet/type/k5login.rb +0 -165
- data/vendored/puppet/lib/puppet/type/macauthorization.rb +0 -167
- data/vendored/puppet/lib/puppet/type/mcx.rb +0 -98
- data/vendored/puppet/lib/puppet/type/mount.rb +0 -314
- data/vendored/puppet/lib/puppet/type/router.rb +0 -17
- data/vendored/puppet/lib/puppet/type/scheduled_task.rb +0 -183
- data/vendored/puppet/lib/puppet/type/selboolean.rb +0 -26
- data/vendored/puppet/lib/puppet/type/selmodule.rb +0 -59
- data/vendored/puppet/lib/puppet/type/ssh_authorized_key.rb +0 -143
- data/vendored/puppet/lib/puppet/type/sshkey.rb +0 -83
- data/vendored/puppet/lib/puppet/type/vlan.rb +0 -26
- data/vendored/puppet/lib/puppet/type/yumrepo.rb +0 -430
- data/vendored/puppet/lib/puppet/util/network_device/cisco/device.rb +0 -285
- data/vendored/puppet/lib/puppet/util/network_device/cisco/facts.rb +0 -72
- data/vendored/puppet/lib/puppet/util/network_device/cisco/interface.rb +0 -94
- data/vendored/puppet/lib/puppet/util/network_device/cisco.rb +0 -4
- data/vendored/puppet/lib/puppet/util/network_device/ipcalc.rb +0 -68
- data/vendored/puppet/lib/puppet/util/network_device/transport/ssh.rb +0 -126
- data/vendored/puppet/lib/puppet/util/network_device/transport/telnet.rb +0 -47
- data/vendored/puppet/lib/puppet/util/windows/taskscheduler.rb +0 -1267
@@ -1,183 +0,0 @@
|
|
1
|
-
require 'puppet/util'
|
2
|
-
|
3
|
-
Puppet::Type.newtype(:scheduled_task) do
|
4
|
-
include Puppet::Util
|
5
|
-
|
6
|
-
@doc = "Installs and manages Windows Scheduled Tasks. All attributes
|
7
|
-
except `name`, `command`, and `trigger` are optional; see the description
|
8
|
-
of the `trigger` attribute for details on setting schedules."
|
9
|
-
|
10
|
-
ensurable
|
11
|
-
|
12
|
-
newproperty(:enabled) do
|
13
|
-
desc "Whether the triggers for this task should be enabled. This attribute
|
14
|
-
affects every trigger for the task; triggers cannot be enabled or
|
15
|
-
disabled individually."
|
16
|
-
|
17
|
-
newvalue(:true, :event => :task_enabled)
|
18
|
-
newvalue(:false, :event => :task_disabled)
|
19
|
-
|
20
|
-
defaultto(:true)
|
21
|
-
end
|
22
|
-
|
23
|
-
newparam(:name) do
|
24
|
-
desc "The name assigned to the scheduled task. This will uniquely
|
25
|
-
identify the task on the system."
|
26
|
-
|
27
|
-
isnamevar
|
28
|
-
end
|
29
|
-
|
30
|
-
newproperty(:command) do
|
31
|
-
desc "The full path to the application to run, without any arguments."
|
32
|
-
|
33
|
-
validate do |value|
|
34
|
-
raise Puppet::Error.new(_('Must be specified using an absolute path.')) unless absolute_path?(value)
|
35
|
-
end
|
36
|
-
munge do |value|
|
37
|
-
# windows converts slashes to backslashes, so the *is* value
|
38
|
-
# has backslashes. Do the same for the *should* value, so that
|
39
|
-
# we are slash-insensitive. See #13009
|
40
|
-
File.expand_path(value).gsub(/\//, '\\')
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
newproperty(:working_dir) do
|
45
|
-
desc "The full path of the directory in which to start the command."
|
46
|
-
|
47
|
-
validate do |value|
|
48
|
-
raise Puppet::Error.new(_('Must be specified using an absolute path.')) unless absolute_path?(value)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
newproperty(:arguments) do
|
53
|
-
desc "Any arguments or flags that should be passed to the command. Multiple arguments
|
54
|
-
should be specified as a space-separated string."
|
55
|
-
end
|
56
|
-
|
57
|
-
newproperty(:user) do
|
58
|
-
desc "The user to run the scheduled task as. Please note that not
|
59
|
-
all security configurations will allow running a scheduled task
|
60
|
-
as 'SYSTEM', and saving the scheduled task under these
|
61
|
-
conditions will fail with a reported error of 'The operation
|
62
|
-
completed successfully'. It is recommended that you either
|
63
|
-
choose another user to run the scheduled task, or alter the
|
64
|
-
security policy to allow v1 scheduled tasks to run as the
|
65
|
-
'SYSTEM' account. Defaults to 'SYSTEM'.
|
66
|
-
|
67
|
-
Please also note that Puppet must be running as a privileged user
|
68
|
-
in order to manage `scheduled_task` resources. Running as an
|
69
|
-
unprivileged user will result in 'access denied' errors."
|
70
|
-
|
71
|
-
defaultto :system
|
72
|
-
|
73
|
-
def insync?(current)
|
74
|
-
provider.user_insync?(current, @should)
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
newparam(:password) do
|
79
|
-
desc "The password for the user specified in the 'user' attribute.
|
80
|
-
This is only used if specifying a user other than 'SYSTEM'.
|
81
|
-
Since there is no way to retrieve the password used to set the
|
82
|
-
account information for a task, this parameter will not be used
|
83
|
-
to determine if a scheduled task is in sync or not."
|
84
|
-
end
|
85
|
-
|
86
|
-
newproperty(:trigger, :array_matching => :all) do
|
87
|
-
desc <<-'EOT'
|
88
|
-
One or more triggers defining when the task should run. A single trigger is
|
89
|
-
represented as a hash, and multiple triggers can be specified with an array of
|
90
|
-
hashes.
|
91
|
-
|
92
|
-
A trigger can contain the following keys:
|
93
|
-
|
94
|
-
* For all triggers:
|
95
|
-
* `schedule` **(Required)** --- What kind of trigger this is.
|
96
|
-
Valid values are `daily`, `weekly`, `monthly`, or `once`. Each kind
|
97
|
-
of trigger is configured with a different set of keys; see the
|
98
|
-
sections below. (`once` triggers only need a start time/date.)
|
99
|
-
* `start_time` **(Required)** --- The time of day when the trigger should
|
100
|
-
first become active. Several time formats will work, but we
|
101
|
-
suggest 24-hour time formatted as HH:MM.
|
102
|
-
* `start_date` --- The date when the trigger should first become active.
|
103
|
-
Defaults to the current date. You should format dates as YYYY-MM-DD,
|
104
|
-
although other date formats may work. (Under the hood, this uses `Date.parse`.)
|
105
|
-
* `minutes_interval` --- The repeat interval in minutes.
|
106
|
-
* `minutes_duration` --- The duration in minutes, needs to be greater than the
|
107
|
-
minutes_interval.
|
108
|
-
* For `daily` triggers:
|
109
|
-
* `every` --- How often the task should run, as a number of days. Defaults
|
110
|
-
to 1. ("2" means every other day, "3" means every three days, and so on)
|
111
|
-
* For `weekly` triggers:
|
112
|
-
* `every` --- How often the task should run, as a number of weeks. Defaults
|
113
|
-
to 1. ("2" means every other week, "3" means every three weeks, and so on)
|
114
|
-
* `day_of_week` --- Which days of the week the task should run, as an array.
|
115
|
-
Defaults to all days. Each day must be one of `mon`, `tues`,
|
116
|
-
`wed`, `thurs`, `fri`, `sat`, `sun`, or `all`.
|
117
|
-
* For `monthly` (by date) triggers:
|
118
|
-
* `months` --- Which months the task should run, as an array. Defaults to
|
119
|
-
all months. Each month must be an integer between 1 and 12.
|
120
|
-
* `on` **(Required)** --- Which days of the month the task should run,
|
121
|
-
as an array. Each day must be an integer between 1 and 31.
|
122
|
-
* For `monthly` (by weekday) triggers:
|
123
|
-
* `months` --- Which months the task should run, as an array. Defaults to
|
124
|
-
all months. Each month must be an integer between 1 and 12.
|
125
|
-
* `day_of_week` **(Required)** --- Which day of the week the task should
|
126
|
-
run, as an array with only one element. Each day must be one of `mon`,
|
127
|
-
`tues`, `wed`, `thurs`, `fri`, `sat`, `sun`, or `all`.
|
128
|
-
* `which_occurrence` **(Required)** --- The occurrence of the chosen weekday
|
129
|
-
when the task should run. Must be one of `first`, `second`, `third`,
|
130
|
-
`fourth`, or `fifth`.
|
131
|
-
|
132
|
-
|
133
|
-
Examples:
|
134
|
-
|
135
|
-
# Run at 8am on the 1st and 15th days of the month in January, March,
|
136
|
-
# May, July, September, and November, starting after August 31st, 2011.
|
137
|
-
trigger => {
|
138
|
-
schedule => monthly,
|
139
|
-
start_date => '2011-08-31', # Defaults to current date
|
140
|
-
start_time => '08:00', # Must be specified
|
141
|
-
months => [1,3,5,7,9,11], # Defaults to all
|
142
|
-
on => [1, 15], # Must be specified
|
143
|
-
}
|
144
|
-
|
145
|
-
# Run at 8am on the first Monday of the month for January, March, and May,
|
146
|
-
# starting after August 31st, 2011.
|
147
|
-
trigger => {
|
148
|
-
schedule => monthly,
|
149
|
-
start_date => '2011-08-31', # Defaults to current date
|
150
|
-
start_time => '08:00', # Must be specified
|
151
|
-
months => [1,3,5], # Defaults to all
|
152
|
-
which_occurrence => first, # Must be specified
|
153
|
-
day_of_week => [mon], # Must be specified
|
154
|
-
}
|
155
|
-
|
156
|
-
# Run daily repeating every 30 minutes between 9am and 5pm (480 minutes) starting after August 31st, 2011.
|
157
|
-
trigger => {
|
158
|
-
schedule => daily,
|
159
|
-
start_date => '2011-08-31', # Defaults to current date
|
160
|
-
start_time => '8:00', # Must be specified
|
161
|
-
minutes_interval => 30,
|
162
|
-
minutes_duration => 480,
|
163
|
-
}
|
164
|
-
|
165
|
-
EOT
|
166
|
-
|
167
|
-
validate do |value|
|
168
|
-
provider.validate_trigger(value)
|
169
|
-
end
|
170
|
-
|
171
|
-
def insync?(current)
|
172
|
-
provider.trigger_insync?(current, @should)
|
173
|
-
end
|
174
|
-
|
175
|
-
def should_to_s(new_value=@should)
|
176
|
-
super(new_value)
|
177
|
-
end
|
178
|
-
|
179
|
-
def is_to_s(current_value=@is)
|
180
|
-
super(current_value)
|
181
|
-
end
|
182
|
-
end
|
183
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
module Puppet
|
2
|
-
Type.newtype(:selboolean) do
|
3
|
-
@doc = "Manages SELinux booleans on systems with SELinux support. The supported booleans
|
4
|
-
are any of the ones found in `/selinux/booleans/`."
|
5
|
-
|
6
|
-
newparam(:name) do
|
7
|
-
desc "The name of the SELinux boolean to be managed."
|
8
|
-
isnamevar
|
9
|
-
end
|
10
|
-
|
11
|
-
newproperty(:value) do
|
12
|
-
desc "Whether the SELinux boolean should be enabled or disabled."
|
13
|
-
newvalue(:on)
|
14
|
-
newvalue(:off)
|
15
|
-
end
|
16
|
-
|
17
|
-
newparam(:persistent) do
|
18
|
-
desc "If set true, SELinux booleans will be written to disk and persist across reboots.
|
19
|
-
The default is `false`."
|
20
|
-
|
21
|
-
defaultto :false
|
22
|
-
newvalues(:true, :false)
|
23
|
-
end
|
24
|
-
|
25
|
-
end
|
26
|
-
end
|
@@ -1,59 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Simple module for managing SELinux policy modules
|
3
|
-
#
|
4
|
-
|
5
|
-
Puppet::Type.newtype(:selmodule) do
|
6
|
-
@doc = "Manages loading and unloading of SELinux policy modules
|
7
|
-
on the system. Requires SELinux support. See man semodule(8)
|
8
|
-
for more information on SELinux policy modules.
|
9
|
-
|
10
|
-
**Autorequires:** If Puppet is managing the file containing this SELinux
|
11
|
-
policy module (which is either explicitly specified in the `selmodulepath`
|
12
|
-
attribute or will be found at {`selmoduledir`}/{`name`}.pp), the selmodule
|
13
|
-
resource will autorequire that file."
|
14
|
-
|
15
|
-
ensurable
|
16
|
-
|
17
|
-
newparam(:name) do
|
18
|
-
desc "The name of the SELinux policy to be managed. You should not
|
19
|
-
include the customary trailing .pp extension."
|
20
|
-
isnamevar
|
21
|
-
end
|
22
|
-
|
23
|
-
newparam(:selmoduledir) do
|
24
|
-
|
25
|
-
desc "The directory to look for the compiled pp module file in.
|
26
|
-
Currently defaults to `/usr/share/selinux/targeted`. If the
|
27
|
-
`selmodulepath` attribute is not specified, Puppet will expect to find
|
28
|
-
the module in `<selmoduledir>/<name>.pp`, where `name` is the value of the
|
29
|
-
`name` parameter."
|
30
|
-
|
31
|
-
defaultto "/usr/share/selinux/targeted"
|
32
|
-
end
|
33
|
-
|
34
|
-
newparam(:selmodulepath) do
|
35
|
-
|
36
|
-
desc "The full path to the compiled .pp policy module. You only need to use
|
37
|
-
this if the module file is not in the `selmoduledir` directory."
|
38
|
-
|
39
|
-
end
|
40
|
-
|
41
|
-
newproperty(:syncversion) do
|
42
|
-
|
43
|
-
desc "If set to `true`, the policy will be reloaded if the
|
44
|
-
version found in the on-disk file differs from the loaded
|
45
|
-
version. If set to `false` (the default) the only check
|
46
|
-
that will be made is if the policy is loaded at all or not."
|
47
|
-
|
48
|
-
newvalue(:true)
|
49
|
-
newvalue(:false)
|
50
|
-
end
|
51
|
-
|
52
|
-
autorequire(:file) do
|
53
|
-
if self[:selmodulepath]
|
54
|
-
[self[:selmodulepath]]
|
55
|
-
else
|
56
|
-
["#{self[:selmoduledir]}/#{self[:name]}.pp"]
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
@@ -1,143 +0,0 @@
|
|
1
|
-
module Puppet
|
2
|
-
Type.newtype(:ssh_authorized_key) do
|
3
|
-
@doc = "Manages SSH authorized keys. Currently only type 2 keys are supported.
|
4
|
-
|
5
|
-
In their native habitat, SSH keys usually appear as a single long line, in
|
6
|
-
the format `<TYPE> <KEY> <NAME/COMMENT>`. This resource type requires you
|
7
|
-
to split that line into several attributes. Thus, a key that appears in
|
8
|
-
your `~/.ssh/id_rsa.pub` file like this...
|
9
|
-
|
10
|
-
ssh-rsa AAAAB3Nza[...]qXfdaQ== nick@magpie.example.com
|
11
|
-
|
12
|
-
...would translate to the following resource:
|
13
|
-
|
14
|
-
ssh_authorized_key { 'nick@magpie.example.com':
|
15
|
-
ensure => present,
|
16
|
-
user => 'nick',
|
17
|
-
type => 'ssh-rsa',
|
18
|
-
key => 'AAAAB3Nza[...]qXfdaQ==',
|
19
|
-
}
|
20
|
-
|
21
|
-
To ensure that only the currently approved keys are present, you can purge
|
22
|
-
unmanaged SSH keys on a per-user basis. Do this with the `user` resource
|
23
|
-
type's `purge_ssh_keys` attribute:
|
24
|
-
|
25
|
-
user { 'nick':
|
26
|
-
ensure => present,
|
27
|
-
purge_ssh_keys => true,
|
28
|
-
}
|
29
|
-
|
30
|
-
This will remove any keys in `~/.ssh/authorized_keys` that aren't being
|
31
|
-
managed with `ssh_authorized_key` resources. See the documentation of the
|
32
|
-
`user` type for more details.
|
33
|
-
|
34
|
-
**Autorequires:** If Puppet is managing the user account in which this
|
35
|
-
SSH key should be installed, the `ssh_authorized_key` resource will autorequire
|
36
|
-
that user."
|
37
|
-
|
38
|
-
ensurable
|
39
|
-
|
40
|
-
newparam(:name) do
|
41
|
-
desc "The SSH key comment. This can be anything, and doesn't need to match
|
42
|
-
the original comment from the `.pub` file.
|
43
|
-
|
44
|
-
Due to internal limitations, this must be unique across all user accounts;
|
45
|
-
if you want to specify one key for multiple users, you must use a different
|
46
|
-
comment for each instance."
|
47
|
-
|
48
|
-
isnamevar
|
49
|
-
|
50
|
-
end
|
51
|
-
|
52
|
-
newproperty(:type) do
|
53
|
-
desc "The encryption type used."
|
54
|
-
|
55
|
-
newvalues :'ssh-dss', :'ssh-rsa', :'ecdsa-sha2-nistp256', :'ecdsa-sha2-nistp384', :'ecdsa-sha2-nistp521', :'ssh-ed25519'
|
56
|
-
|
57
|
-
aliasvalue(:dsa, :'ssh-dss')
|
58
|
-
aliasvalue(:ed25519, :'ssh-ed25519')
|
59
|
-
aliasvalue(:rsa, :'ssh-rsa')
|
60
|
-
end
|
61
|
-
|
62
|
-
newproperty(:key) do
|
63
|
-
desc "The public key itself; generally a long string of hex characters. The `key`
|
64
|
-
attribute may not contain whitespace.
|
65
|
-
|
66
|
-
Make sure to omit the following in this attribute (and specify them in
|
67
|
-
other attributes):
|
68
|
-
|
69
|
-
* Key headers, such as 'ssh-rsa' --- put these in the `type` attribute.
|
70
|
-
* Key identifiers / comments, such as 'joe@joescomputer.local' --- put these in
|
71
|
-
the `name` attribute/resource title."
|
72
|
-
|
73
|
-
validate do |value|
|
74
|
-
raise Puppet::Error, _("Key must not contain whitespace: %{value}") % { value: value } if value =~ /\s/
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
newproperty(:user) do
|
79
|
-
desc "The user account in which the SSH key should be installed. The resource
|
80
|
-
will autorequire this user if it is being managed as a `user` resource."
|
81
|
-
end
|
82
|
-
|
83
|
-
newproperty(:target) do
|
84
|
-
desc "The absolute filename in which to store the SSH key. This
|
85
|
-
property is optional and should be used only in cases where keys
|
86
|
-
are stored in a non-standard location, for instance when not in
|
87
|
-
`~user/.ssh/authorized_keys`."
|
88
|
-
|
89
|
-
defaultto :absent
|
90
|
-
|
91
|
-
def should
|
92
|
-
return super if defined?(@should) and @should[0] != :absent
|
93
|
-
|
94
|
-
return nil unless user = resource[:user]
|
95
|
-
|
96
|
-
begin
|
97
|
-
return File.expand_path("~#{user}/.ssh/authorized_keys")
|
98
|
-
rescue
|
99
|
-
Puppet.debug "The required user is not yet present on the system"
|
100
|
-
return nil
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
|
-
def insync?(is)
|
105
|
-
is == should
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
newproperty(:options, :array_matching => :all) do
|
110
|
-
desc "Key options; see sshd(8) for possible values. Multiple values
|
111
|
-
should be specified as an array."
|
112
|
-
|
113
|
-
defaultto do :absent end
|
114
|
-
|
115
|
-
validate do |value|
|
116
|
-
unless value == :absent or value =~ /^[-a-z0-9A-Z_]+(?:=\".*?\")?$/
|
117
|
-
raise Puppet::Error, _("Option %{value} is not valid. A single option must either be of the form 'option' or 'option=\"value\". Multiple options must be provided as an array") % { value: value }
|
118
|
-
end
|
119
|
-
end
|
120
|
-
end
|
121
|
-
|
122
|
-
autorequire(:user) do
|
123
|
-
should(:user) if should(:user)
|
124
|
-
end
|
125
|
-
|
126
|
-
validate do
|
127
|
-
# Go ahead if target attribute is defined
|
128
|
-
return if @parameters[:target].shouldorig[0] != :absent
|
129
|
-
|
130
|
-
# Go ahead if user attribute is defined
|
131
|
-
return if @parameters.include?(:user)
|
132
|
-
|
133
|
-
# If neither target nor user is defined, this is an error
|
134
|
-
raise Puppet::Error, _("Attribute 'user' or 'target' is mandatory")
|
135
|
-
end
|
136
|
-
|
137
|
-
# regular expression suitable for use by a ParsedFile based provider
|
138
|
-
REGEX = /^(?:(.+)\s+)?(ssh-dss|ssh-ed25519|ssh-rsa|ecdsa-sha2-nistp256|ecdsa-sha2-nistp384|ecdsa-sha2-nistp521)\s+([^ ]+)\s*(.*)$/
|
139
|
-
def self.keyline_regex
|
140
|
-
REGEX
|
141
|
-
end
|
142
|
-
end
|
143
|
-
end
|
@@ -1,83 +0,0 @@
|
|
1
|
-
module Puppet
|
2
|
-
Type.newtype(:sshkey) do
|
3
|
-
@doc = "Installs and manages ssh host keys. By default, this type will
|
4
|
-
install keys into `/etc/ssh/ssh_known_hosts`. To manage ssh keys in a
|
5
|
-
different `known_hosts` file, such as a user's personal `known_hosts`,
|
6
|
-
pass its path to the `target` parameter. See the `ssh_authorized_key`
|
7
|
-
type to manage authorized keys."
|
8
|
-
|
9
|
-
ensurable
|
10
|
-
|
11
|
-
newproperty(:type) do
|
12
|
-
desc "The encryption type used. Probably ssh-dss or ssh-rsa."
|
13
|
-
|
14
|
-
newvalues :'ssh-dss', :'ssh-ed25519', :'ssh-rsa', :'ecdsa-sha2-nistp256', :'ecdsa-sha2-nistp384', :'ecdsa-sha2-nistp521'
|
15
|
-
|
16
|
-
aliasvalue(:dsa, :'ssh-dss')
|
17
|
-
aliasvalue(:ed25519, :'ssh-ed25519')
|
18
|
-
aliasvalue(:rsa, :'ssh-rsa')
|
19
|
-
end
|
20
|
-
|
21
|
-
newproperty(:key) do
|
22
|
-
desc "The key itself; generally a long string of uuencoded characters. The `key`
|
23
|
-
attribute may not contain whitespace.
|
24
|
-
|
25
|
-
Make sure to omit the following in this attribute (and specify them in
|
26
|
-
other attributes):
|
27
|
-
|
28
|
-
* Key headers, such as 'ssh-rsa' --- put these in the `type` attribute.
|
29
|
-
* Key identifiers / comments, such as 'joescomputer.local' --- put these in
|
30
|
-
the `name` attribute/resource title."
|
31
|
-
end
|
32
|
-
|
33
|
-
# FIXME This should automagically check for aliases to the hosts, just
|
34
|
-
# to see if we can automatically glean any aliases.
|
35
|
-
newproperty(:host_aliases) do
|
36
|
-
desc 'Any aliases the host might have. Multiple values must be
|
37
|
-
specified as an array.'
|
38
|
-
|
39
|
-
attr_accessor :meta
|
40
|
-
|
41
|
-
def insync?(is)
|
42
|
-
is == @should
|
43
|
-
end
|
44
|
-
# We actually want to return the whole array here, not just the first
|
45
|
-
# value.
|
46
|
-
def should
|
47
|
-
defined?(@should) ? @should : nil
|
48
|
-
end
|
49
|
-
|
50
|
-
validate do |value|
|
51
|
-
if value =~ /\s/
|
52
|
-
raise Puppet::Error, _("Aliases cannot include whitespace")
|
53
|
-
end
|
54
|
-
if value =~ /,/
|
55
|
-
raise Puppet::Error, _("Aliases must be provided as an array, not a comma-separated list")
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
newparam(:name) do
|
61
|
-
desc "The host name that the key is associated with."
|
62
|
-
|
63
|
-
isnamevar
|
64
|
-
|
65
|
-
validate do |value|
|
66
|
-
raise Puppet::Error, _("Resourcename cannot include whitespaces") if value =~ /\s/
|
67
|
-
raise Puppet::Error, _("No comma in resourcename allowed. If you want to specify aliases use the host_aliases property") if value.include?(',')
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
newproperty(:target) do
|
72
|
-
desc "The file in which to store the ssh key. Only used by
|
73
|
-
the `parsed` provider."
|
74
|
-
|
75
|
-
defaultto { if @resource.class.defaultprovider.ancestors.include?(Puppet::Provider::ParsedFile)
|
76
|
-
@resource.class.defaultprovider.default_target
|
77
|
-
else
|
78
|
-
nil
|
79
|
-
end
|
80
|
-
}
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Manages a Vlan on a given router or switch
|
3
|
-
#
|
4
|
-
|
5
|
-
Puppet::Type.newtype(:vlan) do
|
6
|
-
@doc = "Manages a VLAN on a router or switch."
|
7
|
-
|
8
|
-
apply_to_device
|
9
|
-
|
10
|
-
ensurable
|
11
|
-
|
12
|
-
newparam(:name) do
|
13
|
-
desc "The numeric VLAN ID."
|
14
|
-
isnamevar
|
15
|
-
|
16
|
-
newvalues(/^\d+/)
|
17
|
-
end
|
18
|
-
|
19
|
-
newproperty(:description) do
|
20
|
-
desc "The VLAN's name."
|
21
|
-
end
|
22
|
-
|
23
|
-
newparam(:device_url) do
|
24
|
-
desc "The URL of the router or switch maintaining this VLAN."
|
25
|
-
end
|
26
|
-
end
|