1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
|
#!/bin/sh
# PCP QA Test No. 1724
# Exercise the bpftrace PMDA - authentication
#
seq=`basename $0`
echo "QA output created by $seq"
. ./common.secure
. ./common.bpftrace
case `admin/whatami`
in
*openSUSE\ Leap\ 15.*)
_notrun "this test does not work on openSUSE 15.x"
;;
esac
_pmdabpftrace_check
status=1 # failure is the default!
_prepare_pmda bpftrace
trap "_pmdabpftrace_cleanup; exit \$status" 0 1 2 3 15
_stop_auto_restart pmcd
# real QA test starts here
echo "=== default configuration (authentication enabled, no user is allowed) ==="
cat <<EOF | _pmdabpftrace_install
# Installed by PCP QA test $seq on `date`
[dynamic_scripts]
enabled = true
EOF
pmstore bpftrace.control.register "tracepoint:raw_syscalls:sys_enter { @c = count(); }"
grep -o "permission denied" $PCP_LOG_DIR/pmcd/bpftrace.log
echo
echo "=== authentication enabled, user is not allowed ==="
cat <<EOF | _pmdabpftrace_install
# Installed by PCP QA test $seq on `date`
[dynamic_scripts]
enabled = true
auth_enabled = true
allowed_users = some_user
EOF
pmstore bpftrace.control.register "tracepoint:raw_syscalls:sys_enter { @c = count(); }"
grep -o "permission denied" $PCP_LOG_DIR/pmcd/bpftrace.log
echo
echo "=== authentication enabled, user is allowed ==="
cat <<EOF | _pmdabpftrace_install
# Installed by PCP QA test $seq on `date`
[dynamic_scripts]
enabled = true
auth_enabled = true
allowed_users = some_user,$username
EOF
pmstore bpftrace.control.register "tracepoint:raw_syscalls:sys_enter { @c = count(); }"
grep -q "user=$username" $PCP_LOG_DIR/pmcd/bpftrace.log && echo "user was logged in bpftrace.log"
echo
echo "=== authentication enabled, user is allowed, space in config file ==="
cat <<EOF | _pmdabpftrace_install
# Installed by PCP QA test $seq on `date`
[dynamic_scripts]
enabled = true
auth_enabled = true
allowed_users = some_user, $username
EOF
pmstore bpftrace.control.register "tracepoint:raw_syscalls:sys_enter { @c = count(); }"
grep -q "user=$username" $PCP_LOG_DIR/pmcd/bpftrace.log && echo "user was logged in bpftrace.log"
echo
echo "=== authentication disabled, everyone is allowed ==="
cat <<EOF | _pmdabpftrace_install
# Installed by PCP QA test $seq on `date`
[dynamic_scripts]
enabled = true
auth_enabled = false
EOF
pmstore bpftrace.control.register "tracepoint:raw_syscalls:sys_enter { @c = count(); }"
grep -q "user=$username" $PCP_LOG_DIR/pmcd/bpftrace.log && echo "user was logged in bpftrace.log"
echo
_pmdabpftrace_remove
status=0
exit
|