Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 629926

Summary: qpid-winsdk an authentication example missing
Product: Red Hat Enterprise MRG Reporter: Frantisek Reznicek <freznice>
Component: qpid-sdkAssignee: Chuck Rolke <crolke>
Status: CLOSED ERRATA QA Contact: Petra Svobodová <psvobodo>
Severity: medium Docs Contact:
Priority: medium    
Version: betaCC: esammons, gsim, iboverma, jneedle, psvobodo, tross
Target Milestone: 2.0   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 1.3.3.1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-06-23 15:46:53 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Frantisek Reznicek 2010-09-03 09:54:25 UTC
Description of problem:

There is currently no example which show how to authenticate with remote broker. 
It is very important to show to users the way how to authenticate as broker by default require authentication. Adding/extending an example we avoid explicit questions.

If there is already at least one c++ and one .NET then it can be just properly explained as bug 629922 request.

This bug applies to both BZ categories client-cpp and client-net.

Version-Release number of selected component (if applicable):
all, for instance (qpid-cpp-*-0.7.946106-99.zip)

How reproducible:
N/A

Steps to Reproduce:
1. Search the winsdk for authentication example
  
Actual results:
No authentication code found.

Expected results:
An authentication code should be available.

Additional info:

Comment 1 Gordon Sim 2010-09-09 14:33:28 UTC
For the c++ version of drain and spout there is a --connection-options command line option available through which username and password (and sasl mechanism) can be supplied, e.g.:

  drain --connection-options '{username:guest, password:password, sasl-mechanism:PLAIN}' amq.topic

Comment 2 Gordon Sim 2010-09-09 14:36:38 UTC
Looks like c# versions have the same option.

Comment 3 Frantisek Reznicek 2010-09-09 15:56:24 UTC
Testing update:

OK, I can confirm that spout/drain can handle connection options:

C:\qpid\examples\messaging\Release>spout.exe --broker mrg-qe-01.lab.eng.brq.redhat.com --content "Hi!" "addr_%s; {create:sender, delete:receiver}" --connection-options "{username:guest, password:guest}"

C:\qpid\examples\messaging\Release>drain.exe --broker mrg-qe-01.lab.eng.brq.redhat.com  "addr_%s; {create:sender, delete:receiver}" --connection-options "{username:guest, password:guest}"
Message(properties={spout-id:478798b3-7f35-44e8-9a68-bd97959f253b:0,x-amqp-0-10
.routing-key:addr_%s}, content='Hi!')


On the .NET side I can see it failing:

C:\qpid\bin>csharp.example.spout.exe --broker mrg-qe-01.lab.eng.brq.redhat.com:5672 --connection-options "{username:guest, password:guest}" "addr_; {create:sender, delete:receiver}"
2010-09-09 17:46:15 warning Broker closed connection: 320, connection-forced: Authentication failed
Exception System.Runtime.InteropServices.SEHException: External component has th
rown an exception.
   at qpid.messaging.Connection.open(Connection* )
   at Org.Apache.Qpid.Messaging.Connection.Open()
   at Org.Apache.Qpid.Messaging.Examples.Spout.Main(String[] args) in c:\qpid\do
tnet_examples\examples\csharp.example.spout\csharp.example.spout.cs:line 73.


Having in the broker's log:

2010-09-09 11:46:41 info SASL: Mechanism list: LOGIN ANONYMOUS PLAIN
2010-09-09 11:46:41 warning Failed to retrieve sasl username
2010-09-09 11:46:41 info SASL: Authentication failed (no username available):SASL(-6): can't request info until later in exchange: Information that was requested is not yet available.
2010-09-09 11:46:41 warning Failed to retrieve sasl username
 


I believe that example switches need to be documented see bug 629922.

Comment 4 Gordon Sim 2010-09-09 16:25:02 UTC
A trace level log from the broker would be useful, to see exactly what is going wrong,

Comment 5 Frantisek Reznicek 2010-09-10 06:18:52 UTC
Understood, feedback soon (Monday).

Comment 6 Frantisek Reznicek 2010-09-10 06:52:18 UTC
Retested (.NET case, win 2003 x86 -> rhel5.5 i386):

