Skip to content

Commit dd9706c

Browse files
committed
migrate to inspec profile
1 parent a43c6bf commit dd9706c

File tree

8 files changed

+69
-288
lines changed

8 files changed

+69
-288
lines changed

.travis.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
sudo: false
2+
language: ruby
23
cache: bundler
34

45
rvm:
56
- 1.9.3
67
- 2.0.0
78
- 2.2.0
8-
language: ruby
9+
10+
bundler_args: --without integration
11+
script: bundle exec rake

README.md

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,44 @@
11
tests-os-hardening
22
==================
33

4-
This are the integration tests for the projects
4+
This Compliance Profile ensures, that all hardening projects keep the same quality.
55

66
- https://github.com/hardening-io/puppet-os-hardening
77
- https://github.com/hardening-io/chef-os-hardening
88
- https://github.com/hardening-io/ansible-os-hardening
9-
10-
They start at `integration` level.
11-
12-
you can use the gem `kitchen-sharedtests`
13-
14-
- https://github.com/ehaselwanter/kitchen-sharedtests/
15-
16-
to make them available to your project. Use `thor kitchen:fetch-remote-tests` to put the repo into `test/integration`.
179

1810
## Standalone Usage
1911

20-
You can target the integration tests to any host where you have ssh access.
21-
22-
`rake -T` gives you a list of suites you can run (we'll ignore directories which are obviously not suites for now)
12+
This Compliance Profile requires [InSpec](https://github.com/chef/inspec) for execution:
2313

2414
```
25-
± rake -T
26-
rake serverspec:data_bags # Run serverspec suite data_bags
27-
rake serverspec:default # Run serverspec suite default
15+
$ git clone https://github.com/hardening-io/tests-os-hardening
16+
$ inspec exec tests-os-hardening
2817
```
2918

30-
Run it with:
19+
You can also execute the profile directly from Github:
3120

3221
```
33-
bundle install
22+
$ inspec exec https://github.com/hardening-io/tests-os-hardening
23+
```
3424

35-
# default user and ssh-key
25+
## License and Author
3626

37-
bundle exec rake serverspec:default target_host=<name-or-ip-of-target-server>
27+
* Author:: Patrick Muench <patrick.meier111@googlemail.com>
28+
* Author:: Dominik Richter <dominik.richter@googlemail.com>
29+
* Author:: Christoph Hartmann <chris@lollyrock.com>
30+
* Author:: Edmund Haselwanter <me@ehaselwanter.com>
3831

39-
# or with user, host, password
32+
* Copyright 2014-2016, The Hardening Framework Team
4033

41-
ASK_LOGIN_PASSWORD=true bundle exec rake serverspec:default target_host=192.168.1.222 user=stack
42-
```
34+
Licensed under the Apache License, Version 2.0 (the "License");
35+
you may not use this file except in compliance with the License.
36+
You may obtain a copy of the License at
4337

44-
Add `format=html|json` to get a report.html or report.json document.
38+
http://www.apache.org/licenses/LICENSE-2.0
4539

40+
Unless required by applicable law or agreed to in writing, software
41+
distributed under the License is distributed on an "AS IS" BASIS,
42+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
43+
See the License for the specific language governing permissions and
44+
limitations under the License.
Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# author: Dominik Richter
1919
# author: Patrick Muench
2020

21-
control '01' do
21+
control 'sysctl-01' do
2222
impact 1.0
2323
title 'IPv4 Forwarding'
2424
desc "If you're not intending for your system to forward traffic between interfaces, or if you only have a single interface, the forwarding function must be disable."
@@ -30,7 +30,7 @@
3030
end
3131
end
3232

33-
control '02' do
33+
control 'sysctl-02' do
3434
impact 1.0
3535
title 'Reverse path filtering'
3636
desc "The rp_filter can reject incoming packets if their source address doesn't match the network interface that they're arriving on, which helps to prevent IP spoofing."
@@ -42,7 +42,7 @@
4242
end
4343
end
4444

45-
control '03' do
45+
control 'sysctl-03' do
4646
impact 1.0
4747
title 'ICMP ignore bogus error responses'
4848
desc 'Sometimes routers send out invalid responses to broadcast frames. This is a violation of RFC 1122 and the kernel will logged this. To avoid filling up your logfile with unnecessary stuff, you can tell the kernel not to issue these warnings'
@@ -51,7 +51,7 @@
5151
end
5252
end
5353

54-
control '04' do
54+
control 'sysctl-04' do
5555
impact 1.0
5656
title 'ICMP echo ignore broadcasts'
5757
desc 'Blocking ICMP ECHO requests to broadcast addresses'
@@ -60,7 +60,7 @@
6060
end
6161
end
6262

63-
control '05' do
63+
control 'sysctl-05' do
6464
impact 1.0
6565
title 'ICMP ratelimit'
6666
desc 'icmp_ratelimit defines how many packets that match the icmp_ratemask per second'
@@ -69,7 +69,7 @@
6969
end
7070
end
7171

72-
control '06' do
72+
control 'sysctl-06' do
7373
impact 1.0
7474
title 'ICMP ratemask'
7575
desc 'Ratemask is a logical OR of all ICMP codes to rate limit'
@@ -78,7 +78,7 @@
7878
end
7979
end
8080

81-
control '07' do
81+
control 'sysctl-07' do
8282
impact 1.0
8383
title 'TCP timestamps'
8484
desc "It is possible to estimate the current uptime of a Linux system. It's preferable to disable TCP timestamps on your systems."
@@ -87,7 +87,7 @@
8787
end
8888
end
8989

90-
control '08' do
90+
control 'sysctl-08' do
9191
impact 1.0
9292
title 'ARP ignore'
9393
desc 'Reply only if the target IP address is local address configured on the incoming interface.'
@@ -96,7 +96,7 @@
9696
end
9797
end
9898

99-
control '09' do
99+
control 'sysctl-09' do
100100
impact 1.0
101101
title 'ARP announce'
102102
desc 'Always use the best local address for this target. In this mode we ignore the source address in the IP packet and try to select local address that we prefer for talks with the target host.'
@@ -105,7 +105,7 @@
105105
end
106106
end
107107

108-
control '10' do
108+
control 'sysctl-10' do
109109
impact 1.0
110110
title 'TCP RFC1337 Protect Against TCP Time-Wait'
111111
desc 'This enables a fix for time-wait assassination hazards in tcp, described in RFC 1337. If enabled, this causes the kernel to drop RST packets for sockets in the time-wait state.'
@@ -114,7 +114,7 @@
114114
end
115115
end
116116

117-
control '11' do
117+
control 'sysctl-11' do
118118
impact 1.0
119119
title 'Protection against SYN flood attacks'
120120
desc 'A SYN-Attack is a denial of service (DoS) attack that consumes resources on your system forcing you to reboot.'
@@ -123,7 +123,7 @@
123123
end
124124
end
125125

126-
control '12' do
126+
control 'sysctl-12' do
127127
impact 1.0
128128
title 'Shared Media IP Architecture'
129129
desc 'Send(router) or accept(host) RFC1620 shared media redirects. If it is not set the kernel does not assume that different subnets on this device can communicate directly.'
@@ -135,7 +135,7 @@
135135
end
136136
end
137137

138-
control '13' do
138+
control 'sysctl-13' do
139139
impact 1.0
140140
title 'Disable Source Routing'
141141
desc 'The accept_source_route option causes network interfaces to accept packets with the Strict Source Route (SSR) or Loose Source Routing (LSR) option set. An attacker is able to send a source routed packet into the network, then he could intercept the replies and your server might not know that it is not communicating with a trusted server'
@@ -147,7 +147,7 @@
147147
end
148148
end
149149

150-
control '14' do
150+
control 'sysctl-14' do
151151
impact 1.0
152152
title 'Disable acceptance of all IPv4 redirected packets'
153153
desc 'Disable acceptance of all redirected packets these prevents Man-in-the-Middle attacks.'
@@ -159,7 +159,7 @@
159159
end
160160
end
161161

162-
control '15' do
162+
control 'sysctl-15' do
163163
impact 1.0
164164
title 'Disable acceptance of all secure redirected packets'
165165
desc 'Disable acceptance of all secure redirected packets these prevents Man-in-the-Middle attacks.'
@@ -171,7 +171,7 @@
171171
end
172172
end
173173

174-
control '16' do
174+
control 'sysctl-16' do
175175
impact 1.0
176176
title 'Disable sending of redirects packets'
177177
desc 'Disable sending of redirects packets'
@@ -183,7 +183,7 @@
183183
end
184184
end
185185

186-
control '17' do
186+
control 'sysctl-17' do
187187
impact 1.0
188188
title 'Disable log martians'
189189
desc 'log_martians can cause a denial of service attack to the host'
@@ -192,7 +192,7 @@
192192
end
193193
end
194194

195-
control '18' do
195+
control 'sysctl-18' do
196196
impact 1.0
197197
title 'Disable IPv6 if it is not needed'
198198
desc 'Disable IPv6 if it is not needed'
@@ -201,7 +201,7 @@
201201
end
202202
end
203203

204-
control '19' do
204+
control 'sysctl-19' do
205205
impact 1.0
206206
title 'IPv6 Forwarding'
207207
desc "If you're not intending for your system to forward traffic between interfaces, or if you only have a single interface, the forwarding function must be disable."
@@ -210,7 +210,7 @@
210210
end
211211
end
212212

213-
control '20' do
213+
control 'sysctl-20' do
214214
impact 1.0
215215
title 'Disable acceptance of all IPv6 redirected packets'
216216
desc 'Disable acceptance of all redirected packets these prevents Man-in-the-Middle attacks.'
@@ -222,7 +222,7 @@
222222
end
223223
end
224224

225-
control '21' do
225+
control 'sysctl-21' do
226226
impact 1.0
227227
title 'Disable acceptance of IPv6 router solicitations messages'
228228
desc 'The router solicitations setting determines how many router solicitations are sent when bringing up the interface. If addresses are statically assigned, there is no need to send any solicitations.'
@@ -231,7 +231,7 @@
231231
end
232232
end
233233

234-
control '22' do
234+
control 'sysctl-22' do
235235
impact 1.0
236236
title 'Disable Accept Router Preference from router advertisement'
237237
desc 'Disable Accept Router Preference from router advertisement'
@@ -240,7 +240,7 @@
240240
end
241241
end
242242

243-
control '23' do
243+
control 'sysctl-23' do
244244
impact 1.0
245245
title 'Disable learning Prefix Information from router advertisement'
246246
desc 'The accept_ra_pinfo setting controls whether the system will accept prefix info from the router.'
@@ -249,7 +249,7 @@
249249
end
250250
end
251251

252-
control '24' do
252+
control 'sysctl-24' do
253253
impact 1.0
254254
title 'Disable learning Hop limit from router advertisement'
255255
desc 'The accept_ra_defrtr setting controls whether the system will accept Hop Limit settings from a router advertisement. Setting it to 0 prevents a router from changing your default IPv6 Hop Limit for outgoing packets.'
@@ -258,7 +258,7 @@
258258
end
259259
end
260260

261-
control '25' do
261+
control 'sysctl-25' do
262262
impact 1.0
263263
title 'Disable the system`s acceptance of router advertisement'
264264
desc 'Setting controls whether the system will accept router advertisement'
@@ -270,7 +270,7 @@
270270
end
271271
end
272272

273-
control '26' do
273+
control 'sysctl-26' do
274274
impact 1.0
275275
title 'Disable IPv6 autoconfiguration'
276276
desc 'The autoconf setting controls whether router advertisements can cause the system to assign a global unicast address to an interface.'
@@ -279,7 +279,7 @@
279279
end
280280
end
281281

282-
control '27' do
282+
control 'sysctl-27' do
283283
impact 1.0
284284
title 'Disable neighbor solicitations to send out per address'
285285
desc 'The dad_transmits setting determines how many neighbor solicitations to send out per address (global and link-local) when bringing up an interface to ensure the desired address is unique on the network.'
@@ -288,7 +288,7 @@
288288
end
289289
end
290290

291-
control '28' do
291+
control 'sysctl-28' do
292292
impact 1.0
293293
title 'Assign one global unicast IPv6 addresses to each interface'
294294
desc 'The max_addresses setting determines how many global unicast IPv6 addresses can be assigned to each interface. The default is 16, but it should be set to exactly the number of statically configured global addresses required.'
@@ -297,7 +297,7 @@
297297
end
298298
end
299299

300-
control '29' do
300+
control 'sysctl-29' do
301301
impact 1.0
302302
title 'Disable loading kernel modules'
303303
desc 'The sysctl key kernel.modules_disabled is very straightforward. If it contains a "1" it will disable loading new modules, where a "0" will still allow loading them. Using this option will be a great protection against loading malicious kernel modules.'
@@ -306,7 +306,7 @@
306306
end
307307
end
308308

309-
control '30' do
309+
control 'sysctl-30' do
310310
impact 1.0
311311
title 'Magic SysRq'
312312
desc "Kernel.sysreg is a 'magical' key combo you can hit which the kernel will respond to regardless of whatever else it is doing, unless it is completely locked up."
@@ -315,7 +315,7 @@
315315
end
316316
end
317317

318-
control '31' do
318+
control 'sysctl-31' do
319319
impact 1.0
320320
title 'Disable Core Dumps'
321321
desc 'Ensure that core dumps can never be made by setuid programs'
@@ -324,7 +324,7 @@
324324
end
325325
end
326326

327-
control '32' do
327+
control 'sysctl-32' do
328328
impact 1.0
329329
title 'kernel.randomize_va_space'
330330
desc 'kernel.randomize_va_space'
@@ -333,7 +333,7 @@
333333
end
334334
end
335335

336-
control '33' do
336+
control 'sysctl-33' do
337337
impact 1.0
338338
title 'CPU No execution Flag or Kernel ExecShield'
339339
desc 'Kernel features and CPU flags provide a protection against buffer overflows. The CPU NX Flag and the kernel parameter exec-shield prevents code execution on a per memory page basis. If the CPU supports the NX-Flag then this should be used instead of the kernel parameter exec-shield.'

0 commit comments

Comments
 (0)