Skip to content

Commit ec10539

Browse files
ekelson-bcovechris-rock
authored andcommitted
added mail_dir attribute and moved component attributes to attributes… (#209)
* added mail_dir attribute and moved component attributes to attributes folder from recipe file * fixed spec test * fixed lint issues
1 parent e497d98 commit ec10539

File tree

5 files changed

+10
-8
lines changed

5 files changed

+10
-8
lines changed

attributes/default.rb

+5
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@
5555
default['os-hardening']['packages']['auditd'] = 'audit'
5656
end
5757

58+
%w[packages limits login_defs minimize_access pam profile securetty].each do |cp|
59+
node.default['os-hardening']['components'][cp] = true
60+
end
61+
5862
# rhel, centos autoconf configuration
5963
default['os-hardening']['authconfig']['shadow']['enable'] = true
6064
default['os-hardening']['authconfig']['md5']['enable'] = true
@@ -71,6 +75,7 @@
7175
default['os-hardening']['auth']['pw_warn_age'] = 7
7276
default['os-hardening']['auth']['retries'] = 5
7377
default['os-hardening']['auth']['lockout_time'] = 600 # 10min
78+
default['os-hardening']['auth']['maildir'] = '/var/mail'
7479
default['os-hardening']['auth']['timeout'] = 60
7580
default['os-hardening']['auth']['allow_homeless'] = false
7681
default['os-hardening']['auth']['pam']['passwdqc']['options'] = 'min=disabled,disabled,16,12,8'

recipes/default.rb

-5
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,6 @@
2727
# override['os-hardening']['components']['sysctl'] = false
2828
#
2929

30-
# generic components, include them per default
31-
%w[packages limits login_defs minimize_access pam profile securetty].each do |cp|
32-
node.default['os-hardening']['components'][cp] = true
33-
end
34-
3530
node.default['os-hardening']['components']['suid_sgid'] = node['os-hardening']['security']['suid_sgid']['enforce']
3631

3732
# components which are not suitable for containers

recipes/login_defs.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
sys_uid_min: node['os-hardening']['auth']['sys_uid_min'],
4040
sys_uid_max: node['os-hardening']['auth']['sys_uid_max'],
4141
sys_gid_min: node['os-hardening']['auth']['sys_gid_min'],
42-
sys_gid_max: node['os-hardening']['auth']['sys_gid_max']
42+
sys_gid_max: node['os-hardening']['auth']['sys_gid_max'],
43+
mail_dir: node['os-hardening']['auth']['maildir']
4344
)
4445
end

spec/recipes/login_defs_spec.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@
4747
sys_uid_min: 100,
4848
sys_uid_max: 999,
4949
sys_gid_min: 100,
50-
sys_gid_max: 999
50+
sys_gid_max: 999,
51+
mail_dir: '/var/mail'
5152
}
5253
)
5354
end

templates/default/login.defs.erb

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#
2424
# See default PAM configuration files provided for login, su, etc.
2525
# This is a temporary situation: setting these variables will soon move to `/etc/default/useradd` and the variables will then be no more supported
26-
MAIL_DIR /var/mail
26+
MAIL_DIR <%= @mail_dir %>
2727
#MAIL_FILE .mail
2828

2929
# Enable logging and display of `/var/log/faillog` login failure info. This option conflicts with the `pam_tally` PAM module.

0 commit comments

Comments
 (0)