Skip to content

SSL connection to stomp server #5

Description

@rosacris

Hi,

in our project we are using Stompex to connect to ActiveMQ and so far it works wonderfully.
Howerver, when deploying the app in the production environment, we discovered that ActiveMQ only accept SSL connections.
Is there a way to enable SSL to Stompex?

Thanks!

Activity

  1. pareeohnos commented on Apr 10, 2017

    @pareeohnos
    Contributor

    Hey, sorry for the delay, I was on annual leave. There isn't currently built in support for this, but definitely something I'd be interested in getting added.

    I'll have a look around at the various options, but are there any specific ones that your ActiveMQ server requires that you'll need to be configuring?

  2. rosacris commented on Apr 10, 2017

    @rosacris
    Author

    Hi,

    no problem for the delay, lucky you!
    We found a workaround using a dirty hack. Basically, we've implemented a TCPWrapper module that dynamically delegates the :gen_tcp functions to :ssl module depending on a configuration variable.
    I do not like it much, but it was the fastest way.
    You can check my fork https://github.com/rosacris/Stompex/commits/master

    What I really do not like is the fact that Erlang exposes SSL support through an external app, instead of implementing it as an option to the :gen_tcp module. This makes building apps with SSL support more complex.

  3. pareeohnos commented on Apr 10, 2017

    @pareeohnos
    Contributor

    hm yeah it is a bit messy, not entirely sure why it's been done like that, but guessing they have their reasons. I imagine its related to the fact that the SSL module implements a cache for PEM files, but would've thought there was a better approach.

    I'll do some digging and see if there are any less hacky options but I imagine it's going to end up with some wrapper or logic to switch between the two, and it certainly looks like the ssl module only supports SSL connections, and gen_tcp only supports non SSL which is a shame.

  4. pareeohnos commented on Apr 12, 2017

    @pareeohnos
    Contributor

    OK so I've pushed a new branch ssl if you want to try it out. I've not updated the documentation on github just yet (although in the code it's updated) but to use it you can basically supply any option that the :ssl module accepts in erlang. For basic usage though, you should be able to use

    Stompex.connect(host, port, login, pass, headers, secure: true)
    

    And that SHOULD in theory work.

    If you could test it and report back that would be great, as I don't have an SSL server to test this out with, but the refactoring seems to be working fine with a non SSL server, so hopefully should work with SSL but who knows :)

  5. rosacris commented on Apr 12, 2017

    @rosacris
    Author
  6. pareeohnos commented on Jun 6, 2017

    @pareeohnos
    Contributor

    @rosacris did you get a chance to test this out?

  7. rosacris commented on Jun 6, 2017

    @rosacris
    Author
  8. pareeohnos commented on Jun 6, 2017

    @pareeohnos
    Contributor

    no problem. In terms of heartbeats, I assume you mean the sending of them from the client side? Something that needs to be added at some point :)

  9. rosacris commented on Jun 6, 2017

    @rosacris
    Author
  10. pareeohnos commented on Jun 6, 2017

    @pareeohnos
    Contributor

    ah ok, sorry about that. There's an open issue to add heartbeats that will hopefully be resolved at some point, but I didn't realise it was something that was needed by anyone at the time. Hopefully we can get this sorted for future users in a similar situation.

  11. shymega commented on Jun 8, 2017

    @shymega
    Contributor
  12. shymega commented on Jun 8, 2017

    @shymega
    Contributor
  13. rosacris commented on Jun 8, 2017

    @rosacris
    Author
  14. shymega commented on Jun 8, 2017

    @shymega
    Contributor
  15. pareeohnos commented on Jun 8, 2017

    @pareeohnos
    Contributor

    @rosacris not to worry. As @shymega said, different project with different goals :)

  16. rosacris commented on Jun 8, 2017

    @rosacris
    Author
  17. shymega commented on Jun 8, 2017

    @shymega
    Contributor

    @rosacris Yeah, I found that out pretty quickly. At the moment I'm using Emqttc in Erlang directly as an Erlang app, as I - for the life of me - can't figure out how to get a handle_info working.. :/

  18. rosacris commented on Jun 8, 2017

    @rosacris
    Author
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions