3 # Exercise enforced-authentication modes for pmcd.
5 # Copyright (c) 2013 Red Hat.
9 echo "QA output created by $seq"
11 # get standard environment, filters and checks
17 $unix_domain_sockets || _notrun
"No unix domain socket support available"
18 $authentication || _notrun
"No authentication support available"
21 which pluginviewer
>/dev
/null
2>&1 && gotplugins
=true
24 pluginviewer
=pluginviewer
26 which saslpluginviewer
>/dev
/null
2>&1 && gotplugins
=true
27 pluginviewer
=saslpluginviewer
29 $gotplugins || _notrun
"SASL pluginviewer utility unavailable"
30 $pluginviewer -c |
grep 'Plugin "plain"' >/dev
/null
2>&1
31 test $?
-eq 0 || _notrun
'No client support for plain authentication'
32 $pluginviewer -s |
grep 'Plugin "plain"' >/dev
/null
2>&1
33 test $?
-eq 0 || _notrun
'No server support for plain authentication'
35 export PCP_CONSOLE
=none
39 # restore any modified pmcd configuration files
40 _restore_config
$PCP_PMCDOPTIONS_PATH
41 _restore_config
$PCP_SASLCONF_DIR/pmcd.conf
43 $sudo $PCP_RC_DIR/pcp restart
2>&1 | _filter_pcp_stop | _filter_pcp_start
50 status
=1 # failure is the default!
51 $sudo rm -rf $tmp.
* $seq.full
52 trap "cleanup; exit \$status" 0 1 2 3 15
54 # Handle spurious lines from deep inside SASL code ...
55 # [Mon Mar 2 17:58:40] pmcd_wait(16622) Alert: Parameter Error in ../plugins/plugin_common.c near line 357
57 # And this from libpcp (via pmcd_wait) ...
58 # Starting pmcd ... [Thu Aug 4 16:59:02] pmcd_wait(14208) Error: __pmCloseChannelbyFd: fd=3 expected PDU_ATTR received: Timeout waiting for a response from PMCD
63 -e 's/\[[^]]*] .* Alert: Parameter Error .* line [0-9][0-9]*//' \
64 -e '/ pmcd_wait([0-9][0-9]*) Error: __pmCloseChannelbyFd/s/\[.*//' \
65 -e 's/\[[A-Z][a-z][a-z] [A-Z][a-z][a-z] *[0-9][0-9]* [0-9][0-9]:[0-9][0-9]:[0-9][0-9]]/[DATE]/' \
70 # real QA test starts here
71 _save_config
$PCP_SASLCONF_DIR/pmcd.conf
72 echo 'mech_list: plain' > $tmp.sasl
73 $sudo cp $tmp.sasl
$PCP_SASLCONF_DIR/pmcd.conf
75 _save_config
$PCP_PMCDOPTIONS_PATH
76 cat <<End-Of-File >$tmp.options
77 # Dummy lines added by PCP QA test $seq
81 $sudo cp $tmp.options
$PCP_PMCDOPTIONS_PATH
83 echo "Start pmcd with modified \$PCP_PMCDOPTIONS_PATH (pmcd.options)" |
tee -a $seq.full
84 cat $PCP_PMCDOPTIONS_PATH >>$seq.full
85 $sudo $PCP_RC_DIR/pmcd stop
2>&1 |
tee -a $seq.full
>$tmp.out
86 $sudo $PCP_RC_DIR/pmcd start
2>&1 |
tee -a $seq.full
>$tmp.out
87 _wait_for_pmcd
10 unix
: 2>&1 |
tee -a $seq.full | _filter
88 grep -i 'starting pmcd' $tmp.out \
90 |
sed -e "s/$$/MYPID/" \
93 # should now be running in enforced-credentials mode, check it out.
94 # unix domain access should always succeed - no matter how binaries
95 # were configured/built
97 echo "testing secure mode access via unix domain socket (PASS)"
98 pmstore
-h unix
: sample.write_me
1 # store PDU
99 pmprobe
-h unix
: -v sample.write_me
# fetch PDU
100 pminfo
-th unix
: sample.write_me
# text PDU
101 pminfo
-dh unix
: sample.write_me
# desc PDU
104 echo "testing secure mode access attempt via inet socket (FAIL)"
105 pmstore
-h localhost sample.write_me
2 2>&1 | _filter
106 pmprobe
-h localhost
-v sample.write_me
2>&1 | _filter
107 pminfo
-th localhost sample.write_me
2>&1 | _filter
108 pminfo
-dh localhost sample.write_me
2>&1 | _filter