rabbitmq / rabbitmq-web-stomp

Provides support for STOMP over WebSockets
Other
89 stars 26 forks source link

IP/bind parameter in config not working #68

Closed smeinecke closed 7 years ago

smeinecke commented 7 years ago

I'd like to bind the stomp plugin to a specific IP instead of allowing everyone and everything to connect to the service:

[
{rabbitmq_web_stomp, [
  {
      tcp_config, [{ port, 12345 },
                   { ip, "127.0.0.1" }]
  }]}
].

But somehow this doesn't work:

=CRASH REPORT==== 9-Mar-2017::13:40:45 ===
  crasher:
    initial call: supervisor:ranch_acceptors_sup/1
    pid: <0.336.0>
    registered_name: []
    exception exit: badarg
      in function  gen_server:init_it/6 (gen_server.erl, line 352)
    ancestors: [<0.334.0>,ranch_sup,<0.73.0>]
    messages: []
    links: [<0.334.0>]
    dictionary: []
    trap_exit: true
    status: running
    heap_size: 376
    stack_size: 27
    reductions: 440
  neighbours:

=SUPERVISOR REPORT==== 9-Mar-2017::13:40:45 ===
     Supervisor: {<0.334.0>,ranch_listener_sup}
     Context:    start_error
     Reason:     badarg
     Offender:   [{pid,undefined},
                  {id,ranch_acceptors_sup},
                  {mfargs,
                      {ranch_acceptors_sup,start_link,
                          [http,10,ranch_tcp,
                           [{port,15674},{port,12345},{ip,"127.0.0.1"}]]}},
                  {restart_type,permanent},
                  {shutdown,infinity},
                  {child_type,supervisor}]

=INFO REPORT==== 9-Mar-2017::13:40:45 ===
rabbit_web_stomp: listening for HTTP connections on 0.0.0.0:15674

But the argument "ip" is defined in the schema https://github.com/rabbitmq/rabbitmq-web-stomp/blob/master/priv/schema/rabbitmq_web_stomp.schema#L17

Anything wrong with that?

As far as I understood the source the "0.0.0.0" is even hardcoded for the log line, right?

michaelklishin commented 7 years ago

Thank you for your time.

Team RabbitMQ uses GitHub issues for specific actionable items engineers can work on. This assumes we have a certain amount of information to work with. Questions, investigations, root cause analysis, discussions for potential features are all considered to be mailing list material by our team. When/if we have enough details and evidence we'd be happy to file a new issue.

Please post this to rabbitmq-users. Thank you.

michaelklishin commented 7 years ago

You haven't mentioned what version of RabbitMQ is used. The schema you are looking at is for the new config format in 3.7.0 and you don't use it.

No value is hardcoded in the log file. By default RabbitMQ listeners bind to all interfaces.

This looks like the same issues as in this thread. Switch to the tuple format for IP addresses ({127, 0, 0, 1}) and see if that helps.

michaelklishin commented 7 years ago

Some digging suggests that rabbitmq_web_stomp.tcp_config is only used by the deprecated SockJS (WebSocket emulation) endpoint. @essen is my understanding correct?

smeinecke commented 7 years ago

You're right - I am sorry, I missed that. I am using RabbitMQ 3.6.6 and yes, { 127, 0, 0, 1 } is working fine. Only in log it is still somehow written as

=INFO REPORT==== 9-Mar-2017::13:59:10 ===
rabbit_web_stomp: listening for HTTP connections on 0.0.0.0:15674