forked from openstack/ansible-hardening
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.yml
354 lines (347 loc) · 10.5 KB
/
main.yml
1
2
3
4
5
6
7
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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
---
# Copyright 2016, Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
## Common variables for all distributions
# This file contains variables that apply to all distributions that the
# security role supports. Distribution-specific variables should be placed in:
#
# - vars/redhat.yml
# - vars/ubuntu.yml
## grub custom configuration
grub_custom_file: /etc/grub.d/40_custom
## grub main linux configuration
grub_linux_file: /etc/grub.d/10_linux
## auditd configuration
auditd_config:
- parameter: disk_full_action
value: "{{ security_rhel7_auditd_disk_full_action }}"
config: /etc/audisp/audisp-remote.conf
- parameter: network_failure_action
value: "{{ security_rhel7_auditd_network_failure_action }}"
config: /etc/audisp/audisp-remote.conf
- parameter: space_left
value: "{{ security_rhel7_auditd_space_left }}"
config: /etc/audit/auditd.conf
- parameter: space_left_action
value: "{{ security_rhel7_auditd_space_left_action }}"
config: /etc/audit/auditd.conf
- parameter: action_mail_acct
value: "{{ security_rhel7_auditd_action_mail_acct }}"
config: /etc/audit/auditd.conf
## auditd rules
# This variable is used in tasks/rhel7stig/auditd.yml to deploy auditd rules
# for various commands and syscalls.
#
# Each dictionary has this structure:
#
# command: the command/syscall to audit (required)
# stig_id: the number/ID from the STIG (required)
# arch_specific: 'yes' if the rule depends on the architecture type,
# otherwise 'no' (required)
# path: the path to the command (optional, default is '/usr/bin')
# distro: restrict deployment to a single Linux distribution (optional,
# should be equal to 'ansible_os_family | lower', such as 'redhat'
# or 'ubuntu')
#
audited_commands:
- command: chsh
stig_id: V-72167
arch_specific: no
- command: chage
stig_id: V-72155
arch_specific: no
- command: chcon
stig_id: V-72139
arch_specific: no
- command: chmod
stig_id: V-72105
arch_specific: yes
- command: chown
stig_id: V-72097
arch_specific: yes
- command: creat
stig_id: V-72123
arch_specific: yes
- command: crontab
stig_id: V-72183
arch_specific: no
- command: delete_module
stig_id: V-72189
arch_specific: yes
- command: fchmod
stig_id: V-72107
arch_specific: yes
- command: fchmodat
stig_id: V-72109
arch_specific: yes
- command: fchown
stig_id: V-72099
arch_specific: yes
- command: fchownat
stig_id: V-72103
arch_specific: yes
- command: fremovexattr
stig_id: V-72119
arch_specific: yes
- command: fsetxattr
stig_id: V-72113
arch_specific: yes
- command: ftruncate
stig_id: V-72133
arch_specific: yes
- command: init_module
stig_id: V-72187
arch_specific: yes
- command: gpasswd
stig_id: V-72153
arch_specific: no
- command: lchown
stig_id: V-72101
arch_specific: yes
- command: lremovexattr
stig_id: V-72121
arch_specific: yes
- command: lsetxattr
stig_id: V-72115
arch_specific: yes
- command: mount
path: /bin
stig_id: V-72171
arch_specific: no
- command: newgrp
stig_id: V-72165
arch_specific: no
- command: open
stig_id: V-72125
arch_specific: yes
- command: openat
stig_id: V-72127
arch_specific: yes
- command: open_by_handle_at
stig_id: V-72129
arch_specific: yes
- command: pam_timestamp_check
path: /sbin
stig_id: V-72185
arch_specific: no
- command: passwd
stig_id: V-72149
arch_specific: no
- command: postdrop
path: /usr/sbin
stig_id: V-72175
arch_specific: no
- command: postqueue
path: /usr/sbin
stig_id: V-72177
arch_specific: no
- command: removexattr
stig_id: V-72117
arch_specific: yes
- command: rename
stig_id: V-72199
arch_specific: yes
- command: renameat
stig_id: V-72201
arch_specific: yes
- command: restorecon
path: /usr/sbin
stig_id: V-72141
arch_specific: no
- command: rmdir
stig_id: V-72203
arch_specific: yes
- command: semanage
path: /usr/sbin
stig_id: V-72135
arch_specific: no
- command: setsebool
path: /usr/sbin
stig_id: V-72137
arch_specific: no
- command: setxattr
stig_id: V-72111
arch_specific: yes
- command: ssh-keysign
path: "{{ ssh_keysign_path }}"
stig_id: V-72179
arch_specific: no
- command: su
path: /bin
stig_id: V-72159
arch_specific: no
- command: sudo
stig_id: V-72161
arch_specific: no
- command: sudoedit
path: /bin
stig_id: V-72169
arch_specific: no
- command: truncate
stig_id: V-72131
arch_specific: yes
- command: umount
path: /bin
stig_id: V-72173
arch_specific: no
- command: unix_chkpwd
path: /sbin
stig_id: V-72151
arch_specific: no
- command: unlink
stig_id: V-72205
arch_specific: yes
- command: unlinkat
stig_id: V-72207
arch_specific: yes
- command: userhelper
path: /usr/sbin
stig_id: V-72157
arch_specific: no
## Password quality settings
# This variable is used in main/rhel7stig/auth.yml to set password quality
# requirements.
#
# Each dictionary has this structure:
#
# parameter: the pwquality parameter to set
# value: the value of the parameter
# stig_id: the STIG id number
# description: description of the control from the STIG
# enabled: whether the change should be applied
#
password_quality_rhel7:
- parameter: ucredit
value: -1
stig_id: V-71903
description: "Password must contain at least one upper-case character"
enabled: "{{ security_pwquality_require_uppercase }}"
- parameter: lcredit
value: -1
stig_id: V-71905
description: "Password must contain at least one lower-case character"
enabled: "{{ security_pwquality_require_lowercase }}"
- parameter: dcredit
value: -1
stig_id: V-71907
description: "Password must contain at least one numeric character"
enabled: "{{ security_pwquality_require_numeric }}"
- parameter: ocredit
value: -1
stig_id: V-71909
description: "Password must contain at least one special character"
enabled: "{{ security_pwquality_require_special }}"
- parameter: difok
value: 8
stig_id: V-71911
description: "Password must have at least eight characters changed"
enabled: "{{ security_pwquality_require_characters_changed }}"
- parameter: minclass
value: 4
stig_id: V-71913
description: "Password must have at least four character classes changed"
enabled: "{{ security_pwquality_require_character_classes_changed }}"
- parameter: maxrepeat
value: 3
stig_id: V-71915
description: "Password must have at most three characters repeated consecutively"
enabled: "{{ security_pwquality_limit_repeated_characters }}"
- parameter: maxclassrepeat
value: 4
stig_id: V-71917
description: "Password must have at most four characters in the same character class repeated consecutively"
enabled: "{{ security_pwquality_limit_repeated_character_classes }}"
- parameter: minlen
value: 15
stig_id: V-71935
description: "Passwords must be a minimum of 15 characters in length"
enabled: "{{ security_pwquality_require_minimum_password_length }}"
## shadow-utils settings
# This variable is used in main/rhel7stig/auth.yml to set shadow file-related
# configurations in /etc/login.defs.
#
# Each dictionary has this structure:
#
# parameter: the parameter to set
# value: the value for the parameter
# stig_id: the STIG ID number for the requirement
#
shadow_utils_rhel7:
- parameter: ENCRYPT_METHOD
value: "{{ security_password_encrypt_method | default('') }}"
stig_id: V-71921
ansible_os_family: all
- parameter: PASS_MIN_DAYS
value: "{{ security_password_min_lifetime_days | default('') }}"
stig_id: V-71925
ansible_os_family: all
- parameter: PASS_MAX_DAYS
value: "{{ security_password_max_lifetime_days | default('') }}"
stig_id: V-71929
ansible_os_family: all
- parameter: FAIL_DELAY
value: "{{ security_shadow_utils_fail_delay | default('') }}"
stig_id: V-71951
ansible_os_family: RedHat
- parameter: UMASK
value: "{{ security_shadow_utils_umask | default('') }}"
stig_id: V-71995
ansible_os_family: all
- parameter: CREATE_HOME
value: "{{ security_shadow_utils_create_home | default('') }}"
stig_id: V-72013
ansible_os_family: all
## sysctl settings
# This variable is used in main/rhel7stig/kernel.yml to set sysctl
# configurations on hosts.
#
# Each dictionary has this structure:
#
# name: the sysctl configuration name
# value: the value to set for the sysctl configuration
# enabled: yes or no
# - 'yes' (ensure the variable is set)
# - 'no' (the role will not alter the configuration)
#
sysctl_settings_rhel7:
- name: net.ipv4.conf.all.accept_source_route
value: 0
enabled: "{{ security_disallow_source_routed_packet_forward_ipv4 | bool }}"
- name: net.ipv4.conf.default.accept_source_route
value: 0
enabled: "{{ security_disallow_source_routed_packet_forward_ipv4 | bool}}"
- name: net.ipv4.icmp_echo_ignore_broadcasts
value: 1
enabled: "{{ security_disallow_echoes_broadcast_address | bool }}"
- name: net.ipv4.conf.all.send_redirects
value: 0
enabled: "{{ security_disallow_icmp_redirects | bool }}"
- name: net.ipv4.conf.default.send_redirects
value: 0
enabled: "{{ security_disallow_icmp_redirects | bool }}"
- name: net.ipv4.ip_forward
value: 0
enabled: "{{ security_disallow_ip_forwarding | bool }}"
- name: net.ipv6.conf.all.accept_source_route
value: 0
enabled: "{{ security_disallow_source_routed_packet_forward_ipv6 | bool }}"
- name: net.ipv4.conf.default.accept_redirects
value: 0
enabled: "{{ security_disallow_icmp_redirects | bool }}"
- name: kernel.randomize_va_space
value: 2
enabled: "{{ security_enable_aslr | bool }}"
- name: net.ipv6.conf.all.disable_ipv6
value: 1
enabled: "{{ (security_contrib_enabled | bool) and (security_contrib_disable_ipv6 | bool) }}"