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
|
#!/bin/sh
# PCP QA Test No. 1706
# Exercise the bpftrace PMDA - authentication with legacy config file (PCP < 5.1.0)
#
seq=`basename $0`
echo "QA output created by $seq"
. ./common.secure
. ./common.bpftrace
_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
grep bpftrace $PCP_LOG_DIR/pmcd/pmcd.log >>$seq_full
cat $PCP_LOG_DIR/pmcd/bpftrace.log >>$seq_full
echo
echo "=== authentication enabled, user is not allowed ==="
cat <<EOF | _pmdabpftrace_install
# Installed by PCP QA test $seq on `date`
[dynamic_scripts]
enabled = true
[authentication]
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
[authentication]
enabled = true
allowed_users = some_user,$username
EOF
pmstore bpftrace.control.register "tracepoint:raw_syscalls:sys_enter { @c = count(); }"
echo
echo "=== authentication disabled, everyone is allowed ==="
cat <<EOF | _pmdabpftrace_install
# Installed by PCP QA test $seq on `date`
[dynamic_scripts]
enabled = true
[authentication]
enabled = false
EOF
pmstore bpftrace.control.register "tracepoint:raw_syscalls:sys_enter { @c = count(); }"
echo
_pmdabpftrace_remove
status=0
exit
|