Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 899
Carlos Avatar asked Feb 20 '15 10:02

Carlos


2 Answers

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:/...
like image 133
J.Santos Avatar answered Sep 30 '22 12:09

J.Santos


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!!

like image 38
Carlos Avatar answered Sep 30 '22 12:09

Carlos