Skip to content

Commit

Permalink
Merge pull request ComplianceAsCode#11560 from jan-cerny/anssi_R31
Browse files Browse the repository at this point in the history
ANSSI R31 updates
  • Loading branch information
Mab879 authored Feb 8, 2024
2 parents 85d5c88 + 48f4353 commit 8734eed
Show file tree
Hide file tree
Showing 10 changed files with 109 additions and 12 deletions.
1 change: 1 addition & 0 deletions components/pam.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ rules:
- accounts_password_pam_unix_rounds_password_auth
- accounts_password_pam_unix_rounds_system_auth
- accounts_password_set_max_life_existing
- accounts_password_set_max_life_root
- accounts_password_set_min_life_existing
- accounts_password_set_warn_age_existing
- accounts_password_warn_age_login_defs
Expand Down
19 changes: 10 additions & 9 deletions controls/anssi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -717,26 +717,27 @@ controls:
levels:
- minimal
notes: >-
The rules selected below establish a general password strength baseline of 100 bits,
inspired by DAT-NT-001 and the "Password Strenght Calculator"
(https://www.ssi.gouv.fr/administration/precautions-elementaires/calculer-la-force-dun-mot-de-passe/).
The rules selected below establish a general password strength baseline
of 100 bits, based on the recommendations of the technical note
"Recommandations relatives à l'authentification multifacteur et aux mots de passe"
(https://cyber.gouv.fr/publications/recommandations-relatives-lauthentification-multifacteur-et-aux-mots-de-passe)
The baseline should be reviewed and tailored to the system's use case and needs.
status: automated
rules:
# enable authselect to support following rules
- enable_authselect

# Renew passwords every 90 days
- var_accounts_maximum_age_login_defs=90
- accounts_maximum_age_login_defs
# Set the maximum password age for the root account to 1 year
- var_accounts_maximum_age_root=365
- accounts_password_set_max_life_root

# Ensure passwords with minimum of 18 characters
- var_password_pam_minlen=18
# Ensure passwords with minimum of 15 characters
- var_password_pam_minlen=15
- accounts_password_pam_minlen
- cracklib_accounts_password_pam_minlen
# Enforce password lenght for new accounts
- var_accounts_password_minlen_login_defs=18
- var_accounts_password_minlen_login_defs=15
- accounts_password_minlen_login_defs
# Require at Least 1 Special Character in Password
- var_password_pam_ocredit=1
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# platform = multi_platform_rhel
# reboot = false
# strategy = restrict
# complexity = low
# disruption = low

{{{ ansible_instantiate_variables("var_accounts_maximum_age_root") }}}
- name: Change the maximum time period between password changes
{{% if product in ["rhel7", "ol7"] %}}
ansible.builtin.command:
cmd: chage -M {{ var_accounts_maximum_age_root }} root
{{% else %}}
ansible.builtin.user:
user: root
password_expire_max: '{{ var_accounts_maximum_age_root }}'
{{% endif %}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# platform = multi_platform_rhel
# reboot = false
# strategy = restrict
# complexity = low
# disruption = low

{{{ bash_instantiate_variables("var_accounts_maximum_age_root") }}}
chage -M $var_accounts_maximum_age_root root
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<def-group>
<definition class="compliance" id="{{{ rule_id }}}" version="1">
{{{ oval_metadata("A maximum password age should be set for the root account") }}}
<criteria>
<criterion comment="root max age"
test_ref="test_accounts_password_set_max_life_root"/>
</criteria>
</definition>
<unix:shadow_test check="all" check_existence="at_least_one_exists" version="1"
id="test_accounts_password_set_max_life_root"
comment="root max age">
<unix:object object_ref="object_accounts_password_set_max_life_root"/>
<unix:state state_ref="state_accounts_password_set_max_life_root"/>
</unix:shadow_test>
<unix:shadow_object id="object_accounts_password_set_max_life_root" version="1">
<unix:username operation="equals">root</unix:username>
</unix:shadow_object>
<unix:shadow_state id="state_accounts_password_set_max_life_root" version="1">
<unix:chg_req operation="equals" var_ref="var_accounts_maximum_age_root" datatype="int"/>
</unix:shadow_state>
<external_variable id="var_accounts_maximum_age_root" datatype="int" comment="maximum password age in days" version="1"/>
</def-group>
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
documentation_complete: true

title: 'Set Root Account Password Maximum Age'

description: |-
Configure the root account to enforce a {{{ xccdf_value("var_accounts_maximum_age_root") }}}-day maximum password lifetime restriction by running the following command:
<pre>$ sudo chage -M {{{ xccdf_value("var_accounts_maximum_age_root") }}} root</pre>
rationale: |-
Any password, no matter how complex, can eventually be cracked. Therefore,
passwords need to be changed periodically. If the operating system does
not limit the lifetime of passwords and force users to change their
passwords, there is the risk that the operating system passwords could be
compromised.
severity: medium

identifiers:
cce@rhel7: CCE-87665-6
cce@rhel8: CCE-87667-2
cce@rhel9: CCE-87668-0

ocil_clause: 'any results are returned that are not associated with a system account'

ocil: |-
Check whether the maximum time period for root account password is restricted to {{{ xccdf_value("var_accounts_maximum_age_root") }}} days with the following commands:
$ sudo awk -F: '$1 == "root" {print $1 " " $5}' /etc/shadow
fixtext: |-
Configure non-compliant accounts to enforce a {{{ xccdf_value("var_accounts_maximum_age_root") }}}-day maximum password lifetime restriction.
$ sudo chage -M {{{ xccdf_value("var_accounts_maximum_age_root") }}} root
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
# variables = var_accounts_maximum_age_root=365
chage -M 365 root
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
# variables = var_accounts_maximum_age_root=365
chage -M 9999 root
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
documentation_complete: true

title: 'Maximum Root Password Age'

description: 'Maximum age of password in days for the root account'

type: number

interactive: false

options:
365: 365
default: 99999
3 changes: 0 additions & 3 deletions shared/references/cce-redhat-avail.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1110,9 +1110,6 @@ CCE-87661-5
CCE-87662-3
CCE-87663-1
CCE-87664-9
CCE-87665-6
CCE-87667-2
CCE-87668-0
CCE-87669-8
CCE-87671-4
CCE-87672-2
Expand Down

0 comments on commit 8734eed

Please sign in to comment.