This file is indexed.

/var/lib/pcp/testsuite/660 is in pcp-testsuite 3.9.10.

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
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#! /bin/sh
# PCP QA Test No. 660
# checks basic pmwebd functionality
#
# Copyright (c) 2013-2014 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

which curl >/dev/null 2>&1 || _notrun "No curl binary installed"
echo curl ok
# nb: wget dispreferred because of its processing of .. relative links,
# so it's harder to stress pmwebd's base-directory-escaping logic

pyscript=src/test_webapi.python
python $pyscript --version 2>/dev/null || _notrun "python/modules missing"
echo python ok

$sudo rm -fr $tmp.dir
$sudo rm -f $tmp.*
rm -f $seq.full

signal=$PCP_BINADM_DIR/pmsignal
status=1	# failure is the default!
username=`id -u -n`
trap "_cleanup" 0 1 2 3 15

_cleanup()
{
    $sudo rm -fr $tmp.dir
    $sudo rm -f $tmp.*
    $sudo $signal -a pmwebd >/dev/null 2>&1
    $sudo $PCP_RC_DIR/pmwebd restart >/dev/null 2>&1
    exit $status
}

_filter()
{
    tee -a $seq.full \
    | sed -e 's,#[0-9]*,####,g' -e 's/PMWEBAPI error,.*/PMWEBAPI error, XXX/g'
}


unset http_proxy
unset HTTP_PROXY

$sudo $PCP_RC_DIR/pmwebd stop >/dev/null 2>&1
$sudo $signal -a pmwebd >/dev/null 2>&1

webargs="-U $username -f"

echo | tee -a $seq.full
echo "=== 1. pmwebd default startup  ===" | tee -a $seq.full
echo "$PCP_BINADM_DIR/pmwebd $webargs -l $tmp.out" >>$seq.full
$PCP_BINADM_DIR/pmwebd $webargs -l $tmp.out 2>&1 &
echo "pid=$!" >>$seq.full
sleep 2		# let it start up

if [ -f $tmp.out ]
then
    cat $tmp.out >>$seq.full
else
    echo "Arrgh ... pmwebd failed to start, $tmp.out not created"
    $PCP_PS_PROG $PCP_PS_ALL_FLAGS | egrep '[P]ID|[p]mwebd'
    exit
fi
curl -s -S "http://localhost:44323/pmapi/context?local=ANYTHING" \
| tee -a $seq.full \
| awk '{print $2}'
echo >>$seq.full

if [ ! -f /etc/hosts ]
then
    echo "Arrgh ... cannot find /etc/hosts to determine IPv6 localhost name"
    exit
fi
ipv6local=''
for sniff in localhost6 ip6-localhost
do
    if sed -e '/^#/d' -e 's/$/ /' /etc/hosts | grep -q "[ 	]$sniff "
    then
	ipv6local=$sniff
	break
    fi
done
if [ -z "$ipv6local" ]
then
    echo "Arrgh ... cannot determine IPv6 localhost name from /etc/hosts"
    exit
fi
echo "ipv6local=$ipv6local" >>$seq.full

rm -f $seq.out
if grep -q IPv6 $tmp.out; then
    curl -s -S "http://$ipv6local:44323/pmapi/context?local=ANYTHING" \
    | tee -a $seq.full \
    | awk '{print $2}'
    echo >>$seq.full
    # ipv6 + ipv4
    ln $seq.out.46 $seq.out
else
    # ipv4 only
    ln $seq.out.4 $seq.out
fi
# NB: we don't anticipate an ipv6-only host

echo | tee -a $seq.full
echo "=== 2. pmwebd exercise via python ===" | tee -a $seq.full
# pmwebd still running in default mode
if grep -q IPv4 $tmp.out; then
    python $pyscript --host localhost | _filter
fi
if grep -q IPv6 $tmp.out; then
    python $pyscript --host "$ipv6local" | _filter
fi

echo | tee -a $seq.full
echo "=== 3. pmwebd security constraints, file service ===" | tee -a $seq.full
$sudo $signal -a pmwebd >/dev/null 2>&1
sleep 2		# let it shutdown

$PCP_BINADM_DIR/pmwebd $webargs -R `pwd` -c 2222 -L -N 2>/dev/null &
sleep 2		# let it start up

# should fail due to -N
curl -s -S "http://localhost:44323/pmapi/context?local=anything" | _filter
echo
# should fail due to nonexistent context#
curl -s -S "http://localhost:44323/pmapi/2223/_fetch" | _filter
echo
# should fail with a different error (insufficient elements; ie pmFetch failed) 
curl -s -S "http://localhost:44323/pmapi/2222/_fetch" | _filter
echo
# should fail due to suspicious pmresapi path name
curl -s -S "http://localhost:44323/../../etc/passwd" | _filter
echo
# should pass, feed this very script
curl -s -S "http://localhost:44323/$seq" > $tmp.out
diff $tmp.out $0 && echo file service ok

status=0
sleep 2
exit