chef 18.1.29 → 18.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/chef-universal-mingw-ucrt.gemspec +2 -2
- data/chef.gemspec +1 -2
- data/lib/chef/http/authenticator.rb +2 -2
- data/lib/chef/mixin/proxified_socket.rb +1 -1
- data/lib/chef/platform/query_helpers.rb +4 -2
- data/lib/chef/resource/macos_userdefaults.rb +9 -5
- data/lib/chef/resource/selinux_login.rb +129 -0
- data/lib/chef/resource/selinux_user.rb +137 -0
- data/lib/chef/resources.rb +2 -0
- data/lib/chef/version.rb +1 -1
- data/spec/data/apt/chef-integration-test-1.0/debian/rules +0 -0
- data/spec/data/apt/chef-integration-test-1.1/debian/rules +0 -0
- data/spec/data/apt/chef-integration-test2-1.0/debian/rules +0 -0
- data/spec/data/trusted_certs/intermediate.pem +38 -27
- data/spec/data/trusted_certs/opscode.pem +33 -54
- data/spec/functional/assets/chefinittest +0 -0
- data/spec/functional/assets/testchefsubsys +0 -0
- data/spec/functional/provider/remote_file/cache_control_data_spec.rb +0 -0
- data/spec/functional/resource/aix_service_spec.rb +0 -0
- data/spec/functional/resource/aixinit_service_spec.rb +0 -0
- data/spec/functional/resource/macos_userdefaults_spec.rb +4 -4
- data/spec/unit/resource/macos_user_defaults_spec.rb +4 -4
- data/spec/unit/resource/selinux_login_spec.rb +73 -0
- data/spec/unit/resource/selinux_user_spec.rb +92 -0
- metadata +14 -11
- data/lib/chef/powershell.rb +0 -81
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae48a568217d00b159123bf621bdaee21412909ef553f400719f251559c8a4d4
|
4
|
+
data.tar.gz: 553c80d44e9babb553588b0d01beac0a413aec6b0d21fdbaaf754cc1b3fa0928
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b2df041625cd266ae86c1a899c69493190f09018714cf281486291958268a669d65103555b63f0104345b5e281248d9bf7a2157a2de3632d92f84b4ed72c99c
|
7
|
+
data.tar.gz: 54b4391ec722faa770d54b7d5c6650285ab3dfdb933eed86938d579fb92b1501ad4bf3848e3f17950316eb5c8d9bc2bc99e044368246940321b10f3ddaaa1e97
|
@@ -15,9 +15,9 @@ gemspec.add_dependency "wmi-lite", "~> 1.0"
|
|
15
15
|
gemspec.add_dependency "win32-taskscheduler", "~> 2.0"
|
16
16
|
gemspec.add_dependency "iso8601", ">= 0.12.1", "< 0.14" # validate 0.14 when it comes out
|
17
17
|
gemspec.add_dependency "win32-certstore", "~> 0.6.15" # 0.5+ required for specifying user vs. system store
|
18
|
-
gemspec.add_dependency "chef-powershell", "~>
|
18
|
+
gemspec.add_dependency "chef-powershell", "~> 18.0.0" # The guts of the powershell_exec code have been moved to its own gem, chef-powershell. It's part of the chef-powershell-shim repo.
|
19
19
|
|
20
20
|
gemspec.extensions << "ext/win32-eventlog/Rakefile"
|
21
21
|
gemspec.files += Dir.glob("{distro,ext}/**/*")
|
22
22
|
|
23
|
-
gemspec
|
23
|
+
gemspec
|
data/chef.gemspec
CHANGED
@@ -49,8 +49,7 @@ Gem::Specification.new do |s|
|
|
49
49
|
s.add_dependency "net-ftp" # remote_file resource
|
50
50
|
s.add_dependency "erubis", "~> 2.7" # template resource / cookbook syntax check
|
51
51
|
s.add_dependency "diff-lcs", ">= 1.2.4", "!= 1.4.0", "< 1.6.0" # 1.4 breaks output. Used in lib/chef/util/diff
|
52
|
-
|
53
|
-
s.add_dependency "ffi-libarchive", "~> 1.1", ">= 1.1.3"
|
52
|
+
s.add_dependency "ffi-libarchive", "~> 1.0", ">= 1.0.3" # archive_file resource
|
54
53
|
s.add_dependency "chef-zero", ">= 14.0.11"
|
55
54
|
s.add_dependency "chef-vault" # chef-vault resources and helpers
|
56
55
|
|
@@ -124,11 +124,11 @@ class Chef
|
|
124
124
|
end
|
125
125
|
|
126
126
|
def self.get_cert_user
|
127
|
-
Chef::Config[:auth_key_registry_type] == "user" ?
|
127
|
+
Chef::Config[:auth_key_registry_type] == "user" ? "CurrentUser" : "LocalMachine"
|
128
128
|
end
|
129
129
|
|
130
130
|
def self.get_registry_user
|
131
|
-
Chef::Config[:auth_key_registry_type] == "user" ?
|
131
|
+
Chef::Config[:auth_key_registry_type] == "user" ? "HKEY_CURRENT_USER" : "HKEY_LOCAL_MACHINE"
|
132
132
|
end
|
133
133
|
|
134
134
|
def self.check_certstore_for_key(client_name)
|
@@ -17,11 +17,14 @@
|
|
17
17
|
#
|
18
18
|
|
19
19
|
require "chef-utils" unless defined?(ChefUtils::CANARY)
|
20
|
+
require_relative "../mixin/powershell_exec"
|
20
21
|
|
21
22
|
class Chef
|
22
23
|
class Platform
|
23
24
|
|
24
25
|
class << self
|
26
|
+
include Chef::Mixin::PowershellExec
|
27
|
+
|
25
28
|
def windows?
|
26
29
|
ChefUtils.windows?
|
27
30
|
end
|
@@ -58,8 +61,7 @@ class Chef
|
|
58
61
|
end
|
59
62
|
|
60
63
|
def dsc_refresh_mode_disabled?(node)
|
61
|
-
|
62
|
-
exec = Chef::PowerShell.new("Get-DscLocalConfigurationManager")
|
64
|
+
exec = powershell_exec!("Get-DscLocalConfigurationManager")
|
63
65
|
exec.error!
|
64
66
|
exec.result["RefreshMode"] == "Disabled"
|
65
67
|
end
|
@@ -50,15 +50,17 @@ class Chef
|
|
50
50
|
end
|
51
51
|
```
|
52
52
|
|
53
|
-
**
|
53
|
+
**Setting a value for specific user and hosts**
|
54
54
|
|
55
55
|
```ruby
|
56
|
-
macos_userdefaults '
|
57
|
-
key '
|
58
|
-
value
|
59
|
-
|
56
|
+
macos_userdefaults 'Enable macOS firewall' do
|
57
|
+
key 'globalstate'
|
58
|
+
value 1
|
59
|
+
user 'jane'
|
60
|
+
host :current
|
60
61
|
end
|
61
62
|
```
|
63
|
+
|
62
64
|
DOC
|
63
65
|
|
64
66
|
property :domain, String,
|
@@ -79,6 +81,7 @@ class Chef
|
|
79
81
|
|
80
82
|
property :host, [String, Symbol],
|
81
83
|
description: "Set either :current, :all or a hostname to set the user default at the host level.",
|
84
|
+
default: :all,
|
82
85
|
desired_state: false,
|
83
86
|
introduced: "16.3"
|
84
87
|
|
@@ -94,6 +97,7 @@ class Chef
|
|
94
97
|
|
95
98
|
property :user, [String, Symbol],
|
96
99
|
description: "The system user that the default will be applied to. Set :current for current user, :all for all users or pass a valid username",
|
100
|
+
default: :current,
|
97
101
|
desired_state: false
|
98
102
|
|
99
103
|
property :sudo, [TrueClass, FalseClass],
|
@@ -0,0 +1,129 @@
|
|
1
|
+
#
|
2
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
3
|
+
# you may not use this file except in compliance with the License.
|
4
|
+
# You may obtain a copy of the License at
|
5
|
+
#
|
6
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
7
|
+
#
|
8
|
+
# Unless required by applicable law or agreed to in writing, software
|
9
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
10
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
11
|
+
# See the License for the specific language governing permissions and
|
12
|
+
# limitations under the License.
|
13
|
+
|
14
|
+
require_relative "../resource"
|
15
|
+
require_relative "selinux/common_helpers"
|
16
|
+
|
17
|
+
class Chef
|
18
|
+
class Resource
|
19
|
+
class SelinuxLogin < Chef::Resource
|
20
|
+
unified_mode true
|
21
|
+
|
22
|
+
provides :selinux_login
|
23
|
+
|
24
|
+
description "Use the **selinux_login** resource to add, update, or remove SELinux user to OS login mappings."
|
25
|
+
introduced "18.1"
|
26
|
+
examples <<~DOC
|
27
|
+
**Manage test OS user mapping with a range of s0 and associated SELinux user test_u**:
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
selinux_login 'test' do
|
31
|
+
user 'test_u'
|
32
|
+
range 's0'
|
33
|
+
end
|
34
|
+
```
|
35
|
+
DOC
|
36
|
+
|
37
|
+
property :login, String,
|
38
|
+
name_property: true,
|
39
|
+
description: "An optional property to set the OS user login value if it differs from the resource block's name."
|
40
|
+
|
41
|
+
property :user, String,
|
42
|
+
description: "SELinux user to be mapped."
|
43
|
+
|
44
|
+
property :range, String,
|
45
|
+
description: "MLS/MCS security range for the SELinux user."
|
46
|
+
|
47
|
+
load_current_value do |new_resource|
|
48
|
+
logins = shell_out!("semanage login -l").stdout.split("\n")
|
49
|
+
|
50
|
+
current_login = logins.grep(/^#{Regexp.escape(new_resource.login)}\s+/) do |l|
|
51
|
+
l.match(/^(?<login>[^\s]+)\s+(?<user>[^\s]+)\s+(?<range>[^\s]+)/)
|
52
|
+
# match returns [<Match 'data'>] or [], shift converts that to <Match 'data'> or nil
|
53
|
+
end.shift
|
54
|
+
|
55
|
+
current_value_does_not_exist! unless current_login
|
56
|
+
|
57
|
+
# Existing resources should maintain their current configuration unless otherwise specified
|
58
|
+
new_resource.user ||= current_login[:user]
|
59
|
+
new_resource.range ||= current_login[:range]
|
60
|
+
|
61
|
+
user current_login[:user]
|
62
|
+
range current_login[:range]
|
63
|
+
end
|
64
|
+
|
65
|
+
action_class do
|
66
|
+
include Chef::SELinux::CommonHelpers
|
67
|
+
|
68
|
+
def semanage_login_args
|
69
|
+
# Generate arguments for semanage login -a or -m
|
70
|
+
args = ""
|
71
|
+
|
72
|
+
args += " -s #{new_resource.user}" if new_resource.user
|
73
|
+
args += " -r #{new_resource.range}" if new_resource.range
|
74
|
+
|
75
|
+
args
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
action :manage, description: "Sets the SELinux login mapping to the desired settings regardless of previous state." do
|
80
|
+
run_action(:add)
|
81
|
+
run_action(:modify)
|
82
|
+
end
|
83
|
+
|
84
|
+
# Create if doesn't exist, do not touch if user already exists
|
85
|
+
action :add, description: "Creates the SELinux login mapping if not previously created." do
|
86
|
+
raise "The user property must be populated to create a new SELinux login" if new_resource.user.to_s.empty?
|
87
|
+
|
88
|
+
if selinux_disabled?
|
89
|
+
Chef::Log.warn("Unable to add SELinux login #{new_resource.login} as SELinux is disabled")
|
90
|
+
return
|
91
|
+
end
|
92
|
+
|
93
|
+
unless current_resource
|
94
|
+
converge_if_changed do
|
95
|
+
shell_out!("semanage login -a#{semanage_login_args} #{new_resource.login}")
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
# Only modify port if it exists & doesn't have the correct context already
|
101
|
+
action :modify, description: "Updates the SELinux login mapping if previously created." do
|
102
|
+
if selinux_disabled?
|
103
|
+
Chef::Log.warn("Unable to modify SELinux login #{new_resource.login} as SELinux is disabled")
|
104
|
+
return
|
105
|
+
end
|
106
|
+
|
107
|
+
if current_resource
|
108
|
+
converge_if_changed do
|
109
|
+
shell_out!("semanage login -m#{semanage_login_args} #{new_resource.login}")
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
# Delete if exists
|
115
|
+
action :delete, description: "Removes the SELinux login mapping if previously created." do
|
116
|
+
if selinux_disabled?
|
117
|
+
Chef::Log.warn("Unable to delete SELinux login #{new_resource.login} as SELinux is disabled")
|
118
|
+
return
|
119
|
+
end
|
120
|
+
|
121
|
+
if current_resource
|
122
|
+
converge_by "deleting SELinux login #{new_resource.login}" do
|
123
|
+
shell_out!("semanage login -d #{new_resource.login}")
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
@@ -0,0 +1,137 @@
|
|
1
|
+
#
|
2
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
3
|
+
# you may not use this file except in compliance with the License.
|
4
|
+
# You may obtain a copy of the License at
|
5
|
+
#
|
6
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
7
|
+
#
|
8
|
+
# Unless required by applicable law or agreed to in writing, software
|
9
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
10
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
11
|
+
# See the License for the specific language governing permissions and
|
12
|
+
# limitations under the License.
|
13
|
+
|
14
|
+
require_relative "../resource"
|
15
|
+
require_relative "selinux/common_helpers"
|
16
|
+
|
17
|
+
class Chef
|
18
|
+
class Resource
|
19
|
+
class SelinuxUser < Chef::Resource
|
20
|
+
unified_mode true
|
21
|
+
|
22
|
+
provides :selinux_user
|
23
|
+
|
24
|
+
description "Use the **selinux_user** resource to add, update, or remove SELinux users."
|
25
|
+
introduced "18.1"
|
26
|
+
examples <<~DOC
|
27
|
+
**Manage test_u SELinux user with a level and range of s0 and roles sysadm_r and staff_r**:
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
selinux_user 'test_u' do
|
31
|
+
level 's0'
|
32
|
+
range 's0'
|
33
|
+
roles %w(sysadm_r staff_r)
|
34
|
+
end
|
35
|
+
```
|
36
|
+
DOC
|
37
|
+
|
38
|
+
property :user, String,
|
39
|
+
name_property: true,
|
40
|
+
description: "An optional property to set the SELinux user value if it differs from the resource block's name."
|
41
|
+
|
42
|
+
property :level, String,
|
43
|
+
description: "MLS/MCS security level for the SELinux user."
|
44
|
+
|
45
|
+
property :range, String,
|
46
|
+
description: "MLS/MCS security range for the SELinux user."
|
47
|
+
|
48
|
+
property :roles, Array,
|
49
|
+
description: "Associated SELinux roles for the user.",
|
50
|
+
coerce: proc { |r| Array(r).sort }
|
51
|
+
|
52
|
+
load_current_value do |new_resource|
|
53
|
+
users = shell_out!("semanage user -l").stdout.split("\n")
|
54
|
+
|
55
|
+
current_user = users.grep(/^#{Regexp.escape(new_resource.user)}\s+/) do |u|
|
56
|
+
u.match(/^(?<user>[^\s]+)\s+(?<prefix>[^\s]+)\s+(?<level>[^\s]+)\s+(?<range>[^\s]+)\s+(?<roles>.*)$/)
|
57
|
+
# match returns [<Match 'data'>] or [], shift converts that to <Match 'data'> or nil
|
58
|
+
end.shift
|
59
|
+
|
60
|
+
current_value_does_not_exist! unless current_user
|
61
|
+
|
62
|
+
# Existing resources should maintain their current configuration unless otherwise specified
|
63
|
+
new_resource.level ||= current_user[:level]
|
64
|
+
new_resource.range ||= current_user[:range]
|
65
|
+
new_resource.roles ||= current_user[:roles].to_s.split.sort
|
66
|
+
|
67
|
+
level current_user[:level]
|
68
|
+
range current_user[:range]
|
69
|
+
roles current_user[:roles].to_s.split.sort
|
70
|
+
end
|
71
|
+
|
72
|
+
action_class do
|
73
|
+
include Chef::SELinux::CommonHelpers
|
74
|
+
|
75
|
+
def semanage_user_args
|
76
|
+
# Generate arguments for semanage user -a or -m
|
77
|
+
args = ""
|
78
|
+
|
79
|
+
args += " -L #{new_resource.level}" if new_resource.level
|
80
|
+
args += " -r #{new_resource.range}" if new_resource.range
|
81
|
+
args += " -R '#{new_resource.roles.join(" ")}'" unless new_resource.roles.to_a.empty?
|
82
|
+
|
83
|
+
args
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
action :manage, description: "Sets the SELinux user to the desired settings regardless of previous state." do
|
88
|
+
run_action(:add)
|
89
|
+
run_action(:modify)
|
90
|
+
end
|
91
|
+
|
92
|
+
# Create if doesn't exist, do not touch if user already exists
|
93
|
+
action :add, description: "Creates the SELinux user if not previously created." do
|
94
|
+
raise "The roles property must be populated to create a new SELinux user" if new_resource.roles.to_a.empty?
|
95
|
+
|
96
|
+
if selinux_disabled?
|
97
|
+
Chef::Log.warn("Unable to add SELinux user #{new_resource.user} as SELinux is disabled")
|
98
|
+
return
|
99
|
+
end
|
100
|
+
|
101
|
+
unless current_resource
|
102
|
+
converge_if_changed do
|
103
|
+
shell_out!("semanage user -a#{semanage_user_args} #{new_resource.user}")
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
# Only modify port if it exists & doesn't have the correct context already
|
109
|
+
action :modify, description: "Updates the SELinux user if previously created." do
|
110
|
+
if selinux_disabled?
|
111
|
+
Chef::Log.warn("Unable to modify SELinux user #{new_resource.user} as SELinux is disabled")
|
112
|
+
return
|
113
|
+
end
|
114
|
+
|
115
|
+
if current_resource
|
116
|
+
converge_if_changed do
|
117
|
+
shell_out!("semanage user -m#{semanage_user_args} #{new_resource.user}")
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
# Delete if exists
|
123
|
+
action :delete, description: "Removes the SELinux user if previously created." do
|
124
|
+
if selinux_disabled?
|
125
|
+
Chef::Log.warn("Unable to delete SELinux user #{new_resource.user} as SELinux is disabled")
|
126
|
+
return
|
127
|
+
end
|
128
|
+
|
129
|
+
if current_resource
|
130
|
+
converge_by "deleting SELinux user #{new_resource.user}" do
|
131
|
+
shell_out!("semanage user -d #{new_resource.user}")
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
data/lib/chef/resources.rb
CHANGED
@@ -127,10 +127,12 @@ require_relative "resource/script"
|
|
127
127
|
require_relative "resource/selinux_boolean"
|
128
128
|
require_relative "resource/selinux_fcontext"
|
129
129
|
require_relative "resource/selinux_install"
|
130
|
+
require_relative "resource/selinux_login"
|
130
131
|
require_relative "resource/selinux_module"
|
131
132
|
require_relative "resource/selinux_permissive"
|
132
133
|
require_relative "resource/selinux_port"
|
133
134
|
require_relative "resource/selinux_state"
|
135
|
+
require_relative "resource/selinux_user"
|
134
136
|
require_relative "resource/service"
|
135
137
|
require_relative "resource/sudo"
|
136
138
|
require_relative "resource/sysctl"
|
data/lib/chef/version.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
@@ -1,27 +1,38 @@
|
|
1
|
-
-----BEGIN CERTIFICATE-----
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
1
|
+
-----BEGIN CERTIFICATE-----
|
2
|
+
MIIGrTCCBJWgAwIBAgIQDo0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gQWBBTnAiOAAE/Y
|
29
|
+
17yUC9k/dDlJMjyKeTAfBgNVHSMEGDAWgBRF66Kv9JLLgjEtUYunpyGd823IDzAN
|
30
|
+
BgkqhkiG9w0BAQsFAAOCAQEATtSJJ7n9HYd3fg8oBZDxCi/JOz69k5yQxq/6kVGH
|
31
|
+
MlRr6MrBcVFcmY61+uBiGZmmB5p8Eyfb5QKihBLZFfYKRFfENI9tcx861qABPd7j
|
32
|
+
guRFa7LrJf2AXh05kL5bQvbOkWDj+aBWDEgQzjNoe82Tq/Bqy09YD7l7XRsEgZ6n
|
33
|
+
IuJXSSfukpMIvmkIUwI6Ll3IGfRQgE4C2bBdkbSTh/mWloFVQI5m7YLYuyhf7Uxh
|
34
|
+
7QZYKBlTEUS8RyApsgRs2IlUmTt122d4LB6SeMZVPVgSETJuvUMMTTTbe8ZC2+y+
|
35
|
+
q5thTAaS447fISpQVwTAYKI11SSeZjcJSc/V+GWz4OJuwg==
|
57
36
|
-----END CERTIFICATE-----
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -38,12 +38,12 @@ describe Chef::Resource::MacosUserDefaults, :macos_only do
|
|
38
38
|
expect(resource.domain).to eq("NSGlobalDomain")
|
39
39
|
end
|
40
40
|
|
41
|
-
it "
|
42
|
-
expect(resource.host).to
|
41
|
+
it ":all for the host property" do
|
42
|
+
expect(resource.host).to eq(:all)
|
43
43
|
end
|
44
44
|
|
45
|
-
it "
|
46
|
-
expect(resource.user).to
|
45
|
+
it ":current for the user property" do
|
46
|
+
expect(resource.user).to eq(:current)
|
47
47
|
end
|
48
48
|
|
49
49
|
it ":write for resource action" do
|
@@ -39,12 +39,12 @@ describe Chef::Resource::MacosUserDefaults, :macos_only do
|
|
39
39
|
expect(resource.domain).to eq("NSGlobalDomain")
|
40
40
|
end
|
41
41
|
|
42
|
-
it "
|
43
|
-
expect(resource.host).to
|
42
|
+
it ":all for the host property" do
|
43
|
+
expect(resource.host).to eq(:all)
|
44
44
|
end
|
45
45
|
|
46
|
-
it "
|
47
|
-
expect(resource.user).to
|
46
|
+
it ":current for the user property" do
|
47
|
+
expect(resource.user).to eq(:current)
|
48
48
|
end
|
49
49
|
|
50
50
|
it ":write for resource action" do
|
@@ -0,0 +1,73 @@
|
|
1
|
+
#
|
2
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
3
|
+
# License:: Apache License, Version 2.0
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
#
|
17
|
+
|
18
|
+
require "spec_helper"
|
19
|
+
|
20
|
+
describe Chef::Resource::SelinuxLogin do
|
21
|
+
let(:node) { Chef::Node.new }
|
22
|
+
let(:events) { Chef::EventDispatch::Dispatcher.new }
|
23
|
+
let(:run_context) { Chef::RunContext.new(node, {}, events) }
|
24
|
+
let(:resource) { Chef::Resource::SelinuxLogin.new("fakey_fakerton", run_context) }
|
25
|
+
let(:provider) { resource.provider_for_action(:manage) }
|
26
|
+
|
27
|
+
it "sets login property as name_property" do
|
28
|
+
expect(resource.login).to eql("fakey_fakerton")
|
29
|
+
end
|
30
|
+
|
31
|
+
it "sets the default action as :manage" do
|
32
|
+
expect(resource.action).to eql([:manage])
|
33
|
+
end
|
34
|
+
|
35
|
+
it "supports :manage, :add, :modify, :delete actions" do
|
36
|
+
expect { resource.action :manage }.not_to raise_error
|
37
|
+
expect { resource.action :add }.not_to raise_error
|
38
|
+
expect { resource.action :modify }.not_to raise_error
|
39
|
+
expect { resource.action :delete }.not_to raise_error
|
40
|
+
end
|
41
|
+
|
42
|
+
describe "#semanage_login_args" do
|
43
|
+
let(:provider) { resource.provider_for_action(:modify) }
|
44
|
+
|
45
|
+
context "when no parameters are provided" do
|
46
|
+
it "returns an empty string" do
|
47
|
+
expect(provider.semanage_login_args).to eq("")
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
context "when all parameters are provided" do
|
52
|
+
it "returns all params" do
|
53
|
+
resource.user "user_u"
|
54
|
+
resource.range "s0"
|
55
|
+
expect(provider.semanage_login_args).to eq(" -s user_u -r s0")
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
context "when no user is provided" do
|
60
|
+
it "returns range param" do
|
61
|
+
resource.range "s0"
|
62
|
+
expect(provider.semanage_login_args).to eq(" -r s0")
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
context "when no range is provided" do
|
67
|
+
it "returns user param" do
|
68
|
+
resource.user "user_u"
|
69
|
+
expect(provider.semanage_login_args).to eq(" -s user_u")
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
#
|
2
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
3
|
+
# License:: Apache License, Version 2.0
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
#
|
17
|
+
|
18
|
+
require "spec_helper"
|
19
|
+
|
20
|
+
describe Chef::Resource::SelinuxUser do
|
21
|
+
let(:node) { Chef::Node.new }
|
22
|
+
let(:events) { Chef::EventDispatch::Dispatcher.new }
|
23
|
+
let(:run_context) { Chef::RunContext.new(node, {}, events) }
|
24
|
+
let(:resource) { Chef::Resource::SelinuxUser.new("fakey_fakerton", run_context) }
|
25
|
+
let(:provider) { resource.provider_for_action(:manage) }
|
26
|
+
let(:semanage_list) { double("shellout", stdout: "") }
|
27
|
+
|
28
|
+
it "sets user property as name_property" do
|
29
|
+
expect(resource.user).to eql("fakey_fakerton")
|
30
|
+
end
|
31
|
+
|
32
|
+
it "sets the default action as :manage" do
|
33
|
+
expect(resource.action).to eql([:manage])
|
34
|
+
end
|
35
|
+
|
36
|
+
it "supports :manage, :add, :modify, :delete actions" do
|
37
|
+
expect { resource.action :manage }.not_to raise_error
|
38
|
+
expect { resource.action :add }.not_to raise_error
|
39
|
+
expect { resource.action :modify }.not_to raise_error
|
40
|
+
expect { resource.action :delete }.not_to raise_error
|
41
|
+
end
|
42
|
+
|
43
|
+
it "sorts roles property values" do
|
44
|
+
expect { resource.roles %w{c a b} }.not_to raise_error
|
45
|
+
expect(resource.roles).to eq(%w{a b c})
|
46
|
+
end
|
47
|
+
|
48
|
+
describe "#semanage_user_args" do
|
49
|
+
let(:provider) { resource.provider_for_action(:modify) }
|
50
|
+
|
51
|
+
context "when no parameters are provided" do
|
52
|
+
it "returns an empty string" do
|
53
|
+
expect(provider.semanage_user_args).to eq("")
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
context "when all parameters are provided" do
|
58
|
+
it "returns all params" do
|
59
|
+
resource.level "s0"
|
60
|
+
resource.range "s0"
|
61
|
+
resource.roles %w{sysadm_r staff_r}
|
62
|
+
expect(provider.semanage_user_args).to eq(" -L s0 -r s0 -R 'staff_r sysadm_r'")
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
context "when no roles are provided" do
|
67
|
+
it "returns level and range params" do
|
68
|
+
resource.level "s0"
|
69
|
+
resource.range "s0"
|
70
|
+
resource.roles []
|
71
|
+
|
72
|
+
expect(provider.semanage_user_args).to eq(" -L s0 -r s0")
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
context "when no range is provided" do
|
77
|
+
it "returns level and roles params" do
|
78
|
+
resource.level "s0"
|
79
|
+
resource.roles %w{sysadm_r staff_r}
|
80
|
+
expect(provider.semanage_user_args).to eq(" -L s0 -R 'staff_r sysadm_r'")
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
context "when no level is provided" do
|
85
|
+
it "returns range and roles params" do
|
86
|
+
resource.range "s0"
|
87
|
+
resource.roles %w{sysadm_r staff_r}
|
88
|
+
expect(provider.semanage_user_args).to eq(" -r s0 -R 'staff_r sysadm_r'")
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chef
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 18.
|
4
|
+
version: 18.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Jacob
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-04-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chef-config
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 18.
|
19
|
+
version: 18.2.7
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 18.
|
26
|
+
version: 18.2.7
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: chef-utils
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 18.
|
33
|
+
version: 18.2.7
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 18.
|
40
|
+
version: 18.2.7
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: train-core
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -336,20 +336,20 @@ dependencies:
|
|
336
336
|
requirements:
|
337
337
|
- - "~>"
|
338
338
|
- !ruby/object:Gem::Version
|
339
|
-
version: '1.
|
339
|
+
version: '1.0'
|
340
340
|
- - ">="
|
341
341
|
- !ruby/object:Gem::Version
|
342
|
-
version: 1.
|
342
|
+
version: 1.0.3
|
343
343
|
type: :runtime
|
344
344
|
prerelease: false
|
345
345
|
version_requirements: !ruby/object:Gem::Requirement
|
346
346
|
requirements:
|
347
347
|
- - "~>"
|
348
348
|
- !ruby/object:Gem::Version
|
349
|
-
version: '1.
|
349
|
+
version: '1.0'
|
350
350
|
- - ">="
|
351
351
|
- !ruby/object:Gem::Version
|
352
|
-
version: 1.
|
352
|
+
version: 1.0.3
|
353
353
|
- !ruby/object:Gem::Dependency
|
354
354
|
name: chef-zero
|
355
355
|
requirement: !ruby/object:Gem::Requirement
|
@@ -887,7 +887,6 @@ files:
|
|
887
887
|
- lib/chef/policy_builder/dynamic.rb
|
888
888
|
- lib/chef/policy_builder/expand_node_object.rb
|
889
889
|
- lib/chef/policy_builder/policyfile.rb
|
890
|
-
- lib/chef/powershell.rb
|
891
890
|
- lib/chef/property.rb
|
892
891
|
- lib/chef/provider.rb
|
893
892
|
- lib/chef/provider/batch.rb
|
@@ -1162,10 +1161,12 @@ files:
|
|
1162
1161
|
- lib/chef/resource/selinux_boolean.rb
|
1163
1162
|
- lib/chef/resource/selinux_fcontext.rb
|
1164
1163
|
- lib/chef/resource/selinux_install.rb
|
1164
|
+
- lib/chef/resource/selinux_login.rb
|
1165
1165
|
- lib/chef/resource/selinux_module.rb
|
1166
1166
|
- lib/chef/resource/selinux_permissive.rb
|
1167
1167
|
- lib/chef/resource/selinux_port.rb
|
1168
1168
|
- lib/chef/resource/selinux_state.rb
|
1169
|
+
- lib/chef/resource/selinux_user.rb
|
1169
1170
|
- lib/chef/resource/service.rb
|
1170
1171
|
- lib/chef/resource/smartos_package.rb
|
1171
1172
|
- lib/chef/resource/snap_package.rb
|
@@ -2324,10 +2325,12 @@ files:
|
|
2324
2325
|
- spec/unit/resource/selinux_boolean_spec.rb
|
2325
2326
|
- spec/unit/resource/selinux_fcontext_spec.rb
|
2326
2327
|
- spec/unit/resource/selinux_install_spec.rb
|
2328
|
+
- spec/unit/resource/selinux_login_spec.rb
|
2327
2329
|
- spec/unit/resource/selinux_module_spec.rb
|
2328
2330
|
- spec/unit/resource/selinux_permissive_spec.rb
|
2329
2331
|
- spec/unit/resource/selinux_port_spec.rb
|
2330
2332
|
- spec/unit/resource/selinux_state_spec.rb
|
2333
|
+
- spec/unit/resource/selinux_user_spec.rb
|
2331
2334
|
- spec/unit/resource/service_spec.rb
|
2332
2335
|
- spec/unit/resource/smartos_package_spec.rb
|
2333
2336
|
- spec/unit/resource/snap_package_spec.rb
|
data/lib/chef/powershell.rb
DELETED
@@ -1,81 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Stuart Preston (<stuart@chef.io>)
|
3
|
-
# Copyright:: Copyright (c) Chef Software Inc.
|
4
|
-
# License:: Apache License, Version 2.0
|
5
|
-
#
|
6
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
-
# you may not use this file except in compliance with the License.
|
8
|
-
# You may obtain a copy of the License at
|
9
|
-
#
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
12
|
-
# Unless required by applicable law or agreed to in writing, software
|
13
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
-
# See the License for the specific language governing permissions and
|
16
|
-
# limitations under the License.
|
17
|
-
|
18
|
-
require "ffi" unless defined?(FFI)
|
19
|
-
require_relative "json_compat"
|
20
|
-
|
21
|
-
class Chef
|
22
|
-
class PowerShell
|
23
|
-
extend FFI::Library
|
24
|
-
|
25
|
-
attr_reader :result
|
26
|
-
attr_reader :errors
|
27
|
-
attr_reader :verbose
|
28
|
-
|
29
|
-
# Run a command under PowerShell via FFI
|
30
|
-
# This implementation requires the managed dll and native wrapper to be in the library search
|
31
|
-
# path on Windows (i.e. c:\windows\system32 or in the same location as ruby.exe).
|
32
|
-
#
|
33
|
-
# Requires: .NET Framework 4.0 or higher on the target machine.
|
34
|
-
#
|
35
|
-
# @param script [String] script to run
|
36
|
-
# @param timeout [Integer, nil] timeout in seconds.
|
37
|
-
# @return [Object] output
|
38
|
-
def initialize(script, timeout: -1)
|
39
|
-
# This Powershell DLL source lives here: https://github.com/chef/chef-powershell-shim
|
40
|
-
# Every merge into that repo triggers a Habitat build and promotion. Running
|
41
|
-
# the rake :update_chef_exec_dll task in this (chef/chef) repo will pull down
|
42
|
-
# the built packages and copy the binaries to distro/ruby_bin_folder. Bundle install
|
43
|
-
# ensures that the correct architecture binaries are installed into the path.
|
44
|
-
@dll ||= "Chef.PowerShell.Wrapper.dll"
|
45
|
-
exec(script, timeout: timeout)
|
46
|
-
end
|
47
|
-
|
48
|
-
#
|
49
|
-
# Was there an error running the command
|
50
|
-
#
|
51
|
-
# @return [Boolean]
|
52
|
-
#
|
53
|
-
def error?
|
54
|
-
return true if errors.count > 0
|
55
|
-
|
56
|
-
false
|
57
|
-
end
|
58
|
-
|
59
|
-
class CommandFailed < RuntimeError; end
|
60
|
-
|
61
|
-
#
|
62
|
-
# @raise [Chef::PowerShell::CommandFailed] raise if the command failed
|
63
|
-
#
|
64
|
-
def error!
|
65
|
-
raise Chef::PowerShell::CommandFailed, "Unexpected exit in PowerShell command: #{@errors}" if error?
|
66
|
-
end
|
67
|
-
|
68
|
-
private
|
69
|
-
|
70
|
-
def exec(script, timeout: -1)
|
71
|
-
FFI.ffi_lib @dll
|
72
|
-
FFI.attach_function :execute_powershell, :ExecuteScript, %i{string int}, :pointer
|
73
|
-
timeout = -1 if timeout == 0 || timeout.nil?
|
74
|
-
execution = FFI.execute_powershell(script, timeout).read_utf16string
|
75
|
-
hashed_outcome = Chef::JSONCompat.parse(execution)
|
76
|
-
@result = Chef::JSONCompat.parse(hashed_outcome["result"])
|
77
|
-
@errors = hashed_outcome["errors"]
|
78
|
-
@verbose = hashed_outcome["verbose"]
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|