diff options
author | Micah Morton <mortonm@chromium.org> | 2019-02-06 11:03:09 -0800 |
---|---|---|
committer | James Morris <james.morris@microsoft.com> | 2019-02-12 10:58:51 -0800 |
commit | c67e8ec03f3fd41c0b75f5596eee92460f4957c0 (patch) | |
tree | 40c20da64f01ebd02f38aeb8e9115800f37b8b7a /tools/testing/selftests/safesetid/safesetid-test.sh | |
parent | 2181e084b26bddca22bc3f23364c15809cfed28b (diff) |
LSM: SafeSetID: add selftest
This patch adds a selftest for the SafeSetID LSM. The test requires
mounting securityfs if it isn't mounted, creating test users in
/etc/passwd, and configuring policies for the SafeSetID LSM through
writes to securityfs.
Signed-off-by: Micah Morton <mortonm@chromium.org>
Signed-off-by: James Morris <james.morris@microsoft.com>
Diffstat (limited to 'tools/testing/selftests/safesetid/safesetid-test.sh')
-rwxr-xr-x | tools/testing/selftests/safesetid/safesetid-test.sh | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tools/testing/selftests/safesetid/safesetid-test.sh b/tools/testing/selftests/safesetid/safesetid-test.sh new file mode 100755 index 000000000000..e4fdce675c54 --- /dev/null +++ b/tools/testing/selftests/safesetid/safesetid-test.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +TCID="safesetid-test.sh" +errcode=0 + +# Kselftest framework requirement - SKIP code is 4. +ksft_skip=4 + +check_root() +{ + uid=$(id -u) + if [ $uid -ne 0 ]; then + echo $TCID: must be run as root >&2 + exit $ksft_skip + fi +} + +main_function() +{ + check_root + ./safesetid-test +} + +main_function +echo "$TCID: done" +exit $errcode |