You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Andreas Welchlin <an...@welchlin.de> on 2015/08/26 14:40:10 UTC

C++ messaging API: SASL mechanism not set correctly

Hello,

I tried to connect to a AMQP Broker via SSL using AMQP 0.10.

I used C++ and the Qpid Messaging API version 0.28.

It seems like I set the SASL mechanism in a wrong way.

I tried the following:

const char* QPID_OPTION_TRANSPORT = "transport";
const char* QPID_OPTION_SASL_MECHANISMS = "sasl_mechanisms";

mConnection = new Connection("amqp:ssl:<ipaddress>");
mConnection->setOption(QPID_OPTION_SASL_MECHANISMS, "EXTERNAL");
mConnection->setOption(QPID_OPTION_TRANSPORT, "ssl");
mConnection->open();


The logfile says:

Starting connection, urls=[amqp:ssl:<ipaddress>]
Trying to connect to amqp:ssl:<ipaddress>...
Created IO thread: 0
SslConnector created for 0-10
Connecting: 90.162.253.101:10170
RECV [[172.17.97.139:46893-<ipaddress>]]: INIT(0-10)
Exception constructed: Desired mechanism(s) not valid: True (supported: 
EXTERNAL) (qpid/client/ConnectionHandler.cpp:260)
Closing connection due to Desired mechanism(s) not valid: True 
(supported: EXTERNAL) (qpid/client/ConnectionHandler.cpp:260)
Exception constructed: Desired mechanism(s) not valid: True (supported: 
EXTERNAL) (qpid/client/ConnectionHandler.cpp:260)
Exception constructed: Desired mechanism(s) not valid: True (supported: 
EXTERNAL) (qpid/client/ConnectionHandler.cpp:260)


What am I doing wrong? Would it help if I set the SASL mechanism like this:

mConnection = new Connection(brokerUrl, 
"{transport:ssl,sasl-mechanism:EXTERNAL}");


Regards,
Andreas






---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: C++ messaging API: SASL mechanism not set correctly

Posted by Andreas Welchlin <an...@welchlin.de>.
OK, me too.

strange.

Am 27.08.2015 um 17:42 schrieb Gordon Sim:
> On 08/27/2015 04:36 PM, Andreas Welchlin wrote:
>> Did you try with AMQP 1.0 or with AMQP 0.10?
>
> 0-10
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org
>



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: C++ messaging API: SASL mechanism not set correctly

Posted by Gordon Sim <gs...@redhat.com>.
On 08/27/2015 04:36 PM, Andreas Welchlin wrote:
> Did you try with AMQP 1.0 or with AMQP 0.10?

0-10


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: C++ messaging API: SASL mechanism not set correctly

Posted by Andreas Welchlin <an...@welchlin.de>.
Did you try with AMQP 1.0 or with AMQP 0.10?


Am 27.08.2015 um 17:38 schrieb Gordon Sim:
> On 08/27/2015 04:09 PM, Andreas Welchlin wrote:
>> Hi All,
>>
>> now I can answer my own question:
>>
>> instead of:
>>
>> mConnection = new Connection("amqp:ssl:<ipaddress>");
>> mConnection->setOption(QPID_OPTION_SASL_MECHANISMS, "EXTERNAL");
>> mConnection->setOption(QPID_OPTION_TRANSPORT, "ssl");
>>
>> you can use:
>>
>> mConnection = new Connection("amqp:ssl:<ipaddress>", "{transport:ssl,
>> sasl-mechanism:EXTERNAL}");
>>
>
> Strange, I don't quite understand that, but as long as it works, thats 
> good! Thanks for the update!
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org
>



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: C++ messaging API: SASL mechanism not set correctly

Posted by Gordon Sim <gs...@redhat.com>.
On 08/27/2015 04:09 PM, Andreas Welchlin wrote:
> Hi All,
>
> now I can answer my own question:
>
> instead of:
>
> mConnection = new Connection("amqp:ssl:<ipaddress>");
> mConnection->setOption(QPID_OPTION_SASL_MECHANISMS, "EXTERNAL");
> mConnection->setOption(QPID_OPTION_TRANSPORT, "ssl");
>
> you can use:
>
> mConnection = new Connection("amqp:ssl:<ipaddress>", "{transport:ssl,
> sasl-mechanism:EXTERNAL}");
>

Strange, I don't quite understand that, but as long as it works, thats 
good! Thanks for the update!


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: C++ messaging API: SASL mechanism not set correctly

Posted by Andreas Welchlin <an...@welchlin.de>.
Hi All,

