Tom Atwood
Tom Atwood

Reputation: 478

Setting up inter-node encryption in Cassandra

I am new to Cassandra and looking to setup internode encryption in Cassandra 1.2.8.

I have successfully created a keypair for the keystore and truststore following the steps outlined here: http://docs.oracle.com/javase/6/docs/technotes/guides/security/jsse/JSSERefGuide.html#CreateKeystore

In the Cassandra.yaml file, I have adjusted the server encryption options to the following:

server_encryption_options:
    internode_encryption: all
    keystore: conf/keystore
    keystore_password: password
    truststore: conf/truststore
    truststore_password: password

However, when I start the Cassandra server, I receive the following error:

ERROR 18:49:20,883 Fatal configuration error
org.apache.cassandra.exceptions.ConfigurationException: Unable to create ssl socket
        at org.apache.cassandra.net.MessagingService.getServerSocket(MessagingService.java:410)
        at org.apache.cassandra.net.MessagingService.listen(MessagingService.java:390)
        at org.apache.cassandra.service.StorageService.joinTokenRing(StorageService.java:589)
        at org.apache.cassandra.service.StorageService.initServer(StorageService.java:554)
        at org.apache.cassandra.service.StorageService.initServer(StorageService.java:451)
        at org.apache.cassandra.service.CassandraDaemon.setup(CassandraDaemon.java:348)
        at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:447)
        at org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:490)
Caused by: java.io.IOException: Error creating the initializing the SSL Context
        at org.apache.cassandra.security.SSLFactory.createSSLContext(SSLFactory.java:124)
        at org.apache.cassandra.security.SSLFactory.getServerSocket(SSLFactory.java:53)
        at org.apache.cassandra.net.MessagingService.getServerSocket(MessagingService.java:406)
        ... 7 more
Caused by: java.io.FileNotFoundException: conf\truststore\dev (The system cannot find the path specified)
        at java.io.FileInputStream.open(Native Method)
        at java.io.FileInputStream.<init>(Unknown Source)
        at java.io.FileInputStream.<init>(Unknown Source)
        at org.apache.cassandra.security.SSLFactory.createSSLContext(SSLFactory.java:105)
        ... 9 more
Unable to create ssl socket
Fatal configuration error; unable to start server.  See log for stacktrace.
ERROR 18:49:20,887 Exception in thread Thread[StorageServiceShutdownHook,5,main]
java.lang.NullPointerException
        at org.apache.cassandra.service.StorageService.stopRPCServer(StorageService.java:321)
        at org.apache.cassandra.service.StorageService.shutdownClientServers(StorageService.java:370)
        at org.apache.cassandra.service.StorageService.access$000(StorageService.java:88)
        at org.apache.cassandra.service.StorageService$1.runMayThrow(StorageService.java:519)
        at org.apache.cassandra.utils.WrappedRunnable.run(WrappedRunnable.java:28)
        at java.lang.Thread.run(Unknown Source)

Please note the server runs without issues if the server encryption options is set back to none. Any thoughts/guidance would be appreciated.

Upvotes: 3

Views: 3032

Answers (1)

Lyuben Todorov
Lyuben Todorov

Reputation: 14173

Read the exception carefully:

Caused by: java.io.FileNotFoundException: conf\truststore\dev
(The system cannot find the path specified)

You've created the key/trust stores but you haven't pointed cassandra to them. In cassandra.yaml you need to enable SSL but you also need to specify the path to these two files. E.g:

server_encryption_options:
    internode_encryption: all
    keystore: C:\some\location
    keystore_password: password
    truststore: C:\some\other\location
    truststore_password: password

Also remember to supply the key/trust store passwords instead of the example in cassandra.yaml.

Upvotes: 4

Related Questions