-
Notifications
You must be signed in to change notification settings - Fork 696
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix nologin_ignored tests for rules using create_local_interactive_us…
…ers_object The solution deduplicates most of the code to test/shared/accounts_common.sh, as proposed in PR review.
- Loading branch information
Showing
11 changed files
with
72 additions
and
35 deletions.
There are no files selected for viewing
10 changes: 6 additions & 4 deletions
10
...-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,8 @@ | ||
#!/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 <<EOF | ||
touch /home/\$user/.bashrc | ||
chgrp 10005 /home/\$user/.bashrc | ||
EOF |
11 changes: 7 additions & 4 deletions
11
...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,9 @@ | ||
#!/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 <<EOF | ||
touch /home/\$user/.bashrc | ||
chown 10005 /home/\$user/.bashrc | ||
EOF | ||
|
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" |
10 changes: 6 additions & 4 deletions
10
...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,8 @@ | ||
#!/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 <<EOF | ||
echo "\$user" > /home/\$user/\$user.txt | ||
chgrp 10005 /home/\$user/\$user.txt | ||
EOF |
10 changes: 6 additions & 4 deletions
10
...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,8 @@ | ||
#!/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 <<EOF | ||
echo "\$user" > /home/\$user/\$user.txt | ||
chown 10005 /home/\$user/\$user.txt | ||
EOF |
12 changes: 7 additions & 5 deletions
12
...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,9 @@ | ||
#!/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 <<EOF | ||
echo "\$user" > /home/\$user/\$user.txt | ||
chmod -Rf 700 /home/\$user/.* | ||
chmod -f o+r /home/\$user/\$user.txt | ||
EOF |
8 changes: 5 additions & 3 deletions
8
...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,7 @@ | ||
#!/bin/bash | ||
|
||
USER="cac_user" | ||
useradd -m -s /sbin/nologin $USER | ||
chgrp 10005 /home/$USER | ||
. "$SHARED/accounts_common.sh" | ||
|
||
run_foreach_noninteractive_shell_account <<EOF | ||
chgrp 10005 /home/\$user | ||
EOF |
8 changes: 5 additions & 3 deletions
8
...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,7 @@ | ||
#!/bin/bash | ||
|
||
USER="cac_user" | ||
useradd -m -s /sbin/nologin $USER | ||
chown 10005 /home/$USER | ||
. "$SHARED/accounts_common.sh" | ||
|
||
run_foreach_noninteractive_shell_account <<EOF | ||
chown 10005 /home/\$user | ||
EOF |
8 changes: 5 additions & 3 deletions
8
...-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,7 @@ | ||
#!/bin/bash | ||
|
||
USER="cac_user" | ||
useradd -m -s /sbin/nologin $USER | ||
chmod 755 /home/$USER | ||
. "$SHARED/accounts_common.sh" | ||
|
||
run_foreach_noninteractive_shell_account <<EOF | ||
chmod 755 /home/\$user | ||
EOF |
8 changes: 5 additions & 3 deletions
8
...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,7 @@ | ||
#!/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 <<EOF | ||
echo "umask 022" >> /home/\$user/.bashrc | ||
EOF |
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,17 @@ | ||
#!/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 { | ||
echo "Asd" | ||
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 | ||
} |