Search code examples
cassandrakerberosdatastax-java-driver

Configuration Error in Cassandra Kerberos Authentication with Java


I am trying to connect to Cassandra cluster through Kerberos ticket cache with following set of configs -

java -Dcassaandra.ip.address=<IPaddress> \
  -Djava.security.auth.login.config=kerb-client.conf \
  -Dsun.security.krb5.debug=true \
  -Djavax.security.auth.useSubjectCredsOnly=false \
  -Djava.security.krb5.conf=krb5.conf -jar test-kerberos.jar

kerb-client.conf: CassandraJavaClient { com.sun.security.auth.module.Krb5LoginModule required useTicketCache=true ticketCache=cacheFile principal="[email protected]"; };

I am getting following error -

Unexpected error during transport initialization (java.lang.SecurityException: java.io.IOException: Configuration Error:
        Line 3: expected [option value])
        at com.datastax.driver.core.Connection$2.apply(Connection.java:205)
        at com.datastax.driver.core.Connection$2.apply(Connection.java:191)

It seems like that there is some config missing but i am unable to identify the root cause. Please advise on the corrective steps.


Solution

  • The Java driver needs to have a custom authenticator configured in order to authenticate using Kerberos.

    Instaclustr has an open-source Kerberos authenticator for Cassandra that works with the Java driver. Details and code are available here:

    Cheers!