-
Notifications
You must be signed in to change notification settings - Fork 706
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 #12721 from mpurg/ubuntu2404_cis_5.4.2.6
Implement rule accounts_umask_root
- Loading branch information
Showing
15 changed files
with
85 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ packages: | |
- bash | ||
rules: | ||
- accounts_umask_etc_bashrc | ||
- accounts_umask_root |
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
3 changes: 3 additions & 0 deletions
3
...x_os/guide/system/accounts/accounts-session/user_umask/accounts_umask_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,3 @@ | ||
# platform = multi_platform_all | ||
|
||
sed -i -E -e "s/^([^#]*\bumask)[[:space:]]+[[:digit:]]+/\1 0027/g" /root/.bashrc /root/.profile |
21 changes: 21 additions & 0 deletions
21
..._os/guide/system/accounts/accounts-session/user_umask/accounts_umask_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,21 @@ | ||
<def-group> | ||
<definition class="compliance" id="{{{ rule_id }}}" version="1"> | ||
{{{ oval_metadata("The umask for root user of the bash shell") }}} | ||
<criteria operator="AND"> | ||
<criterion test_ref="tst_{{{ rule_id }}}" /> | ||
</criteria> | ||
</definition> | ||
|
||
<ind:textfilecontent54_object id="obj_{{{ rule_id }}}" | ||
comment="Umask value from /root/.bashrc and /root/.profile" version="1"> | ||
<ind:filepath operation="pattern match">^(/root/.bashrc|/root/.profile)$</ind:filepath> | ||
<ind:pattern operation="pattern match">^[^#]*\bumask\s+[0-7]?[0-7]([0-1][0-7]|[0-7][0-6])\s*$</ind:pattern> | ||
<ind:instance datatype="int" operation="greater than or equal">1</ind:instance> | ||
</ind:textfilecontent54_object> | ||
|
||
<ind:textfilecontent54_test id="tst_{{{ rule_id }}}" check="all" check_existence="none_exist" | ||
comment="Test that no umask with lenient permissions exists" version="1"> | ||
<ind:object object_ref="obj_{{{ rule_id }}}"/> | ||
</ind:textfilecontent54_test> | ||
|
||
</def-group> |
18 changes: 18 additions & 0 deletions
18
linux_os/guide/system/accounts/accounts-session/user_umask/accounts_umask_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,18 @@ | ||
documentation_complete: true | ||
|
||
title: 'Ensure the Root Bash Umask is Set Correctly' | ||
|
||
description: |- | ||
To ensure the root user's umask of the Bash shell is set properly, | ||
add or correct the <tt>umask</tt> setting in <tt>/root/.bashrc</tt> | ||
or <tt>/root/.bashrc</tt> to read as follows: | ||
<pre>umask 0027</pre> | ||
rationale: |- | ||
The umask value influences the permissions assigned to files when they are created. | ||
A misconfigured umask value could result in files with excessive permissions that can be read or | ||
written to by unauthorized users. | ||
severity: medium | ||
|
||
platform: package[bash] |
5 changes: 5 additions & 0 deletions
5
...e/system/accounts/accounts-session/user_umask/accounts_umask_root/tests/commented.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,5 @@ | ||
#!/bin/bash | ||
|
||
sed '/umask/d' -i /root/.bashrc /root/.profile | ||
echo "# umask 0022" >> /root/.bashrc | ||
|
4 changes: 4 additions & 0 deletions
4
...tem/accounts/accounts-session/user_umask/accounts_umask_root/tests/correct_bashrc.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,4 @@ | ||
#!/bin/bash | ||
|
||
sed '/umask/d' -i /root/.bashrc /root/.profile | ||
echo "umask 0027" >> /root/.bashrc |
4 changes: 4 additions & 0 deletions
4
...em/accounts/accounts-session/user_umask/accounts_umask_root/tests/correct_profile.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,4 @@ | ||
#!/bin/bash | ||
|
||
sed '/umask/d' -i /root/.bashrc /root/.profile | ||
echo "umask 0027" >> /root/.profile |
4 changes: 4 additions & 0 deletions
4
...ide/system/accounts/accounts-session/user_umask/accounts_umask_root/tests/lenient.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,4 @@ | ||
#!/bin/bash | ||
|
||
sed '/umask/d' -i /root/.bashrc /root/.profile | ||
echo "umask 0022" >> /root/.profile |
4 changes: 4 additions & 0 deletions
4
...de/system/accounts/accounts-session/user_umask/accounts_umask_root/tests/lenient2.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,4 @@ | ||
#!/bin/bash | ||
|
||
sed '/umask/d' -i /root/.bashrc /root/.profile | ||
echo "umask 0017" >> /root/.profile |
5 changes: 5 additions & 0 deletions
5
...ounts-session/user_umask/accounts_umask_root/tests/lenient_bashrc_correct_profile.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,5 @@ | ||
#!/bin/bash | ||
|
||
sed '/umask/d' -i /root/.bashrc /root/.profile | ||
echo "umask 0000" >> /root/.bashrc | ||
echo "umask 0027" >> /root/.profile |
4 changes: 4 additions & 0 deletions
4
...accounts/accounts-session/user_umask/accounts_umask_root/tests/lenient_threedigit.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,4 @@ | ||
#!/bin/bash | ||
|
||
sed '/umask/d' -i /root/.bashrc /root/.profile | ||
echo "umask 022" >> /root/.profile |
4 changes: 4 additions & 0 deletions
4
...ide/system/accounts/accounts-session/user_umask/accounts_umask_root/tests/missing.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,4 @@ | ||
#!/bin/bash | ||
|
||
sed '/umask/d' -i /root/.bashrc /root/.profile | ||
|
4 changes: 4 additions & 0 deletions
4
...uide/system/accounts/accounts-session/user_umask/accounts_umask_root/tests/strict.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,4 @@ | ||
#!/bin/bash | ||
|
||
sed '/umask/d' -i /root/.bashrc /root/.profile | ||
echo "umask 0777" >> /root/.profile |