diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2014-10-26 12:33:50 +0400 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2014-10-26 12:33:50 +0400 |
commit | 47e6e7c84f008a53061e661f31ae96629bc694ef (patch) | |
tree | 648a07f3b5b9d67ce19b0fd72e8caa1175c98f1a /qa/723 | |
download | pcp-debian.tar.gz |
Debian 3.9.10debian/3.9.10debian
Diffstat (limited to 'qa/723')
-rwxr-xr-x | qa/723 | 55 |
1 files changed, 55 insertions, 0 deletions
@@ -0,0 +1,55 @@ +#!/bin/sh +# PCP QA Test No. 723 +# Exercise Linux kernel proc.psinfo.label metric +# +# Copyright (c) 2013 Red Hat. All Rights Reserved. +# + +seq=`basename $0` +echo "QA output created by $seq" +# get standard environment, filters and checks +. ./common.product +. ./common.filter +. ./common.check + +pid=$$ + +test $PCP_VER -ge 3805 || _notrun "No support for new proc label metric" +test $PCP_PLATFORM = linux || _notrun "Test unsupported on $PCP_PLATFORM" +test -f /proc/$pid/attr/current || _notrun "No kernel support for labels" +# for some kernels, /proc/$pid/attr/current exists, but attempts to +# access the "file" produce and Invalid argument error +# +cat /proc/$$/attr/current >/dev/null 2>&1 || _notrun "Incomplete kernel support for labels" + + +status=1 # failure is the default! +$sudo rm -rf $tmp.* $seq.full +trap "cd $here; rm -rf $tmp.*; exit \$status" 0 1 2 3 15 + +# real QA test starts here +$sudo rm -f $seq.full +#debug# ls -l /proc/$pid/attr/current +syslabel=`cat /proc/$pid/attr/current` +echo "SYS Label for process $pid is: $syslabel" >> $seq.full + +pminfo -f proc.psinfo.labels > $tmp.labels +pcplabel=`grep "^ inst \[$pid or " $tmp.labels \ + | $PCP_AWK_PROG '{ print $NF }' \ + | sed -e 's/^"//' -e 's/"$//'` +echo "PCP Label for process $pid is: $pcplabel" >> $seq.full +echo "Extracted from list:" >> $seq.full +cat $tmp.labels >> $seq.full + +if [ "$pcplabel" = "$syslabel" ] +then + echo "Security label for current process checks out" + status=0 +else + echo "Mismatch on security labels:" + echo "PCP Label: $pcplabel" + echo "SYS Label: $syslabel" + status=1 +fi + +exit |