Skip to content

Commit 897947b

Browse files
committed
Refactor UID
Signed-off-by: Spencer Owen <spencer.owen@cdw.com>
1 parent 54a3a41 commit 897947b

6 files changed

Lines changed: 41 additions & 41 deletions

controls/1_4_secure_boot_settings.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737
it { should_not be_readable.by 'other' }
3838
it { should_not be_writable.by 'other' }
3939
it { should_not be_executable.by 'other' }
40-
its('gid') { should cmp 0 }
41-
its('uid') { should cmp 0 }
40+
it { should be_grouped_into 'root' }
41+
it { should be_owned_by 'root' }
4242
end
4343
end
4444
end

controls/5_1_configure_cron.rb

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@
7070
it { should_not be_readable.by 'other' }
7171
it { should_not be_writable.by 'other' }
7272
it { should_not be_executable.by 'other' }
73-
its('uid') { should cmp 0 }
74-
its('gid') { should cmp 0 }
73+
it { should be_owned_by 'root' }
74+
it { should be_grouped_into 'root' }
7575
end
7676
end
7777

@@ -102,8 +102,8 @@
102102
it { should_not be_readable.by 'other' }
103103
it { should_not be_writable.by 'other' }
104104
it { should_not be_executable.by 'other' }
105-
its('uid') { should cmp 0 }
106-
its('gid') { should cmp 0 }
105+
it { should be_owned_by 'root' }
106+
it { should be_grouped_into 'root' }
107107
end
108108
end
109109

@@ -134,8 +134,8 @@
134134
it { should_not be_readable.by 'other' }
135135
it { should_not be_writable.by 'other' }
136136
it { should_not be_executable.by 'other' }
137-
its('uid') { should cmp 0 }
138-
its('gid') { should cmp 0 }
137+
it { should be_owned_by 'root' }
138+
it { should be_grouped_into 'root' }
139139
end
140140
end
141141

@@ -166,8 +166,8 @@
166166
it { should_not be_readable.by 'other' }
167167
it { should_not be_writable.by 'other' }
168168
it { should_not be_executable.by 'other' }
169-
its('uid') { should cmp 0 }
170-
its('gid') { should cmp 0 }
169+
it { should be_owned_by 'root' }
170+
it { should be_grouped_into 'root' }
171171
end
172172
end
173173

@@ -198,8 +198,8 @@
198198
it { should_not be_readable.by 'other' }
199199
it { should_not be_writable.by 'other' }
200200
it { should_not be_executable.by 'other' }
201-
its('uid') { should cmp 0 }
202-
its('gid') { should cmp 0 }
201+
it { should be_owned_by 'root' }
202+
it { should be_grouped_into 'root' }
203203
end
204204
end
205205

@@ -231,8 +231,8 @@
231231
it { should_not be_readable.by 'other' }
232232
it { should_not be_writable.by 'other' }
233233
it { should_not be_executable.by 'other' }
234-
its('uid') { should cmp 0 }
235-
its('gid') { should cmp 0 }
234+
it { should be_owned_by 'root' }
235+
it { should be_grouped_into 'root' }
236236
end
237237
end
238238

@@ -272,8 +272,8 @@
272272
it { should_not be_readable.by 'other' }
273273
it { should_not be_writable.by 'other' }
274274
it { should_not be_executable.by 'other' }
275-
its('uid') { should cmp 0 }
276-
its('gid') { should cmp 0 }
275+
it { should be_owned_by 'root' }
276+
it { should be_grouped_into 'root' }
277277
end
278278
end
279279
end

controls/5_2_ssh_server_configuration.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@
4343
it { should_not be_readable.by 'other' }
4444
it { should_not be_writable.by 'other' }
4545
it { should_not be_executable.by 'other' }
46-
its('uid') { should cmp 0 }
47-
its('gid') { should cmp 0 }
46+
it { should be_owned_by 'root' }
47+
it { should be_grouped_into 'root' }
4848
end
4949
end
5050

@@ -69,8 +69,8 @@
6969
it { should_not be_readable.by 'other' }
7070
it { should_not be_writable.by 'other' }
7171
it { should_not be_executable.by 'other' }
72-
its('gid') { should cmp 0 }
73-
its('uid') { should cmp 0 }
72+
it { should be_grouped_into 'root' }
73+
it { should be_owned_by 'root' }
7474
end
7575
end
7676
end
@@ -96,8 +96,8 @@
9696
it { should be_readable.by 'other' }
9797
it { should_not be_writable.by 'other' }
9898
it { should_not be_executable.by 'other' }
99-
its('gid') { should cmp 0 }
100-
its('uid') { should cmp 0 }
99+
it { should be_grouped_into 'root' }
100+
it { should be_owned_by 'root' }
101101
end
102102
end
103103
end

controls/5_4_user_accounts_and_environments.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@
176176
tag level: 1
177177

178178
describe passwd.users('root') do
179-
its('gids') { should cmp 0 }
179+
it { should be_grouped_into 'root' }
180180
end
181181
end
182182

controls/6_1_system_file_permissions.rb

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@
107107
describe file(f) do
108108
it { should exist }
109109
its('mode') { should cmp '0644' }
110-
its('uid') { should cmp 0 }
111-
its('gid') { should cmp 0 }
110+
it { should be_owned_by 'root' }
111+
it { should be_grouped_into 'root' }
112112
its('sticky') { should equal false }
113113
its('suid') { should equal false }
114114
its('sgid') { should equal false }
@@ -138,8 +138,8 @@
138138
describe file(f) do
139139
it { should exist }
140140
it { should_not be_more_permissive_than('0640') }
141-
its('uid') { should cmp 0 }
142-
its('gid') { should cmp expected_gid }
141+
it { should be_owned_by 'root' }
142+
it { should be_grouped_into expected_gid }
143143
end
144144
end
145145
end
@@ -167,8 +167,8 @@
167167
describe file(f) do
168168
it { should exist }
169169
its('mode') { should cmp '0644' }
170-
its('uid') { should cmp 0 }
171-
its('gid') { should cmp 0 }
170+
it { should be_owned_by 'root' }
171+
it { should be_grouped_into 'root' }
172172
end
173173
end
174174
end
@@ -197,8 +197,8 @@
197197
describe file(f) do
198198
it { should exist }
199199
it { should_not be_more_permissive_than('0640') }
200-
its('uid') { should cmp 0 }
201-
its('gid') { should cmp expected_gid }
200+
it { should be_owned_by 'root' }
201+
it { should be_grouped_into expected_gid }
202202
end
203203
end
204204
end
@@ -222,8 +222,8 @@
222222
describe file('/etc/passwd-') do
223223
it { should exist }
224224
it { should_not be_more_permissive_than('0600') }
225-
its('uid') { should cmp 0 }
226-
its('gid') { should cmp 0 }
225+
it { should be_owned_by 'root' }
226+
it { should be_grouped_into 'root' }
227227
end
228228
end
229229

@@ -246,8 +246,8 @@
246246
it { should exist }
247247
it { should_not be_more_permissive_than('0640') }
248248

249-
its('uid') { should cmp 0 }
250-
its('gid') { should cmp expected_gid }
249+
it { should be_owned_by 'root' }
250+
it { should be_grouped_into expected_gid }
251251
end
252252
end
253253

@@ -270,8 +270,8 @@
270270
describe file('/etc/group-') do
271271
it { should exist }
272272
it { should_not be_more_permissive_than('0644') }
273-
its('uid') { should cmp 0 }
274-
its('gid') { should cmp 0 }
273+
it { should be_owned_by 'root' }
274+
it { should be_grouped_into 'root' }
275275
end
276276
end
277277

@@ -295,8 +295,8 @@
295295
describe file('/etc/gshadow-') do
296296
it { should exist }
297297
it { should_not be_more_permissive_than('0640') }
298-
its('uid') { should cmp 0 }
299-
its('gid') { should cmp expected_gid }
298+
it { should be_owned_by 'root' }
299+
it { should be_grouped_into expected_gid }
300300
end
301301
end
302302

controls/6_2_user_and_group_settings.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@
162162
it { should be_directory }
163163
it { should_not be_writable.by 'group' }
164164
it { should_not be_writable.by 'other' }
165-
its('uid') { should cmp 0 }
165+
it { should be_owned_by 'root' }
166166
end
167167
end
168168
end
@@ -384,7 +384,7 @@
384384
describe.one do
385385
group_files.each do |gf|
386386
describe etc_group(gf) do
387-
its(:gids) { should include gid }
387+
it { should be_grouped_into gid }
388388
end
389389
end
390390
end

0 commit comments

Comments
 (0)