serverspec 0.2.27 → 0.2.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +1 -0
- data/lib/serverspec/commands/linux.rb +1 -4
- data/lib/serverspec/commands/redhat.rb +5 -0
- data/lib/serverspec/commands/solaris.rb +1 -1
- data/lib/serverspec/version.rb +1 -1
- data/spec/debian/commands_spec.rb +3 -3
- data/spec/gentoo/commands_spec.rb +4 -3
- data/spec/solaris/commands_spec.rb +3 -3
- metadata +3 -3
data/.gitignore
CHANGED
@@ -6,10 +6,7 @@ module Serverspec
|
|
6
6
|
class NotImplementedError < Exception; end
|
7
7
|
|
8
8
|
def check_access_by_user file, user, access
|
9
|
-
|
10
|
-
# but using runuser bcs in linux it's common to change the default sudo configuration.
|
11
|
-
# - Using specific shell to avoid system users not logging in
|
12
|
-
"runuser -s /bin/sh -c \"test -#{access} #{file}\" #{user}"
|
9
|
+
"su -s /bin/sh -c \"/usr/bin/test -#{access} #{file}\" #{user}"
|
13
10
|
end
|
14
11
|
|
15
12
|
def check_iptables_rule rule, table=nil, chain=nil
|
@@ -1,6 +1,11 @@
|
|
1
1
|
module Serverspec
|
2
2
|
module Commands
|
3
3
|
class RedHat < Linux
|
4
|
+
def check_access_by_user file, user, access
|
5
|
+
# Redhat-specific
|
6
|
+
"runuser -s /bin/sh -c \"test -#{access} #{file}\" #{user}"
|
7
|
+
end
|
8
|
+
|
4
9
|
def check_enabled service
|
5
10
|
"chkconfig --list #{escape(service)} | grep 3:on"
|
6
11
|
end
|
@@ -87,7 +87,7 @@ module Serverspec
|
|
87
87
|
# http://docs.oracle.com/cd/E23823_01/html/816-5166/su-1m.html
|
88
88
|
## No need for login shell as it seems that behavior as superuser is favorable for us, but needs
|
89
89
|
## to be better tested under real solaris env
|
90
|
-
"su #{user} test -#{access} #{file}"
|
90
|
+
"su #{user} -c \"/usr/bin/test -#{access} #{file}\""
|
91
91
|
end
|
92
92
|
end
|
93
93
|
end
|
data/lib/serverspec/version.rb
CHANGED
@@ -229,16 +229,16 @@ end
|
|
229
229
|
describe 'check_access_by_user', :os => :debian do
|
230
230
|
context 'read access' do
|
231
231
|
subject {commands.check_access_by_user '/tmp/something', 'dummyuser1', 'r'}
|
232
|
-
it { should eq '
|
232
|
+
it { should eq 'su -s /bin/sh -c "/usr/bin/test -r /tmp/something" dummyuser1' }
|
233
233
|
end
|
234
234
|
|
235
235
|
context 'write access' do
|
236
236
|
subject {commands.check_access_by_user '/tmp/somethingw', 'dummyuser2', 'w'}
|
237
|
-
it { should eq '
|
237
|
+
it { should eq 'su -s /bin/sh -c "/usr/bin/test -w /tmp/somethingw" dummyuser2' }
|
238
238
|
end
|
239
239
|
|
240
240
|
context 'execute access' do
|
241
241
|
subject {commands.check_access_by_user '/tmp/somethingx', 'dummyuser3', 'x'}
|
242
|
-
it { should eq '
|
242
|
+
it { should eq 'su -s /bin/sh -c "/usr/bin/test -x /tmp/somethingx" dummyuser3' }
|
243
243
|
end
|
244
244
|
end
|
@@ -227,16 +227,17 @@ end
|
|
227
227
|
describe 'check_access_by_user', :os => :gentoo do
|
228
228
|
context 'read access' do
|
229
229
|
subject {commands.check_access_by_user '/tmp/something', 'dummyuser1', 'r'}
|
230
|
-
it { should eq '
|
230
|
+
it { should eq 'su -s /bin/sh -c "/usr/bin/test -r /tmp/something" dummyuser1' }
|
231
231
|
end
|
232
232
|
|
233
233
|
context 'write access' do
|
234
234
|
subject {commands.check_access_by_user '/tmp/somethingw', 'dummyuser2', 'w'}
|
235
|
-
it { should eq '
|
235
|
+
it { should eq 'su -s /bin/sh -c "/usr/bin/test -w /tmp/somethingw" dummyuser2' }
|
236
236
|
end
|
237
237
|
|
238
238
|
context 'execute access' do
|
239
239
|
subject {commands.check_access_by_user '/tmp/somethingx', 'dummyuser3', 'x'}
|
240
|
-
it { should eq '
|
240
|
+
it { should eq 'su -s /bin/sh -c "/usr/bin/test -x /tmp/somethingx" dummyuser3' }
|
241
241
|
end
|
242
242
|
end
|
243
|
+
|
@@ -240,17 +240,17 @@ end
|
|
240
240
|
describe 'check_access_by_user', :os => :solaris do
|
241
241
|
context 'read access' do
|
242
242
|
subject {commands.check_access_by_user '/tmp/something', 'dummyuser1', 'r'}
|
243
|
-
it { should eq 'su dummyuser1 test -r /tmp/something' }
|
243
|
+
it { should eq 'su dummyuser1 -c "/usr/bin/test -r /tmp/something"' }
|
244
244
|
end
|
245
245
|
|
246
246
|
context 'write access' do
|
247
247
|
subject {commands.check_access_by_user '/tmp/somethingw', 'dummyuser2', 'w'}
|
248
|
-
it { should eq 'su dummyuser2 test -w /tmp/somethingw' }
|
248
|
+
it { should eq 'su dummyuser2 -c "/usr/bin/test -w /tmp/somethingw"' }
|
249
249
|
end
|
250
250
|
|
251
251
|
context 'execute access' do
|
252
252
|
subject {commands.check_access_by_user '/tmp/somethingx', 'dummyuser3', 'x'}
|
253
|
-
it { should eq 'su dummyuser3 test -x /tmp/somethingx' }
|
253
|
+
it { should eq 'su dummyuser3 -c "/usr/bin/test -x /tmp/somethingx"' }
|
254
254
|
end
|
255
255
|
end
|
256
256
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: serverspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 47
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 28
|
10
|
+
version: 0.2.28
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Gosuke Miyashita
|