csharp.example.spout fails to authenticate with broker:
C:\qpid\bin>csharp.example.spout.exe --broker
mrg-qe-01.lab.eng.brq.redhat.com:5672 --connection-options "{username:guest,
password:guest}" "addr_; {create:sender, delete:receiver}"
2010-09-09 17:46:15 warning Broker closed connection: 320, connection-forced:
Authentication failed
Exception System.Runtime.InteropServices.SEHException: External component has
th
rown an exception.
   at qpid.messaging.Connection.open(Connection* )
   at Org.Apache.Qpid.Messaging.Connection.Open()
   at Org.Apache.Qpid.Messaging.Examples.Spout.Main(String[] args) in
c:\qpid\do
tnet_examples\examples\csharp.example.spout\csharp.example.spout.cs:line 73.


Broker's trace+ log:

  [root@mrg-qe-01 ~]# rm -rf /tmp/dd /tmp/qpidd.log ;qpidd --auth yes --log-enable trace+ --log-to-file /tmp/qpidd.log --data-dir=/tmp/dd
  2010-09-10 02:41:39 info Loaded Module: /usr/lib/qpid/daemon/msgstore.so
  2010-09-10 02:41:39 info Loaded Module: /usr/lib/qpid/daemon/replicating_listener.so
  2010-09-10 02:41:39 info Loaded Module: /usr/lib/qpid/daemon/ssl.so
  2010-09-10 02:41:39 info Loaded Module: /usr/lib/qpid/daemon/cluster.so
  2010-09-10 02:41:39 info Loaded Module: /usr/lib/qpid/daemon/watchdog.so
  2010-09-10 02:41:39 info Loaded Module: /usr/lib/qpid/daemon/replication_exchange.so
  2010-09-10 02:41:39 info Loaded Module: /usr/lib/qpid/daemon/xml.so
  2010-09-10 02:41:39 info Loaded Module: /usr/lib/qpid/daemon/acl.so
  2010-09-10 02:41:39 info Loaded Module: /usr/lib/qpid/daemon/rdma.so
  2010-09-10 02:41:39 info No message store configured, persistence is disabled.
  2010-09-10 02:41:39 info Management enabled
  2010-09-10 02:41:39 info ManagementAgent generated broker ID: 1ea7725d-4c04-4858-a8d7-96458c3d759b
  2010-09-10 02:41:39 debug ManagementAgent boot sequence: 1
  2010-09-10 02:41:39 debug ManagementAgent added package org.apache.qpid.broker
  2010-09-10 02:41:39 trace SEND PackageInd package=org.apache.qpid.broker to=schema.package
  2010-09-10 02:41:39 debug ManagementAgent added class org.apache.qpid.broker:system
  2010-09-10 02:41:39 debug ManagementAgent added class org.apache.qpid.broker:broker
  2010-09-10 02:41:39 debug ManagementAgent added class org.apache.qpid.broker:agent
  2010-09-10 02:41:39 debug ManagementAgent added class org.apache.qpid.broker:vhost
  2010-09-10 02:41:39 debug ManagementAgent added class org.apache.qpid.broker:queue
  2010-09-10 02:41:39 debug ManagementAgent added class org.apache.qpid.broker:exchange
  2010-09-10 02:41:39 debug ManagementAgent added class org.apache.qpid.broker:binding
  2010-09-10 02:41:39 debug ManagementAgent added class org.apache.qpid.broker:subscription
  2010-09-10 02:41:39 debug ManagementAgent added class org.apache.qpid.broker:connection
  2010-09-10 02:41:39 debug ManagementAgent added class org.apache.qpid.broker:link
  2010-09-10 02:41:39 debug ManagementAgent added class org.apache.qpid.broker:bridge
  2010-09-10 02:41:39 debug ManagementAgent added class org.apache.qpid.broker:session
  2010-09-10 02:41:39 debug ManagementAgent added class org.apache.qpid.broker:managementsetupstate
  2010-09-10 02:41:39 debug ManagementAgent added class org.apache.qpid.broker:clientConnect
  2010-09-10 02:41:39 debug ManagementAgent added class org.apache.qpid.broker:clientConnectFail
  2010-09-10 02:41:39 debug ManagementAgent added class org.apache.qpid.broker:clientDisconnect
  2010-09-10 02:41:39 debug ManagementAgent added class org.apache.qpid.broker:brokerLinkUp
  2010-09-10 02:41:39 debug ManagementAgent added class org.apache.qpid.broker:brokerLinkDown
  2010-09-10 02:41:39 debug ManagementAgent added class org.apache.qpid.broker:queueDeclare
  2010-09-10 02:41:39 debug ManagementAgent added class org.apache.qpid.broker:queueDelete
  2010-09-10 02:41:39 debug ManagementAgent added class org.apache.qpid.broker:exchangeDeclare
  2010-09-10 02:41:39 debug ManagementAgent added class org.apache.qpid.broker:exchangeDelete
  2010-09-10 02:41:39 debug ManagementAgent added class org.apache.qpid.broker:bind
  2010-09-10 02:41:39 debug ManagementAgent added class org.apache.qpid.broker:unbind
  2010-09-10 02:41:39 debug ManagementAgent added class org.apache.qpid.broker:subscribe
  2010-09-10 02:41:39 debug ManagementAgent added class org.apache.qpid.broker:unsubscribe
  2010-09-10 02:41:39 notice Journal "TplStore": Created
  2010-09-10 02:41:39 debug Journal "TplStore": Journal directory = "/tmp/dd/rhm/tpl/"; Base file name = "tpl"
  2010-09-10 02:41:39 notice Store module initialized; store-dir=/tmp/dd
  2010-09-10 02:41:39 info > Default files per journal: 8
  2010-09-10 02:41:39 info > Default journal file size: 24 (wpgs)
  2010-09-10 02:41:39 info > Default write cache page size: 32 (Kib)
  2010-09-10 02:41:39 info > Default number of write cache pages: 32
  2010-09-10 02:41:39 info > TPL files per journal: 8
  2010-09-10 02:41:39 info > TPL journal file size: 24 (wpgs)
  2010-09-10 02:41:39 info > TPL write cache page size: 4 (Kib)
  2010-09-10 02:41:39 info > TPL number of write cache pages: 64
  2010-09-10 02:41:39 debug ManagementAgent added package com.redhat.rhm.store
  2010-09-10 02:41:39 trace SEND PackageInd package=com.redhat.rhm.store to=schema.package
  2010-09-10 02:41:39 debug ManagementAgent added class com.redhat.rhm.store:store
  2010-09-10 02:41:39 debug ManagementAgent added class com.redhat.rhm.store:journal
  2010-09-10 02:41:39 debug ManagementAgent added class com.redhat.rhm.store:enqThresholdExceeded
  2010-09-10 02:41:39 debug ManagementAgent added class com.redhat.rhm.store:created
  2010-09-10 02:41:39 debug ManagementAgent added class com.redhat.rhm.store:full
  2010-09-10 02:41:39 debug ManagementAgent added class com.redhat.rhm.store:recovered
  2010-09-10 02:41:39 info Registered replication exchange
  2010-09-10 02:41:39 info Registered xml exchange
  2010-09-10 02:41:39 info Most recent persistence id found: 0x0
  2010-09-10 02:41:39 info SASL enabled
  2010-09-10 02:41:39 notice Listening on TCP port 5672
  2010-09-10 02:41:39 info SSL plugin not enabled, you must set --ssl-cert-db to enable it.
  2010-09-10 02:41:39 info Policy file not specified. ACL Disabled, no ACL checking being done!
  2010-09-10 02:41:39 info Rdma: Disabled: no rdma devices found
  2010-09-10 02:41:39 notice Broker running
  2010-09-10 02:41:49 trace Management agent periodic processing
  2010-09-10 02:41:49 trace SEND V1 Multicast ContentInd to=console.obj.1.0.com.redhat.rhm.store.store props=1 stats=1
  2010-09-10 02:41:49 trace SEND V1 Multicast ContentInd to=console.obj.1.0.org.apache.qpid.broker.broker props=1 stats=1
  2010-09-10 02:41:49 trace SEND V1 Multicast ContentInd to=console.obj.1.0.org.apache.qpid.broker.exchange props=8 stats=8
  2010-09-10 02:41:49 trace SEND V1 Multicast ContentInd to=console.obj.1.0.org.apache.qpid.broker.system props=1 stats=0
  2010-09-10 02:41:49 trace SEND V1 Multicast ContentInd to=console.obj.1.0.org.apache.qpid.broker.vhost props=1 stats=0
  2010-09-10 02:41:49 trace SEND HeartbeatInd to=console.heartbeat.1.0
  2010-09-10 02:41:49 debug periodic update  management snapshot: packages: 2 objects: 12 new objects: 0
  2010-09-10 02:41:59 trace Management agent periodic processing
  2010-09-10 02:41:59 trace SEND V1 Multicast ContentInd to=console.obj.1.0.org.apache.qpid.broker.broker props=0 stats=1
  2010-09-10 02:41:59 trace SEND V1 Multicast ContentInd to=console.obj.1.0.org.apache.qpid.broker.exchange props=0 stats=1
  2010-09-10 02:41:59 trace SEND HeartbeatInd to=console.heartbeat.1.0
  2010-09-10 02:41:59 debug periodic update  management snapshot: packages: 2 objects: 12 new objects: 0
  ...
  2010-09-10 02:43:49 trace Management agent periodic processing
  2010-09-10 02:43:49 trace SEND V1 Multicast ContentInd to=console.obj.1.0.org.apache.qpid.broker.broker props=0 stats=1
  2010-09-10 02:43:49 trace SEND V1 Multicast ContentInd to=console.obj.1.0.org.apache.qpid.broker.exchange props=0 stats=1
  2010-09-10 02:43:49 trace SEND HeartbeatInd to=console.heartbeat.1.0
  2010-09-10 02:43:49 debug periodic update  management snapshot: packages: 2 objects: 12 new objects: 0
  2010-09-10 02:43:52 debug RECV [10.34.26.201:2038] INIT(0-10)
  2010-09-10 02:43:52 debug External ssf=0 and auth=
  2010-09-10 02:43:52 debug min_ssf: 0, max_ssf: 256, external_ssf: 0
  2010-09-10 02:43:52 info SASL: Mechanism list: LOGIN ANONYMOUS PLAIN
  2010-09-10 02:43:52 trace SENT 10.34.26.201:2038 INIT(0-10)
  2010-09-10 02:43:52 trace SENT [10.34.26.201:2038]: Frame[BEbe; channel=0; {ConnectionStartBody: server-properties={qpid.federation_tag:V2:36:str16(1ea7725d-4c04-4858-a8d7-96458c3d759b)}; mechanisms=str16{V2:5:str16(LOGIN), V2:9:str16(ANONYMOUS), V2:5:str16(PLAIN)}; locales=str16{V2:5:str16(en_US)}; }]
  2010-09-10 02:43:52 trace RECV [10.34.26.201:2038]: Frame[BEbe; channel=0; {ConnectionStartOkBody: client-properties={qpid.client_pid:F4:int32(1404),qpid.client_ppid:F4:int32(0),qpid.client_process:V2:0:str16(),qpid.session_flow:F4:int32(1)}; mechanism=PLAIN; response=xxxxxx; locale=en_US; }]
  2010-09-10 02:43:52 debug SASL: Starting authentication with mechanism: PLAIN
  2010-09-10 02:43:52 warning Failed to retrieve sasl username
  2010-09-10 02:43:52 info SASL: Authentication failed (no username available):SASL(-6): can't request info until later in exchange: Information that was requested is not yet available.
  2010-09-10 02:43:52 debug Exception constructed: Authentication failed
  2010-09-10 02:43:52 warning Failed to retrieve sasl username
  2010-09-10 02:43:52 trace SEND raiseEvent (v1) class=org.apache.qpid.broker.clientConnectFail
  2010-09-10 02:43:52 trace SENT [10.34.26.201:2038]: Frame[BEbe; channel=0; {ConnectionCloseBody: reply-code=320; reply-text=connection-forced: Authentication failed; }]
  2010-09-10 02:43:53 debug DISCONNECTED [10.34.26.201:2038]
  2010-09-10 02:43:53 trace SEND raiseEvent (v1) class=org.apache.qpid.broker.clientDisconnect
  2010-09-10 02:43:59 trace Management agent periodic processing
  2010-09-10 02:43:59 trace SEND V1 Multicast ContentInd to=console.obj.1.0.org.apache.qpid.broker.broker props=0 stats=1
  2010-09-10 02:43:59 trace SEND V1 Multicast ContentInd to=console.obj.1.0.org.apache.qpid.broker.connection props=1 stats=1
  2010-09-10 02:43:59 trace SEND V1 Multicast ContentInd to=console.obj.1.0.org.apache.qpid.broker.exchange props=0 stats=1
  2010-09-10 02:43:59 trace SEND HeartbeatInd to=console.heartbeat.1.0
  2010-09-10 02:43:59 debug periodic update  management snapshot: packages: 2 objects: 12 new objects: 0
  ...
  2010-09-10 02:48:59 trace Management agent periodic processing
  2010-09-10 02:48:59 trace SEND V1 Multicast ContentInd to=console.obj.1.0.org.apache.qpid.broker.broker props=0 stats=1
  2010-09-10 02:48:59 trace SEND V1 Multicast ContentInd to=console.obj.1.0.org.apache.qpid.broker.exchange props=0 stats=1
  2010-09-10 02:48:59 trace SEND HeartbeatInd to=console.heartbeat.1.0
  2010-09-10 02:48:59 debug periodic update  management snapshot: packages: 2 objects: 12 new objects: 0



