forked from ComplianceAsCode/content
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request ComplianceAsCode#11560 from jan-cerny/anssi_R31
ANSSI R31 updates
- Loading branch information
Showing
10 changed files
with
109 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
...s-restrictions/password_expiration/accounts_password_set_max_life_root/ansible/shared.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 %}} |
8 changes: 8 additions & 0 deletions
8
...ounts-restrictions/password_expiration/accounts_password_set_max_life_root/bash/shared.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
22 changes: 22 additions & 0 deletions
22
...unts-restrictions/password_expiration/accounts_password_set_max_life_root/oval/shared.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
33 changes: 33 additions & 0 deletions
33
...ts/accounts-restrictions/password_expiration/accounts_password_set_max_life_root/rule.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
3 changes: 3 additions & 0 deletions
3
...estrictions/password_expiration/accounts_password_set_max_life_root/tests/correct.pass.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
3 changes: 3 additions & 0 deletions
3
...-restrictions/password_expiration/accounts_password_set_max_life_root/tests/wrong.fail.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
13 changes: 13 additions & 0 deletions
13
...stem/accounts/accounts-restrictions/password_expiration/var_accounts_maximum_age_root.var
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters