chef 18.1.29-x64-mingw-ucrt → 18.2.7-x64-mingw-ucrt

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
@@ -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
@@ -23,7 +23,7 @@ require_relative "version_string"
23
23
 
24
24
  class Chef
25
25
  CHEF_ROOT = File.expand_path("..", __dir__)
26
- VERSION = Chef::VersionString.new("18.1.29")
26
+ VERSION = Chef::VersionString.new("18.2.7")
27
27
  end
28
28
 
29
29
  #
@@ -1,27 +1,38 @@
1
- -----BEGIN CERTIFICATE-----
2
- MIIEjzCCA3egAwIBAgIQBp4dt3/PHfupevXlyaJANzANBgkqhkiG9w0BAQUFADBh
3
- MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
4
- d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBD
5
- QTAeFw0xMzAzMDgxMjAwMDBaFw0yMzAzMDgxMjAwMDBaMEgxCzAJBgNVBAYTAlVT
6
- MRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxIjAgBgNVBAMTGURpZ2lDZXJ0IFNlY3Vy
7
- ZSBTZXJ2ZXIgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC7V+Qh
8
- qdWbYDd+jqFhf4HiGsJ1ZNmRUAvkNkQkbjDSm3on+sJqrmpwCTi5IArIZRBKiKwx
9
- 8tyS8mOhXYBj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SSeZjcJSc/V+GWz4OJuwg==
57
36
  -----END CERTIFICATE-----
@@ -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 "nil for the host property" do
42
- expect(resource.host).to be_nil
41
+ it ":all for the host property" do
42
+ expect(resource.host).to eq(:all)
43
43
  end
44
44
 
45
- it "nil for the user property" do
46
- expect(resource.user).to be_nil
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 "nil for the host property" do
43
- expect(resource.host).to be_nil
42
+ it ":all for the host property" do
43
+ expect(resource.host).to eq(:all)
44
44
  end
45
45
 
46
- it "nil for the user property" do
47
- expect(resource.user).to be_nil
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