Win package:
qpid-cpp-x86-0.7.946106-99.zip

RHEL 5.5 packages:
cyrus-sasl-2.1.22-5.el5_4.3
cyrus-sasl-devel-2.1.22-5.el5_4.3
cyrus-sasl-lib-2.1.22-5.el5_4.3
cyrus-sasl-plain-2.1.22-5.el5_4.3
python-qmf-0.7.946106-12.el5
python-qpid-0.7.946106-13.el5
python-saslwrapper-0.1.934605-2.el5
qmf-0.7.946106-12.el5
qmf-devel-0.7.946106-12.el5
qpid-cpp-client-0.7.946106-12.el5
qpid-cpp-client-devel-0.7.946106-12.el5
qpid-cpp-client-devel-docs-0.7.946106-12.el5
qpid-cpp-client-rdma-0.7.946106-12.el5
qpid-cpp-client-ssl-0.7.946106-12.el5
qpid-cpp-mrg-debuginfo-0.7.946106-12.el5
qpid-cpp-server-0.7.946106-12.el5
qpid-cpp-server-cluster-0.7.946106-12.el5
qpid-cpp-server-devel-0.7.946106-12.el5
qpid-cpp-server-rdma-0.7.946106-12.el5
qpid-cpp-server-ssl-0.7.946106-12.el5
qpid-cpp-server-store-0.7.946106-12.el5
qpid-cpp-server-xml-0.7.946106-12.el5
qpid-java-client-0.7.946106-8.el5
qpid-java-common-0.7.946106-8.el5
qpid-tools-0.7.946106-10.el5
rh-qpid-cpp-tests-0.7.946106-12.el5
ruby-qmf-0.7.946106-12.el5
ruby-qpid-0.7.946106-2.el5
ruby-saslwrapper-0.1.934605-2.el5
saslwrapper-0.1.934605-2.el5
saslwrapper-devel-0.1.934605-2.el5


