Skip to content

Commit

Permalink
Merge pull request #17 from jordiprats/master
Browse files Browse the repository at this point in the history
improved CIS support
  • Loading branch information
jordiprats authored Jul 14, 2017
2 parents 2b19867 + 862a344 commit 90a3e22
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 15 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# CHANGELOG

## 0.1.14

* improved CIS support by setting an arbitrary option order

## 0.1.13

* changed default settings for **pam::lockout**

## 0.1.12

* allow empty securetty file
Expand Down
38 changes: 32 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,39 @@ PAM modules, /etc/security/limits.conf and /etc/securetty management

## Module Description

If applicable, this section should have a brief description of the technology
the module integrates with and what that integration enables. This section
should answer the questions: "What does this module *do*?" and "Why would I use
it?"
### pam::lockout

If your module has a range of functionality (installation, configuration,
management, etc.) this is the time to mention it.
CIS compliance using pam_faillock for CentOS 6 and 7:

```
# cat /etc/pam.d/password-auth
auth required pam_faillock.so preauth audit silent deny=5 unlock_time=900
auth include password-auth-ac
auth [default=die] pam_faillock.so authfail audit deny=5 unlock_time=900
auth sufficient pam_faillock.so authsucc audit deny=5 unlock_time=900
account required pam_faillock.so
account include password-auth-ac
password include password-auth-ac
session include password-auth-ac
```

```
# cat /etc/pam.d/system-auth
auth required pam_faillock.so preauth audit silent deny=5 unlock_time=900
auth include system-auth-ac
auth [default=die] pam_faillock.so authfail audit deny=5 unlock_time=900
auth sufficient pam_faillock.so authsucc audit deny=5 unlock_time=900
account required pam_faillock.so
account include system-auth-ac
password include system-auth-ac
session include system-auth-ac
```

## Setup

Expand Down
9 changes: 5 additions & 4 deletions manifests/lockout.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@
# pam_tally2
# http://myexperienceswithunix.blogspot.com.es/2016/09/locking-user-accounts-with-pam-faillock.html
#
class pam::lockout(
class pam::lockout (
$manage_package = true,
$package_ensure = 'installed',
$manage_service = true,
$manage_docker_service = true,
$service_ensure = 'running',
$service_enable = true,
$even_deny_root = false,
$unlock_time = '600',
$deny_failed = '3',
$silent = true,
$unlock_time = '900',
$deny_failed = '5',
$silent_preauth = true,
$silent_authfail = false,
$user_whitelist = undef,
) inherits pam::params{

Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eyp-pam",
"version": "0.1.12",
"version": "0.1.14",
"author": "eyp",
"summary": "PAM modules, /etc/security/limits.conf and /etc/securetty management",
"license": "Apache-2.0",
Expand Down
5 changes: 3 additions & 2 deletions templates/lockout/faillock/password.erb
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<% if defined?(@user_whitelist) -%>
auth [success=1 default=ignore] pam_succeed_if.so user in <%= @user_whitelist.join(':') %>
<% end -%>
auth required pam_faillock.so preauth <% if @silent %>silent<% end %> audit deny=<%= @deny_failed %> <% if @even_deny_root %>even_deny_root<% end %> unlock_time=<%= @unlock_time %>
auth required pam_faillock.so preauth audit<% if @silent_preauth %> silent<% end %> deny=<%= @deny_failed %><% if @even_deny_root %> even_deny_root<% end %> unlock_time=<%= @unlock_time %>
auth include password-auth-ac
auth [default=die] pam_faillock.so authfail <% if @silent %>silent<% end %> audit deny=<%= @deny_failed %> <% if @even_deny_root %>even_deny_root<% end %> unlock_time=<%= @unlock_time %>
auth [default=die] pam_faillock.so authfail audit<% if @silent_authfail %> silent<% end %> deny=<%= @deny_failed %><% if @even_deny_root %> even_deny_root<% end %> unlock_time=<%= @unlock_time %>
auth sufficient pam_faillock.so authsucc audit deny=<%= @deny_failed %> unlock_time=<%= @unlock_time %>

account required pam_faillock.so
account include password-auth-ac
Expand Down
5 changes: 3 additions & 2 deletions templates/lockout/faillock/systemauth.erb
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<% if defined?(@user_whitelist) -%>
auth [success=1 default=ignore] pam_succeed_if.so user in <%= @user_whitelist.join(':') %>
<% end -%>
auth required pam_faillock.so preauth <% if @silent %>silent<% end %> audit deny=<%= @deny_failed %> <% if @even_deny_root %>even_deny_root<% end %> unlock_time=<%= @unlock_time %>
auth required pam_faillock.so preauth audit<% if @silent_preauth %> silent<% end %> deny=<%= @deny_failed %><% if @even_deny_root %> even_deny_root<% end %> unlock_time=<%= @unlock_time %>
auth include system-auth-ac
auth [default=die] pam_faillock.so authfail <% if @silent %>silent<% end %> audit deny=<%= @deny_failed %> <% if @even_deny_root %>even_deny_root<% end %> unlock_time=<%= @unlock_time %>
auth [default=die] pam_faillock.so authfail audit deny=<%= @deny_failed %><% if @silent_authfail %> silent<% end %><% if @even_deny_root %> even_deny_root<% end %> unlock_time=<%= @unlock_time %>
auth sufficient pam_faillock.so authsucc audit deny=<%= @deny_failed %> unlock_time=<%= @unlock_time %>

account required pam_faillock.so
account include system-auth-ac
Expand Down

0 comments on commit 90a3e22

Please sign in to comment.