forked from ComplianceAsCode/content
-
Notifications
You must be signed in to change notification settings - Fork 1
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#11589 from mpurg/fix_macro_local_…
…interactive_users Fix macro for extracting local interactive users
- Loading branch information
Showing
12 changed files
with
52 additions
and
40 deletions.
There are no files selected for viewing
7 changes: 3 additions & 4 deletions
7
...-session/accounts_user_dot_group_ownership/tests/interactive_user_nologin_ignored.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 |
---|---|---|
@@ -1,6 +1,5 @@ | ||
#!/bin/bash | ||
|
||
USER="cac_user" | ||
useradd -m -s /sbin/nologin $USER | ||
touch /home/$USER/.bashrc | ||
chgrp 10005 /home/$USER/.bashrc | ||
. "$SHARED/accounts_common.sh" | ||
|
||
run_foreach_noninteractive_shell_account "touch /home/\$user/.bashrc; chgrp 10005 /home/\$user/.bashrc" |
8 changes: 4 additions & 4 deletions
8
...s-session/accounts_user_dot_user_ownership/tests/interactive_user_nologin_ignored.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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/bin/bash | ||
|
||
USER="cac_user" | ||
useradd -m -s /sbin/nologin $USER | ||
touch /home/$USER/.bashrc | ||
chown 10005 /home/$USER/.bashrc | ||
. "$SHARED/accounts_common.sh" | ||
|
||
run_foreach_noninteractive_shell_account "touch /home/\$user/.bashrc; chown 10005 /home/\$user/.bashrc" | ||
|
5 changes: 3 additions & 2 deletions
5
...nts_user_interactive_home_directory_exists/tests/interactive_user_nologin_ignored.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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
#!/bin/bash | ||
|
||
USER="cac_user" | ||
useradd -M -s /sbin/nologin $USER | ||
. "$SHARED/accounts_common.sh" | ||
|
||
run_foreach_noninteractive_shell_account "rm -rf /home/\$user" |
7 changes: 3 additions & 4 deletions
7
...n/accounts_users_home_files_groupownership/tests/interactive_user_nologin_ignored.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 |
---|---|---|
@@ -1,6 +1,5 @@ | ||
#!/bin/bash | ||
|
||
USER="cac_user" | ||
useradd -m -s /sbin/nologin $USER | ||
echo "$USER" > /home/$USER/$USER.txt | ||
chgrp 10005 /home/$USER/$USER.txt | ||
. "$SHARED/accounts_common.sh" | ||
|
||
run_foreach_noninteractive_shell_account "echo \$user > /home/\$user/\$user.txt; chgrp 10005 /home/\$user/\$user.txt" |
7 changes: 3 additions & 4 deletions
7
...ession/accounts_users_home_files_ownership/tests/interactive_user_nologin_ignored.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 |
---|---|---|
@@ -1,6 +1,5 @@ | ||
#!/bin/bash | ||
|
||
USER="cac_user" | ||
useradd -m -s /sbin/nologin $USER | ||
echo "$USER" > /home/$USER/$USER.txt | ||
chown 10005 /home/$USER/$USER.txt | ||
. "$SHARED/accounts_common.sh" | ||
|
||
run_foreach_noninteractive_shell_account "echo \$user > /home/\$user/\$user.txt; chown 10005 /home/\$user/\$user.txt" |
8 changes: 3 additions & 5 deletions
8
...sion/accounts_users_home_files_permissions/tests/interactive_user_nologin_ignored.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 |
---|---|---|
@@ -1,7 +1,5 @@ | ||
#!/bin/bash | ||
|
||
USER="cac_user" | ||
useradd -m -s /sbin/nologin $USER | ||
echo "$USER" > /home/$USER/$USER.txt | ||
chmod -Rf 700 /home/$USER/.* | ||
chmod -f o+r /home/$USER/$USER.txt | ||
. "$SHARED/accounts_common.sh" | ||
|
||
run_foreach_noninteractive_shell_account "echo \$user > /home/\$user/\$user.txt; chmod -Rf 700 /home/\$user/.*; chmod -f o+r /home/\$user/\$user.txt" |
6 changes: 3 additions & 3 deletions
6
...ssion/file_groupownership_home_directories/tests/interactive_user_nologin_ignored.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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#!/bin/bash | ||
|
||
USER="cac_user" | ||
useradd -m -s /sbin/nologin $USER | ||
chgrp 10005 /home/$USER | ||
. "$SHARED/accounts_common.sh" | ||
|
||
run_foreach_noninteractive_shell_account "chgrp 10005 /home/\$user" |
6 changes: 3 additions & 3 deletions
6
...ts-session/file_ownership_home_directories/tests/interactive_user_nologin_ignored.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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#!/bin/bash | ||
|
||
USER="cac_user" | ||
useradd -m -s /sbin/nologin $USER | ||
chown 10005 /home/$USER | ||
. "$SHARED/accounts_common.sh" | ||
|
||
run_foreach_noninteractive_shell_account "chown 10005 /home/\$user" |
6 changes: 3 additions & 3 deletions
6
...-session/file_permissions_home_directories/tests/interactive_user_nologin_ignored.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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#!/bin/bash | ||
|
||
USER="cac_user" | ||
useradd -m -s /sbin/nologin $USER | ||
chmod 755 /home/$USER | ||
. "$SHARED/accounts_common.sh" | ||
|
||
run_foreach_noninteractive_shell_account "chmod 755 /home/\$user" |
6 changes: 3 additions & 3 deletions
6
...ser_umask/accounts_umask_interactive_users/tests/interactive_user_nologin_ignored.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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#!/bin/bash | ||
|
||
USER="cac_user" | ||
useradd -m -s /sbin/nologin $USER | ||
echo "umask 022" >> /home/$USER/.bashrc | ||
. "$SHARED/accounts_common.sh" | ||
|
||
run_foreach_noninteractive_shell_account "echo 'umask 022' >> /home/\$user/.bashrc" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
|
||
# for each noninteractive shell, create user account | ||
# and eval ommands which are passed in as function arguments | ||
function run_foreach_noninteractive_shell_account { | ||
for shell in "/sbin/nologin" \ | ||
"/usr/sbin/nologin" \ | ||
"/bin/false" \ | ||
"/usr/bin/false"; do | ||
|
||
user=cac_user${shell//\//_} | ||
useradd -m -s $shell $user | ||
|
||
eval "$*" | ||
done | ||
} |