We can trace this problem in separate bugzilla if you agree, as the authentication at least from drain and spout is possible.

Comment 7 Frantisek Reznicek 2010-09-10 06:59:32 UTC
I double-checked the qpidd sasl db for existence of expcted guest user
[root@mrg-qe-01 ~]# sasldblistusers2 -f /var/lib/qpidd/qpidd.sasldb
guest@QPID: userPassword

and tried authentication from pre-compiled qpid-perftest.exe and from c++ client authentication works as expected.

Comment 8 Gordon Sim 2010-09-10 08:00:49 UTC
This looks like the username option is not making it through to the underlying c++ client for some reason?

Comment 9 Frantisek Reznicek 2010-12-01 14:58:14 UTC
The issue is still present on qpid-cpp-winsdk-1.3.0.24-*.zip

The issue comes from the csharp.example.spout example where connection options are not passed to the lib, i.e.

Following fix to csharp.example.spout.cs avoids the issue:
- connection = new Connection(options.Url);
+ connection = new Connection(options.Url, options.ConnectionOptions);

Comment 13 Chuck Rolke 2011-03-01 21:53:02 UTC
The fix was checked in with r1041141, 01-Dec-2010.
See also BZ 657523.
This fix has not been repackaged into a new kit until 1.3.3.1 yesterday.

Comment 15 Petra Svobodová 2011-05-09 13:16:13 UTC
Parameters "options.ConnectionOptions" were added into the constructors (calling spout/drain). The authentication code example was added and is functional.

--> VERIFIED

Comment 16 errata-xmlrpc 2011-06-23 15:46:53 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHEA-2011-0890.html