3 # PMCD denies all access?
5 # Copyright (c) 1995-2002 Silicon Graphics, Inc. All Rights Reserved.
9 echo "QA output created by $seq"
11 # get standard environment, filters and checks
16 perl
-e "use PCP::PMDA" >/dev
/null
2>&1
17 test $?
-eq 0 || _notrun
"PCP::PMDA perl module is not installed"
19 status
=1 # failure is the default!
21 [ -z "$PCP_PMLOGGERCONTROL_PATH" ] && \
22 PCP_PMLOGGERCONTROL_PATH
="$PCP_SYSCONF_DIR/pmlogger/control"
27 -e 's/Connection reset by peer/No permission to perform requested operation/'
30 # real QA test starts here
40 _restore_config
$PCP_PMCDCONF_PATH
41 _change_config pmlogger on
42 $sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
47 if $_chkconfig_pmlogger_on
49 [ -f $tmp.control
] && \
50 $sudo cp $tmp.control
$PCP_PMLOGGERCONTROL_PATH
51 $sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
54 _chkconfig_pmlogger_on
=false
61 trap "cleanup; exit \$status" 0 1 2 3 15
65 # real QA test starts here
68 # disable all pmloggers ...
69 _chkconfig_pmlogger_on
=true
70 $sudo cp $PCP_PMLOGGERCONTROL_PATH $tmp.control
71 cat <<End-of-File >$tmp.tmp
72 # dummy file created by qa/$seq on `date`
73 # the goal here is to have a controlled primary logger that does
74 # not make requests to pmcd!
76 LOCALHOSTNAME y n $PCP_LOG_DIR/pmlogger/LOCALHOSTNAME -c /dev/null
78 $sudo cp $tmp.tmp
$PCP_PMLOGGERCONTROL_PATH
79 #_change_config pmlogger off
81 _save_config
$PCP_PMCDCONF_PATH
86 other1
=`./getpmcdhosts -n 1 -L -v 'pcp=1' 2>$tmp.err`
89 echo "[test configuration only for v2 hosts]"
91 rm -f $seq.out
; ln $seq-v2.out
$seq.out
93 rm -f $seq.out
; ln $seq-v1v2.out
$seq.out
96 other2
=`./getpmcdhosts -n 1 -L -v 'pcp>=2' 2>$tmp.err`
99 # Unable to find remote PCP 2.x host
100 cat $tmp.err
>$seq.notrun
104 echo "other1=$other1" >>$seq.full
105 echo "other2=$other2" >>$seq.full
110 list1
=`_all_hostnames $other1`
113 echo "Error: failed to expand hostnames for other1=\"$other1\""
116 echo "V1 list1=$list1" >>$seq.full
117 list2
=`_all_hostnames $other2`
120 echo "Error: failed to expand hostnames for other2=\"$other2\""
123 echo "V1 list2=$list2" >>$seq.full
125 cat >$tmp.access
<<End-Of-File
128 disallow $list1 : all;
129 disallow $list2 : all;
133 list2
=`_all_hostnames $other2`
136 echo "Error: failed to expand hostnames for other2=\"$other2\""
139 echo "V2 list2=$list2" >>$seq.full
141 cat >$tmp.access
<<End-Of-File
144 disallow $list2 : all;
148 sed -e '/\[access]/q' $PCP_PMCDCONF_PATH.
$seq \
149 |
sed -e '/\[access]/d' >$tmp.config
150 cat $tmp.access
>>$tmp.config
151 $sudo cp $tmp.config
$PCP_PMCDCONF_PATH
154 echo "---- start pmcd.conf ----" >>$seq.full
155 cat $PCP_PMCDCONF_PATH >>$seq.full
156 echo "---- end pmcd.conf ----" >>$seq.full
158 $sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
161 echo " checking default access for this host ..."
162 pminfo
-f sample.long.million \
164 pmstore sample.write_me
111
169 echo " checking access for list1 (should fail)"
170 ssh -q pcpqa@
$other1 pminfo
-h $me -f pmcd.numclients
2>&1 \
171 |
sed -e 's/"'$me'"/"HOST"/g'
174 echo " checking access for list2 (should fail)"
175 ssh -q pcpqa@
$other2 pminfo
-h $me -f pmcd.numclients
2>&1 \
176 |
sed -e 's/"'$me'"/"HOST"/g'
178 echo "pmcd.log:======="
179 sed -n <$PCP_PMCDLOG_PATH -e '/endclient/{
181 s/(fd [0-9]*)/(fd N)/
184 echo "================"
189 iplist1
=`_all_ipaddrs $other1`
192 echo "Error: failed to expand ip addrs for other1=\"$other1\""
195 echo "V1 iplist1=$iplist1" >>$seq.full
196 iplist2
=`_all_ipaddrs $other2`
199 echo "Error: failed to expand ip addrs for other2=\"$other2\""
202 echo "V1 iplist2=$iplist2" >>$seq.full
204 cat >$tmp.access
<<End-Of-File
207 disallow $iplist1 : all;
208 disallow $iplist2 : all;
212 iplist2
=`_all_ipaddrs $other2`
215 echo "Error: failed to expand ip addrs for other2=\"$other2\""
218 echo "V2 iplist2=$iplist2" >>$seq.full
220 cat >$tmp.access
<<End-Of-File
223 disallow $iplist2 : all;
228 sed -e '/\[access]/q' $PCP_PMCDCONF_PATH.
$seq \
229 |
sed -e '/\[access]/d' >$tmp.config
230 cat $tmp.access
>>$tmp.config
231 $sudo cp $tmp.config
$PCP_PMCDCONF_PATH
234 echo "---- start pmcd.conf ----" >>$seq.full
235 cat $PCP_PMCDCONF_PATH >>$seq.full
236 echo "---- end pmcd.conf ----" >>$seq.full
238 $sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
241 echo " checking default access for this host ..."
242 pminfo
-f sample.long.million
243 pmstore sample.write_me
444
248 echo " checking access for iplist1 (should fail)"
249 ssh -q pcpqa@
$other1 pminfo
-h $me -f pmcd.numclients
2>&1 \
250 |
sed -e 's/"'$me'"/"HOST"/g'
254 echo " checking access for iplist2 (should fail)"
255 ssh -q pcpqa@
$other2 pminfo
-h $me -f pmcd.numclients
2>&1 \
256 |
sed -e 's/"'$me'"/"HOST"/g'
258 echo "pmcd.log:======="
259 sed -n <$PCP_PMCDLOG_PATH -e '/endclient/{
261 s/(fd [0-9]*)/(fd N)/
264 echo "================"