Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add attribute to control login.defs PASS_WARN_AGE #135

Merged
merged 2 commits into from
Feb 3, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@ suites:
- recipe[os-hardening::default]
verifier:
inspec_tests:
- https://github.com/dev-sec/tests-os-hardening
- https://github.com/dev-sec/linux-baseline
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ We deprecated `sysctl` version before `0.6.0`. Future versions of this cookbook
maximum password age
* `['os-hardening']['auth']['pw_min_age'] = 7`
minimum password age (before allowing any other password change)
* `['os-hardening']['auth']['pw_warn_age'] = 7`
number of days before maximum password age occurs to warn of impending
change
* `['os-hardening']['auth']['retries'] = 5`
the maximum number of authentication attempts, before the account is locked for some time
* `['os-hardening']['auth']['lockout_time'] = 600`
Expand Down
1 change: 1 addition & 0 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
default['os-hardening']['env']['root_path'] = '/'
default['os-hardening']['auth']['pw_max_age'] = 60
default['os-hardening']['auth']['pw_min_age'] = 7 # discourage password cycling
default['os-hardening']['auth']['pw_warn_age'] = 7
default['os-hardening']['auth']['retries'] = 5
default['os-hardening']['auth']['lockout_time'] = 600 # 10min
default['os-hardening']['auth']['timeout'] = 60
Expand Down
1 change: 1 addition & 0 deletions recipes/login_defs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
umask: node['os-hardening']['env']['umask'],
password_max_age: node['os-hardening']['auth']['pw_max_age'],
password_min_age: node['os-hardening']['auth']['pw_min_age'],
password_warn_age: node['os-hardening']['auth']['pw_warn_age'],
login_retries: node['os-hardening']['auth']['retries'],
login_timeout: node['os-hardening']['auth']['timeout'],
chfn_restrict: '', # "rwh"
Expand Down
2 changes: 2 additions & 0 deletions spec/recipes/login_defs_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
umask: '027',
password_max_age: 60,
password_min_age: 7,
password_warn_age: 7,
login_retries: 5,
login_timeout: 60,
chfn_restrict: '',
Expand All @@ -52,6 +53,7 @@

it 'uses uid_min and gid_min in /etc/login.defs' do
expect(chef_run).to render_file('/etc/login.defs').
with_content(/^PASS_WARN_AGE\s+7$/).
with_content(/^UID_MIN\s+5000$/).
with_content(/^GID_MIN\s+5000$/)
end
Expand Down
2 changes: 1 addition & 1 deletion templates/default/login.defs.erb
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ PASS_MAX_DAYS <%= @password_max_age.to_s %>
PASS_MIN_DAYS <%= @password_min_age.to_s %>

# Number of days warning given before a password expires.
PASS_WARN_AGE 7
PASS_WARN_AGE <%= @password_warn_age.to_s %>

# Min/max values for automatic uid selection in useradd
UID_MIN <%= @uid_min.to_s %>
Expand Down