[rabbitmq-discuss] SSL connection - ASN1 error
Skorepa, Michal
Michal.Skorepa at Honeywell.com
Fri Nov 22 09:53:39 GMT 2013
Hello Tim,
Yes, I am sure it is pointing to the correct certificates. The swim_cm_connector module is really simple.
Here is a relevant fragment of the code:
------------------------------------------------------------------------------------------------------------------
-module(swim_cm_connector).
-include_lib("amqp_client/include/amqp_client.hrl").
-compile([{parse_transform, lager_transform}]).
-behaviour(gen_server).
.
.
.
handle_info({connect, CoS}, State) ->
lager:notice("Connector connecting on CoS ~p. Connector PID: ~p", [CoS, self()]),
ConnectionParamsBasic = #amqp_params_network{host = swim_cm_tools:set_broker(),
port = swim_cm_tools:set_port(),
virtual_host = swim_cm_tools:set_vhost(),
username = swim_cm_tools:set_username(),
password = swim_cm_tools:set_password(),
heartbeat = swim_cm_tools:set_heartbeat(),
socket_options = [{tos, swim_cm_tools:set_tos(CoS)}]},
lager:notice("SSL: ~p", [application:get_env(ssl)]),
case application:get_env(ssl) of
{ok, true} ->
lager:notice("SSL enabled. Setting SSL parameters."),
ConnectionParams = ConnectionParamsBasic#amqp_params_network{ssl_options = [{cacertfile, swim_cm_tools:set_cacertfile()},
{certfile, swim_cm_tools:set_certfile()},
{keyfile, swim_cm_tools:set_key()},
{verify, swim_cm_tools:set_verify()},
{fail_if_no_peer_cert, swim_cm_tools:set_no_peer_cert()}]};
_ ->
lager:notice("SSL disabled. Setting basic parameters."),
ConnectionParams = ConnectionParamsBasic
end,
lager:debug("Connection parameters: ~p.", [ConnectionParams]),
try amqp_connection:start(ConnectionParams) of
{ok, Conn_ID} ->
lager:notice("Connection setup for CoS ~p successful. Target broker: ~p", [CoS, ConnectionParams#amqp_params_network.host]),
gen_server:cast({global, swim_conn_serv}, {connected, CoS, Conn_ID}),
lager:info("Work is done, shutting down the connector for CoS ~p.", [CoS]),
{stop, normal, State};
{error, Error} ->
lager:error("Connection setup error: ~p", [Error]),
case application:get_env(reconnect_interval) of
{ok, Timeout} ->
ok;
undefined ->
Timeout = 5000
end,
lager:info("Connection setup ERROR. Repeating connection setup after: ~p seconds...", [Timeout / 1000]),
{noreply, {connect, CoS}, Timeout}
catch
Exception:Reason ->
lager:error("Exception caught in connection setup for CoS ~p.~n Exception: ~p~n Reason: ~p", [CoS, Exception, Reason]),
{stop, exception, State}
end;
------------------------------------------------------------------------------------------------------------------
I am sure the code is correct. It runs perfectly fine on Debian systems. But is throws the error when I run it on a custom built Openembedded system (Yocto/Poky project) which is hosted on a Gumstix platform. There might be maybe something missing in the system or something might not be cross-compiled correctly but I have no idea what it might be or how to test it.
Thank you for any help!
Michal
-----Original Message-----
From: rabbitmq-discuss-bounces at lists.rabbitmq.com [mailto:rabbitmq-discuss-bounces at lists.rabbitmq.com] On Behalf Of Tim Watson
Sent: 18. listopadu 2013 11:33
To: Discussions about RabbitMQ
Subject: Re: [rabbitmq-discuss] SSL connection - ASN1 error
Hi Michal,
What does this swim_cm_connector module look like? Are you sure it's pointing to the correct certificates when establishing the connection?
Cheers,
Tim
_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss at lists.rabbitmq.com
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
More information about the rabbitmq-discuss
mailing list