8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
|
# File 'manifests/trusty64/services/xinetd.pp', line 8
class cis_benchmark::trusty64::services::xinetd {
## local variables: stig items
$cis_2_1_1 = $::cis_benchmark::cis_2_1_1
$cis_2_1_2 = $::cis_benchmark::cis_2_1_2
$cis_2_1_3 = $::cis_benchmark::cis_2_1_3
$cis_2_1_4 = $::cis_benchmark::cis_2_1_4
$cis_2_1_5 = $::cis_benchmark::cis_2_1_5
$cis_2_1_10 = $::cis_benchmark::cis_2_1_10
## apply rules if xinetd installed
if ($xinetd_installed == 'true') {
## ensure base level configurations
file { '/etc/xinetd.conf':
ensure => present,
mode => '0644',
owner => 'root',
group => 'root',
content => dos2unix(template('cis_benchmark/trusty64/xinetd/xinetd.conf.erb')),
}
## CIS 2.1.1 Ensure chargen services are not enabled (Scored)
if ($cis_2_1_1) {
file { '/etc/xinetd.d/chargen':
ensure => present,
mode => '0644',
owner => 'root',
group => 'root',
content => dos2unix(template('cis_benchmark/trusty64/xinetd/chargen.erb')),
}
}
## CIS 2.1.2 Ensure daytime services are not enabled (Scored)
if ($cis_2_1_2) {
file { '/etc/xinetd.d/daytime':
ensure => present,
mode => '0644',
owner => 'root',
group => 'root',
content => dos2unix(template('cis_benchmark/trusty64/xinetd/daytime.erb')),
}
}
## CIS 2.1.3 Ensure discard services are not enabled (Scored)
if ($cis_2_1_3) {
file { '/etc/xinetd.d/discard':
ensure => present,
mode => '0644',
owner => 'root',
group => 'root',
content => dos2unix(template('cis_benchmark/trusty64/xinetd/discard.erb')),
}
}
## CIS 2.1.4 Ensure echo services are not enabled (Scored)
if ($cis_2_1_4) {
file { '/etc/xinetd.d/echo':
ensure => present,
mode => '0644',
owner => 'root',
group => 'root',
content => dos2unix(template('cis_benchmark/trusty64/xinetd/echo.erb')),
}
}
## CIS 2.1.5 Ensure time services are not enabled (Scored)
if ($cis_2_1_5) {
file { '/etc/xinetd.d/time':
ensure => present,
mode => '0644',
owner => 'root',
group => 'root',
content => dos2unix(template('cis_benchmark/trusty64/xinetd/time.erb')),
}
}
## 2.1.10 Ensure xinetd is not enabled (Scored)
if ($cis_2_1_10) {
service { 'xinetd':
ensure => false,
enable => false,
}
file_line { 'cis_2_1_10':
path => '/etc/init/xinetd.conf',
line => '#start on runlevel [2345]',
match => '^start on runlevel.*',
multiple => true,
}
}
}
## remove lines starting with particular keywords
if ($cis_2_1_1) {
exec {'cis_2_1_1':
command => 'sed -i /^chargen/d /etc/inetd.conf',
onlyif => 'grep ^chargen /etc/inetd.conf',
path => '/bin',
}
exec { 'cis_2_1_1_recurse':
command => 'find /etc/inetd.d -type f -print0 | xargs -0 sed -i /^chargen/d',
path => ['/bin', '/usr/bin'],
onlyif => 'find /etc/inetd.d -type f -print0 | xargs -0 grep ^chargen',
}
}
if ($cis_2_1_2) {
exec {'cis_2_1_2':
command => 'sed -i /^daytime/d /etc/inetd.conf',
onlyif => 'grep ^daytime /etc/inetd.conf',
path => '/bin',
}
exec { 'cis_2_1_2_recurse':
command => 'find /etc/inetd.d -type f -print0 | xargs -0 sed -i /^daytime/d',
path => ['/bin', '/usr/bin'],
onlyif => 'find /etc/inetd.d -type f -print0 | xargs -0 grep ^daytime',
}
}
if ($cis_2_1_3) {
exec {'cis_2_1_3':
command => 'sed -i /^discard/d /etc/inetd.conf',
onlyif => 'grep ^discard /etc/inetd.conf',
path => '/bin',
}
exec { 'cis_2_1_3_recurse':
command => 'find /etc/inetd.d -type f -print0 | xargs -0 sed -i /^discard/d',
path => ['/bin', '/usr/bin'],
onlyif => 'find /etc/inetd.d -type f -print0 | xargs -0 grep ^discard',
}
}
if ($cis_2_1_4) {
exec {'cis_2_1_4':
command => 'sed -i /^echo/d /etc/inetd.conf',
onlyif => 'grep ^echo /etc/inetd.conf',
path => '/bin',
}
exec { 'cis_2_1_4_recurse':
command => 'find /etc/inetd.d -type f -print0 | xargs -0 sed -i /^echo/d',
path => ['/bin', '/usr/bin'],
onlyif => 'find /etc/inetd.d -type f -print0 | xargs -0 grep ^echo',
}
}
if ($cis_2_1_5) {
exec {'cis_2_1_5':
command => 'sed -i /^time/d /etc/inetd.conf',
onlyif => 'grep ^time /etc/inetd.conf',
path => '/bin',
}
exec { 'cis_2_1_5_recurse':
command => 'find /etc/inetd.d -type f -print0 | xargs -0 sed -i /^time/d',
path => ['/bin', '/usr/bin'],
onlyif => 'find /etc/inetd.d -type f -print0 | xargs -0 grep ^time',
}
}
}
|