Skip to content

Commit

Permalink
Merge pull request #11676 from teacup-on-rockingchair/accounts_passwo…
Browse files Browse the repository at this point in the history
…rds_pam_tally2_simpler_regex

accounts_passwords_pam_tally2_deny_root fix
  • Loading branch information
jan-cerny committed Mar 18, 2024
2 parents d8ea9e8 + a489a0e commit b84d30a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
# strategy = restrict
# complexity = low
# disruption = low
{{{ ansible_instantiate_variables("var_password_pam_tally2") }}}

{{{ ansible_remove_pam_module_option('/etc/pam.d/login', 'auth', 'required', 'pam_tally2.so', 'onerr=fail') }}}
{{{ ansible_ensure_pam_module_option('/etc/pam.d/login', 'auth', 'required', 'pam_tally2.so', 'deny', "{{ var_password_pam_tally2 }}", '') }}}
{{{ ansible_ensure_pam_module_option('/etc/pam.d/login', 'auth', 'required', 'pam_tally2.so', 'even_deny_root', '', '') }}}
{{{ ansible_ensure_pam_module_option('/etc/pam.d/common-account', 'account', 'required', 'pam_tally2.so', '', '', '') }}}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
# strategy = restrict
# complexity = low
# disruption = low
{{{ bash_instantiate_variables("var_password_pam_tally2") }}}

{{{ bash_remove_pam_module_option('/etc/pam.d/login', 'auth', 'required', 'pam_tally2.so', 'onerr=fail') }}}
{{{ bash_ensure_pam_module_option('/etc/pam.d/login', 'auth', 'required', 'pam_tally2.so', 'deny', "${var_password_pam_tally2}", '') }}}
{{{ bash_ensure_pam_module_option('/etc/pam.d/login', 'auth', 'required', 'pam_tally2.so', 'even_deny_root', '', '') }}}
{{{ bash_ensure_pam_module_option('/etc/pam.d/common-account', 'account', 'required', 'pam_tally2.so', '', '', '') }}}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
<criteria operator="AND" comment="Checks common to both scenarios">
<criterion test_ref="test_accounts_passwords_pam_tally2_even_deny_root"
comment="Verify deny root configuation of pam_tally2 in common-auth" />
<criterion test_ref="test_accounts_passwords_pam_tally2_deny_number"
comment="Verify deny number configuation of pam_tally2 in common-auth" />
<criterion test_ref="test_accounts_passwords_pam_tally2_even_deny_root_account"
comment="Verify deny configuation of pam_tally2 in common-account" />
</criteria>
Expand All @@ -18,8 +20,20 @@

<ind:textfilecontent54_object id="object_accounts_passwords_pam_tally2_even_deny_root" comment="Check even deny root configuration of pam_tally2" version="1">
<ind:filepath>/etc/pam.d/login</ind:filepath>
<ind:pattern operation="pattern match">^\s*auth(?:(?!\n)\s)+required(?:(?!\n)\s)+pam_tally2.so(?:(?!\n)\s)+(?:(?:(?:(?!\n)\s)?[^\n]+)?onerr=fail(?:(?:(?!\n)\s)+[^\n]+)?(?:(?!\n)\s)+deny=(\d+)(?:(?:\s+\S+)*\s*$))|(?:(?:(?:(?!\n)\s)?[^\n]+)?deny=(\d+)(?:(?:(?!\n)\s)+[^\n]+)?(?:(?!\n)\s)+even_deny_root(?:(?:\s+\S+)*\s*$))</ind:pattern>
<ind:instance datatype="int">1</ind:instance>
<ind:pattern operation="pattern match">^\s*auth(?:(?!\n)\s)+required(?:(?!\n)\s)+pam_tally2.so(?:(?!\n)\s)+(?:(?:(?:(?!\n)\s)?[^\n]+)?even_deny_root(?:(?:\s+\S+)*\s*$))</ind:pattern>
<ind:instance datatype="int">1</ind:instance>
</ind:textfilecontent54_object>

<ind:textfilecontent54_test id="test_accounts_passwords_pam_tally2_deny_number"
check="all" check_existence="all_exist"
comment="Verify deny number configuation of pam_tally2" version="1">
<ind:object object_ref="object_accounts_passwords_pam_tally2_deny_number" />
</ind:textfilecontent54_test>

<ind:textfilecontent54_object id="object_accounts_passwords_pam_tally2_deny_number" comment="Check deny number configuration of pam_tally2" version="1">
<ind:filepath>/etc/pam.d/login</ind:filepath>
<ind:pattern operation="pattern match">^\s*auth(?:(?!\n)\s)+required(?:(?!\n)\s)+pam_tally2.so(?:(?!\n)\s)+(?:(?:(?:(?!\n)\s)?[^\n]+)?deny=(\d+)(?:(?:\s+\S+)*\s*$))</ind:pattern>
<ind:instance datatype="int">1</ind:instance>
</ind:textfilecontent54_object>

<ind:textfilecontent54_test id="test_accounts_passwords_pam_tally2_even_deny_root_account"
Expand Down

0 comments on commit b84d30a

Please sign in to comment.