/var/lib/pcp/testsuite/1141 is in pcp-testsuite 4.0.1-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 89 90 91 92 | #!/bin/sh
# PCP QA Test No. 1141
# selinux install/remove testcase
#
# Copyright (c) 2017 Red Hat Inc. All Rights Reserved.
#
seq=`basename $0`
echo "QA output created by $seq"
# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check
policy_name="pcpqaqaqaqa"
policy_file="$PCP_VAR_DIR/selinux/pcpupstream.pp"
which sedismod >/dev/null 2>&1 || _notrun "sedismod tool not installed (module disassembly)"
which semodule >/dev/null 2>&1 || _notrun "semodule tool not installed"
which seinfo >/dev/null 2>&1 || _notrun "seinfo tool not installed"
[ -f "$policy_file" ] || _notrun "upstream policy package not installed"
#if a matching module is already installed
#then selinux will detect the similarity and not actually install the package
$sudo semodule -l 2>&1 | grep -q "$policy_name" && exit 0
semodule_x_option=`semodule -h | grep "\-X"`
_cleanup()
{
cd $here
$sudo rm -rf $tmp $tmp.*
}
_semodule_remove()
{
if [ "x$semodule_x_option" = "x" ]
then
echo "Removing semodule without priority option" >> $here/$seq.full
$sudo semodule -r $policy_name 2>&1
else
echo "Removing semodule with priority 1" >> $here/$seq.full
$sudo semodule -X 1 -r $policy_name 2>&1
fi \
| tee -a $here/$seq.full \
| sed \
-e '/Removing last pcpqaqaqaqa module/'d \
# end
}
status=1
$sudo rm -rf $tmp $tmp.* $seq.full
trap "_cleanup; exit \$status" 0 1 2 3 15
mkdir -p $tmp/selinux
# use pcpupstream.pp and rename the module to $policy_name
# ... warning this is a gross hack
#
OF=$tmp/selinux/$policy_name.pp
dd bs=1 count=70 if=$policy_file of=$OF 2>>$here/$seq.full
echo -n "qaqaqaqa" >>$OF
dd bs=1 skip=78 if=$policy_file >>$OF 2>>$here/$seq.full
file $OF >>$here/$seq.full
#install the module but catch any errors
if [ "x$semodule_x_option" = "x" ]
then
echo "Installing semodule without priority option" >> $here/$seq.full
error_line=`$sudo semodule -i $tmp/selinux/$policy_name.pp 2>&1 | tee -a $here/$seq.full | grep ^libsepol\. | cut -f3 -d":" |cut -f3 -d" "`
echo $error_line >> $here/$seq.full
else
echo "Installing semodule with priority 1" >> $here/$seq.full
# install module with priority 1
error_line=`$sudo semodule -X 1 -i $tmp/selinux/$policy_name.pp 2>&1 | tee -a $here/$seq.full | grep ^Fail | cut -f2 -d":"`
echo $error_line >> $here/$seq.full
fi
if [ "x$error_line" = "x" ]
then
_semodule_remove
status=0
exit
else
if [ "x$semodule_x_option" = "x" ]
then
echo "Error from type: $error_line"
else
/usr/libexec/selinux/hll/pp 2>/dev/null $tmp/selinux/$policy_name.pp $tmp/selinux/$policy_name.cil
echo "Error on line: $error_line from $policy_name.cil"
awk -v error_line="$error_line" \
'FNR==error_line' $tmp/selinux/$policy_name.cil
fi
exit
fi
|