How does zeromq work together with SSL?
Asked Answered
K

3

20

I am considerung to use zeromq as messaging layer between my applications. At least in some cases I want the communication to be secure and I am thinking about SSL.

Is there some standard way how to ssl-enable zeromq? As far as I understand it doesn't support it out of the box.

It would be nice if I just had a parameter when connnecting to a socket (bool: useSsl) :)

Any ideas?

Khorma answered 22/3, 2011 at 12:45 Comment(0)
L
7

Understanding that this is not really an answer to your question, I'm going to be encrypting the messages directly with RSA, before sending them with 0mq.

In the absence of a more integrated encryption method that is fully tested and implemented in my platform of choice, that's what I'm going with. 0mq just recently released version 4, which has encryption baked in, but it's still considered experimental and isn't fully supported by the language bindings.

Encrypting the message, rather than the connection, seems to provide the simplest upgrade path, and the difference for our purposes are pretty much just semantics given how we'd have to implement encryption currently, today.

Edit: I know more about encryption now than I did when I wrote this, RSA is not an appropriate choice for encrypting message data. Use AES, either with manually sharing keys (this is our approach for the short term) or implementing a key sharing scheme as in Jim Miller's answer... but beware if you take the latter approach, designing and implementing a key-sharing scheme securely is hard. Way harder than you'd think. You can implement SSL/TLS directly (using message BIOs), and others have done so, it's also not simple but at least know that the SSL scheme is industry standard and therefore meets a minimum security requirement.

In short, before the Elliptic Curve crypto baked into ZMQ 4 is considered reliable and becomes standard, the "accepted solution" would be to implement SSL/TLS over the connection manually, and failing that, use AES 128 or 256 with a secure key sharing mechanism (key sharing is where RSA would appropriately be used).

Lucchesi answered 7/11, 2013 at 17:35 Comment(1)
Since this just got an upvote, I updated my answer to reflect what I've learned since I originally wrote it.Lucchesi
A
5

We are currently implementing a pre-shared key solution using 0mq that implements a key exchange protocol based loosely on TLS/SSL.

Essentially, we have a data aggregator service that publishes encrypted state of health data over a multicast 0mq publisher. A symmetric key is used (AES128) to encrypt the data and can be retrieved from a second service running as a simpler request/response model over 0mq.

To retrieve the symmetric key (PSK), we are implementing the following protocol:

  • Client connects
  • Server sends its certificate
  • Client verifies server certificate against a CA chain of trust
  • Client sends its certificate
  • Server verifies client certificate against its CA chain
  • Server encrypts PSK using client public key
  • Server sends encrypted PSK to client
  • Client decrypts PSK

Once a client has the PSK, it can decrypt the messages retrieved over multicast.

We are also looking at implementing a session expire algorithm that uses two enveloped keys in the multicast service. One key is the current session key, and the second is the old, expiring key. That way, a client has a little more time to retrieve the new key without having to buffer encrypted messages before retrieving the new key.

Affliction answered 25/11, 2011 at 18:31 Comment(0)
A
3

According to zeromq.org, it's not supported yet but they are looking into it. It looks like it's suggested as a project for Google Summer of Code.

Antarctic answered 23/3, 2011 at 3:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.