now I can answer my own question:

instead of:

mConnection = new Connection("amqp:ssl:<ipaddress>");
mConnection->setOption(QPID_OPTION_SASL_MECHANISMS, "EXTERNAL");
mConnection->setOption(QPID_OPTION_TRANSPORT, "ssl");

you can use:

mConnection = new Connection("amqp:ssl:<ipaddress>", "{transport:ssl, 
sasl-mechanism:EXTERNAL}");

Then it works.

Thanks for your help, Gordon.

Andreas


Am 27.08.2015 um 15:00 schrieb andreas@welchlin.de:
> Hi Gordon,
> thank you for your answer. I am using gcc 4.4.7 on a CentOs system.
>
> Regards,
> Andreas
>
> Am 27. August 2015 11:50:06 MESZ, schrieb Gordon Sim <gs...@redhat.com>:
>> On 08/26/2015 01:40 PM, Andreas Welchlin wrote:
>>> Hello,
>>>
>>> I tried to connect to a AMQP Broker via SSL using AMQP 0.10.
>>>
>>> I used C++ and the Qpid Messaging API version 0.28.
>>>
>>> It seems like I set the SASL mechanism in a wrong way.
>>>
>>> I tried the following:
>>>
>>> const char* QPID_OPTION_TRANSPORT = "transport";
>>> const char* QPID_OPTION_SASL_MECHANISMS = "sasl_mechanisms";
>>>
>>> mConnection = new Connection("amqp:ssl:<ipaddress>");
>>> mConnection->setOption(QPID_OPTION_SASL_MECHANISMS, "EXTERNAL");
>>> mConnection->setOption(QPID_OPTION_TRANSPORT, "ssl");
>>> mConnection->open();
>>>
>>>
>>> The logfile says:
>>>
>>> Starting connection, urls=[amqp:ssl:<ipaddress>]
>>> Trying to connect to amqp:ssl:<ipaddress>...
>>> Created IO thread: 0
>>> SslConnector created for 0-10
>>> Connecting: 90.162.253.101:10170
>>> RECV [[172.17.97.139:46893-<ipaddress>]]: INIT(0-10)
>>> Exception constructed: Desired mechanism(s) not valid: True
>> (supported:
>>> EXTERNAL) (qpid/client/ConnectionHandler.cpp:260)
>> The problem here seems to be that the desired mechanism is somehow
>> being
>> treated as a boolean, which is converted to "True" when converting to a
>>
>> string.
>>
>> I can't seem to reproduce this using the code you have above, even
>> against 0.28. What compiler are you using?
>>
>> (One unrelated point is that you don't need to use new and explicitly
>> have a pointer to the connection. The Connection class is a handle that
>>
>> allows you to pass it around and internally it maintains the necessary
>> reference counting).
>>
>>> Closing connection due to Desired mechanism(s) not valid: True
>>> (supported: EXTERNAL) (qpid/client/ConnectionHandler.cpp:260)
>>> Exception constructed: Desired mechanism(s) not valid: True
>> (supported:
>>> EXTERNAL) (qpid/client/ConnectionHandler.cpp:260)
>>> Exception constructed: Desired mechanism(s) not valid: True
>> (supported:
>>> EXTERNAL) (qpid/client/ConnectionHandler.cpp:260)
>>>
>>>
>>> What am I doing wrong? Would it help if I set the SASL mechanism like
>> this:
>>> mConnection = new Connection(brokerUrl,
>>> "{transport:ssl,sasl-mechanism:EXTERNAL}");
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
>> For additional commands, e-mail: users-help@qpid.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: C++ messaging API: SASL mechanism not set correctly

Posted by an...@welchlin.de.
Hi Gordon,
thank you for your answer. I am using gcc 4.4.7 on a CentOs system. 

Regards,
Andreas

Am 27. August 2015 11:50:06 MESZ, schrieb Gordon Sim <gs...@redhat.com>:
>On 08/26/2015 01:40 PM, Andreas Welchlin wrote:
>> Hello,
>>
>> I tried to connect to a AMQP Broker via SSL using AMQP 0.10.
>>
>> I used C++ and the Qpid Messaging API version 0.28.
>>
>> It seems like I set the SASL mechanism in a wrong way.
>>
>> I tried the following:
>>
>> const char* QPID_OPTION_TRANSPORT = "transport";
>> const char* QPID_OPTION_SASL_MECHANISMS = "sasl_mechanisms";
>>
>> mConnection = new Connection("amqp:ssl:<ipaddress>");
>> mConnection->setOption(QPID_OPTION_SASL_MECHANISMS, "EXTERNAL");
>> mConnection->setOption(QPID_OPTION_TRANSPORT, "ssl");
>> mConnection->open();
>>
>>
>> The logfile says:
>>
>> Starting connection, urls=[amqp:ssl:<ipaddress>]
>> Trying to connect to amqp:ssl:<ipaddress>...
>> Created IO thread: 0
>> SslConnector created for 0-10
>> Connecting: 90.162.253.101:10170
>> RECV [[172.17.97.139:46893-<ipaddress>]]: INIT(0-10)
>> Exception constructed: Desired mechanism(s) not valid: True
>(supported:
>> EXTERNAL) (qpid/client/ConnectionHandler.cpp:260)
>
>The problem here seems to be that the desired mechanism is somehow
>being 
>treated as a boolean, which is converted to "True" when converting to a
>
>string.
>
>I can't seem to reproduce this using the code you have above, even 
>against 0.28. What compiler are you using?
>
>(One unrelated point is that you don't need to use new and explicitly 
>have a pointer to the connection. The Connection class is a handle that
>
>allows you to pass it around and internally it maintains the necessary 
>reference counting).
>
>> Closing connection due to Desired mechanism(s) not valid: True
>> (supported: EXTERNAL) (qpid/client/ConnectionHandler.cpp:260)
>> Exception constructed: Desired mechanism(s) not valid: True
>(supported:
>> EXTERNAL) (qpid/client/ConnectionHandler.cpp:260)
>> Exception constructed: Desired mechanism(s) not valid: True
>(supported:
>> EXTERNAL) (qpid/client/ConnectionHandler.cpp:260)
>>
>>
>> What am I doing wrong? Would it help if I set the SASL mechanism like
>this:
>>
>> mConnection = new Connection(brokerUrl,
>> "{transport:ssl,sasl-mechanism:EXTERNAL}");
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
>For additional commands, e-mail: users-help@qpid.apache.org

Re: C++ messaging API: SASL mechanism not set correctly

Posted by Gordon Sim <gs...@redhat.com>.
On 08/26/2015 01:40 PM, Andreas Welchlin wrote:
> Hello,
>
> I tried to connect to a AMQP Broker via SSL using AMQP 0.10.
>
> I used C++ and the Qpid Messaging API version 0.28.
>
> It seems like I set the SASL mechanism in a wrong way.
>
> I tried the following:
>
> const char* QPID_OPTION_TRANSPORT = "transport";
> const char* QPID_OPTION_SASL_MECHANISMS = "sasl_mechanisms";
>
> mConnection = new Connection("amqp:ssl:<ipaddress>");
> mConnection->setOption(QPID_OPTION_SASL_MECHANISMS, "EXTERNAL");
> mConnection->setOption(QPID_OPTION_TRANSPORT, "ssl");
> mConnection->open();
>
>
> The logfile says:
>
> Starting connection, urls=[amqp:ssl:<ipaddress>]
> Trying to connect to amqp:ssl:<ipaddress>...
> Created IO thread: 0
> SslConnector created for 0-10
> Connecting: 90.162.253.101:10170
> RECV [[172.17.97.139:46893-<ipaddress>]]: INIT(0-10)
> Exception constructed: Desired mechanism(s) not valid: True (supported:
> EXTERNAL) (qpid/client/ConnectionHandler.cpp:260)

The problem here seems to be that the desired mechanism is somehow being 
treated as a boolean, which is converted to "True" when converting to a 
string.

I can't seem to reproduce this using the code you have above, even 
against 0.28. What compiler are you using?

(One unrelated point is that you don't need to use new and explicitly 
have a pointer to the connection. The Connection class is a handle that 
allows you to pass it around and internally it maintains the necessary 
reference counting).

> Closing connection due to Desired mechanism(s) not valid: True
> (supported: EXTERNAL) (qpid/client/ConnectionHandler.cpp:260)
> Exception constructed: Desired mechanism(s) not valid: True (supported:
> EXTERNAL) (qpid/client/ConnectionHandler.cpp:260)
> Exception constructed: Desired mechanism(s) not valid: True (supported:
> EXTERNAL) (qpid/client/ConnectionHandler.cpp:260)
>
>
> What am I doing wrong? Would it help if I set the SASL mechanism like this:
>
> mConnection = new Connection(brokerUrl,
> "{transport:ssl,sasl-mechanism:EXTERNAL}");



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org