How can I encrypt (using SSL) Akka Remoting messages?
Asked Answered
M

2

6

I forked this simple server-client akka project: https://github.com/roclas/akka-irc which is an IRC-like chat and I'm trying to encode messages.

In my master branch, if I start a server (sbt run and then select option 2) and then a client (sbt run and then select option 1), if I write something in the client, the message is correctly sent to the server.

If I start wireshark and listen to the messages that meet these conditions: tcp.port==1099 and tcp.len>200

I can read the messages in plain text.

How could I encode them using SSL? You can see what I am trying to do by modifying the src/main/resources/application.conf file in the develop branch What would I have to modify? How should my src/main/resources/application.conf file look like?

Thank you

Muhammadan answered 20/2, 2015 at 10:37 Comment(0)
E
11

You should enable SSL at yout custom .conf file with:

akka {
  actor {
    provider = "akka.remote.RemoteActorRefProvider"
  }
  remote {
    enabled-transports = ["akka.remote.netty.ssl"]
    netty.ssl{
      enable-ssl = true
      security {
        key-store = "path-to-your-keystore"
        key-store-password = "your-keystore's-password"
        key-password = "your-key's-password"
        trust-store = "path-to-your-truststore"
        trust-store-password = "your-trust-store's-password"
        protocol = "TLSv1"
        random-number-generator = "AES128CounterSecureRNG"
        enabled-algorithms = ["TLS_RSA_WITH_AES_128_CBC_SHA"]
      }
    }
  }
}

And don't forget to change your actor path's prefix to:

akka.ssl.tcp://YourActorSystemName@ip:port:/...
Enscroll answered 20/2, 2015 at 12:43 Comment(1)
Take a look at these changes: github.com/roclas/akka-irc/tree/feat/ssl/src/main/resources (these four files were everything we needed to change)Muhammadan
M
1

In addition to what J.Santos said, I had forgotten to create these two files:

trust-store = "path-to-your-truststore"
trust-store-password = "your-trust-store's-password"

that I changed by:

key-store = "src/main/resources/keystore"
trust-store = "src/main/resources/truststore"

in my ./src/main/resources/common.conf

as J.Santos reminded me after looking at my project.

Thank you very much!!

Muhammadan answered 20/2, 2015 at 13:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.