Skip to content

Commit 0213b91

Browse files
author
Patrick Meier
committed
some more rubocop fixing
Signed-off-by: Patrick Meier <patrick.meier111@googlemail.com>
1 parent 941d4b5 commit 0213b91

3 files changed

Lines changed: 148 additions & 81 deletions

File tree

lockdown/inspec/os_spec.rb

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# encoding: utf-8
22
#
3-
# Copyright 2015, Patrick Münch
3+
# Copyright 2015, Patrick Muench
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.
@@ -16,11 +16,11 @@
1616
#
1717
# author: Christoph Hartmann
1818
# author: Dominik Richter
19-
# author: Patrick Münch
19+
# author: Patrick Muench
2020

2121
control '01' do
2222
impact 1.0
23-
title "Trusted hosts login"
23+
title 'Trusted hosts login'
2424
desc "Rhosts/hosts.equiv files are a weak implemenation of authentication. Disabling the .rhosts and hosts.equiv support helps to prevent users from subverting the system's normal access control mechanisms of the system."
2525
describe command('find / -name \'.rhosts\'') do
2626
its('stdout') { should be_empty }
@@ -32,8 +32,8 @@
3232

3333
control '02' do
3434
impact 1.0
35-
title "Check owner and permissions for /etc/shadow "
36-
desc "Check periodically the owner and permissions for /etc/shadow"
35+
title 'Check owner and permissions for /etc/shadow'
36+
desc 'Check periodically the owner and permissions for /etc/shadow'
3737
describe file('/etc/shadow') do
3838
it { should exist }
3939
it { should be_file }
@@ -49,8 +49,8 @@
4949

5050
control '03' do
5151
impact 1.0
52-
title "Check owner and permissions for /etc/passwd "
53-
desc "Check periodically the owner and permissions for /etc/passwd"
52+
title 'Check owner and permissions for /etc/passwd'
53+
desc 'Check periodically the owner and permissions for /etc/passwd'
5454
describe file('/etc/passwd') do
5555
it { should exist }
5656
it { should be_file }
@@ -68,8 +68,8 @@
6868

6969
control '04' do
7070
impact 1.0
71-
title "Dot in PATH variable"
72-
desc "Do not include the current working directory in PATH variable. This makes it easier for an attacker to gain extensive rigths by executing a Trojan program"
71+
title 'Dot in PATH variable'
72+
desc 'Do not include the current working directory in PATH variable. This makes it easier for an attacker to gain extensive rigths by executing a Trojan program'
7373
describe os_env('PATH') do
7474
its('split') { should_not include('') }
7575
its('split') { should_not include('.') }
@@ -78,8 +78,8 @@
7878

7979
control '05' do
8080
impact 1.0
81-
title "Check login.defs"
82-
desc "Check owner and permissions for login.defs. Also check the configured PATH variable and umask in login.defs"
81+
title 'Check login.defs'
82+
desc 'Check owner and permissions for login.defs. Also check the configured PATH variable and umask in login.defs'
8383
describe file('/etc/login.defs') do
8484
it { should exist }
8585
it { should be_file }
@@ -112,8 +112,8 @@
112112

113113
control '06' do
114114
impact 1.0
115-
title "Check for SUID/ SGID blacklist "
116-
desc "Find blacklisted SUID and SGID files to ensure that no rogue SUID and SGID files have been introduced into the system"
115+
title 'Check for SUID/ SGID blacklist'
116+
desc 'Find blacklisted SUID and SGID files to ensure that no rogue SUID and SGID files have been introduced into the system'
117117

118118
blacklist = [
119119
# blacklist as provided by NSA
@@ -141,20 +141,20 @@
141141
'/usr/lib/evolution/camel-lock-helper-1.2', # investigate current state...
142142
'/usr/lib/pt_chown', # pseudo-tty, needed?
143143
'/usr/lib/eject/dmcrypt-get-device',
144-
'/usr/lib/mc/cons.saver' # midnight commander screensaver
144+
'/usr/lib/mc/cons.saver' # midnight commander screensaver
145145
]
146146

147147
output = command('find / -perm -4000 -o -perm -2000 -type f ! -path \'/proc/*\' -print 2>/dev/null | grep -v \'^find:\'')
148148
diff = output.stdout.split(/\r?\n/) & blacklist
149149
describe diff do
150-
it {should be_empty}
150+
it { should be_empty }
151151
end
152152
end
153153

154154
control '07' do
155155
impact 1.0
156-
title "Unique uid and gid"
157-
desc "Check for unique uids gids"
156+
title 'Unique uid and gid'
157+
desc 'Check for unique uids gids'
158158
describe passwd do
159159
its('uids') { should_not contain_duplicates }
160160
end

lockdown/inspec/package_spec.rb

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# encoding: utf-8
2+
#
3+
# Copyright 2015, Patrick Muench
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+
# author: Christoph Hartmann
18+
# author: Dominik Richter
19+
# author: Patrick Muench
20+
21+
control '01' do
22+
impact 1.0
23+
title 'Do not run deprecated inetd or xinetd'
24+
desc 'http://www.nsa.gov/ia/_files/os/redhat/rhel5-guide-i731.pdf, Chapter 3.2.1'
25+
describe package('inetd') do
26+
it { should_not be_installed }
27+
end
28+
describe package('xinetd') do
29+
it { should_not be_installed }
30+
end
31+
end
32+
33+
control '02' do
34+
impact 1.0
35+
title 'Do not install Telnet server'
36+
desc 'Telnet protocol uses unencrypted communication, that means the passowrd and other sensitive data are unencrypted. http://www.nsa.gov/ia/_files/os/redhat/rhel5-guide-i731.pdf, Chapter 3.2.2'
37+
describe package('telnetd') do
38+
it { should_not be_installed }
39+
end
40+
end
41+
42+
control '03' do
43+
impact 1.0
44+
title 'Do not install rsh server'
45+
desc 'The r-commands suffers same problem as telnet. http://www.nsa.gov/ia/_files/os/redhat/rhel5-guide-i731.pdf, Chapter 3.2.3'
46+
describe package('telnetd') do
47+
it { should_not be_installed }
48+
end
49+
end
50+
51+
control '05' do
52+
impact 1.0
53+
title 'Do not install ypserv server (NIS)'
54+
desc 'Network Information Service (NIS) has some security design weaknesses like inadequate protection of important authentication information. http://www.nsa.gov/ia/_files/os/redhat/rhel5-guide-i731.pdf, Chapter 3.2.4'
55+
describe package('ypserv') do
56+
it { should_not be_installed }
57+
end
58+
end
59+
60+
control '06' do
61+
impact 1.0
62+
title 'Do not install tftp server'
63+
desc 'tftp-server provides little security http://www.nsa.gov/ia/_files/os/redhat/rhel5-guide-i731.pdf, Chapter 3.2.5'
64+
describe package('tftp-server') do
65+
it { should_not be_installed }
66+
end
67+
end

0 commit comments

Comments
 (0)