diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 13:14:46 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 13:14:46 +0000 |
commit | 025c439e829e0db9ac511cd9c1b8d5fd53475ead (patch) | |
tree | fa6986b4690f991613ffb97cea1f6942427baf5d /plugins/sudoers/regress/testsudoers/test31.sh | |
parent | Initial commit. (diff) | |
download | sudo-025c439e829e0db9ac511cd9c1b8d5fd53475ead.tar.xz sudo-025c439e829e0db9ac511cd9c1b8d5fd53475ead.zip |
Adding upstream version 1.9.15p5.upstream/1.9.15p5upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-x | plugins/sudoers/regress/testsudoers/test31.sh | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/plugins/sudoers/regress/testsudoers/test31.sh b/plugins/sudoers/regress/testsudoers/test31.sh new file mode 100755 index 0000000..a40906d --- /dev/null +++ b/plugins/sudoers/regress/testsudoers/test31.sh @@ -0,0 +1,71 @@ +#!/bin/sh +# +# Exercise "sudo -U user -l [command]" +# + +: ${TESTSUDOERS=testsudoers} + +exec 2>&1 + +status=0 + +echo "'sudo -U root -l' with no matching rules" +$TESTSUDOERS -p ${TESTDIR}/passwd -P ${TESTDIR}/group -L root admin <<'EOF' +root ALL = ALL +EOF + +echo "" +echo "'sudo -U root -l' with a matching ALL=ALL rule" +$TESTSUDOERS -p ${TESTDIR}/passwd -P ${TESTDIR}/group -L root admin <<'EOF' +admin ALL = ALL +EOF + +echo "" +echo "'sudo -U root -l' with a matching list rule" +$TESTSUDOERS -p ${TESTDIR}/passwd -P ${TESTDIR}/group -L root admin <<'EOF' +admin ALL = NOPASSWD: list +EOF + +echo "" +echo "'sudo -U root -l' without a matching list rule" +$TESTSUDOERS -p ${TESTDIR}/passwd -P ${TESTDIR}/group -L root admin <<'EOF' +admin ALL = (operator) list +EOF + +echo "" +echo "'sudo -U root -l' with a negated list rule" +$TESTSUDOERS -p ${TESTDIR}/passwd -P ${TESTDIR}/group -L root admin <<'EOF' +admin ALL = !list +EOF + +echo "" +echo "'sudo -U root -l' with a list rule that is later negated" +$TESTSUDOERS -p ${TESTDIR}/passwd -P ${TESTDIR}/group -L root admin <<'EOF' +admin ALL = NOPASSWD: list, !list +EOF + +echo "" +echo "'sudo -l command' with a matching command" +$TESTSUDOERS -p ${TESTDIR}/passwd -P ${TESTDIR}/group -l admin /bin/ls <<'EOF' +admin ALL = /bin/ls +EOF + +echo "" +echo "'sudo -l command' without a matching command" +$TESTSUDOERS -p ${TESTDIR}/passwd -P ${TESTDIR}/group -l admin /usr/bin/id <<'EOF' +admin ALL = /bin/ls +EOF + +echo "" +echo "'sudo -U root -l command' without list privileges" +$TESTSUDOERS -p ${TESTDIR}/passwd -P ${TESTDIR}/group -L root admin /bin/ls <<'EOF' +root ALL = ALL +admin ALL = /usr/bin/id +EOF + +echo "" +echo "'sudo -U root -l command' with list privileges" +$TESTSUDOERS -p ${TESTDIR}/passwd -P ${TESTDIR}/group -L root admin /bin/ls <<'EOF' +root ALL = ALL +admin ALL = list +EOF |