Cannot connect java client to cassandra with password authentication enabled - authentication

I have a default install of Datastax enterprise on my macbook. I was able to create my keyspace and setup all my applications including using solr.
I am trying to develop a set of steps to turn on password authentication for our dev cluster.
Thus far I have updated /usr/local/dse/resources/cassandra/conf/cassandra.yaml and changed the following properties:
authenticator: PasswordAuthenticator
authorizer: CassandraAuthorizer
I restarted the node and could login and query my keyspace using cqlsh:
cqlsh -u cassandra -p cassandra
At this point I tried setting the Credentials on the Session builder:
Host is: cassandra.host=localhost
Session session = keyspaceToSessionMap.get(keyspace);
if( session == null){
Cluster cluster = Cluster.builder().addContactPoints(hosts)
.withCredentials(username, password)
//.withSSL()
.build();
session = cluster.connect(keyspace);
keyspaceToSessionMap.put(keyspace,session);
}
I could not successfully connect however. So I added a new user and was able to again login via cqlsh but still cannot get the Java driver to connect.
cqlsh -u username -p password
Connected to LocalCluster at 127.0.0.1:9042.
[cqlsh 5.0.1 | Cassandra 2.1.8.689 | DSE 4.7.3 | CQL spec 3.2.0 | Native protocol v3]
I am using 'com.datastax.cassandra:cassandra-driver-dse:2.1.9' via gradle for the driver.
I always get the following stack trace and through debugging can see the username and password are set properly:
Caused by: com.datastax.driver.core.exceptions.AuthenticationException: Authentication error on host localhost/127.0.0.1:9042: Username and/or password are incorrect
at com.datastax.driver.core.Connection$8.apply(Connection.java:376)
at com.datastax.driver.core.Connection$8.apply(Connection.java:346)
This seems like it should be simple but I am stumped.
My dependencies graph in relation to cassandra driver contains the following:
+--- com.datastax.cassandra:cassandra-driver-dse:2.1.9
| \--- com.datastax.cassandra:cassandra-driver-core:2.1.9 -> 2.1.8
| +--- io.netty:netty-handler:4.0.27.Final
| | +--- io.netty:netty-buffer:4.0.27.Final
| | | \--- io.netty:netty-common:4.0.27.Final
| | +--- io.netty:netty-transport:4.0.27.Final
| | | \--- io.netty:netty-buffer:4.0.27.Final (*)
| | \--- io.netty:netty-codec:4.0.27.Final
| | \--- io.netty:netty-transport:4.0.27.Final (*)
| +--- com.google.guava:guava:14.0.1 -> 18.0
| \--- com.codahale.metrics:metrics-core:3.0.2
| \--- org.slf4j:slf4j-api:1.7.5 -> 1.7.12
I created the following test which passes.
Cluster cluster = Cluster.builder().addContactPoints("localhost")
.withCredentials("username", "password")
//.withSSL()
.build();
Session session = cluster.connect("keyspace");
Assert.assertNotNull(session);
The only difference I can tell between the two is that "localhost" is now a constant rather than an array of size 1.

Found I had a trailing whitespace and that was the root cause.
Cluster cluster = Cluster.builder().addContactPoints(hosts)
.withCredentials(username.trim(), password.trim())
//.withSSL()
.build();

Related

Camel FTPS Connection Login Failure

I have IIS FTPS Server setup and am trying to connect from a Camel route. But I'm getting the error:
22 Sep 2019 08:59:51,650 | WARN | Camel (Test) thread #202 -
ftps://test#test1834:21/BO/Salary | FtpConsumer | 248 -
org.apache.camel.camel-core - 2.17.0.redhat-630347 | Cannot
connect/login to: ftps://test#test1834:21. Will skip this poll.
I can connect via FileZilla client and perform any read/write operation.
Credentials have been verified.
Camel-Core version 2.17.0
Is anyone familiar with this issue?
this flag "isImplicit=true" is no longer valid for Camel version 3.7.0
The new flag is "implicit=true"
Take a look at the endpoint configuration, you probably should set the security mode isImplicit=true

Connecting to Kerberized solr on cloudera from karaf

I'm trying to connect to Solr (non cloud) which has Kerberos enabled from my SolrJ application running in Karaf container.
With Kerberos disabled, I'm able to connect fine.
With Kerberos enabled, I'm able to connect outside of Karaf by running a simple SolrClient class.
But its not working from within karaf.
Code:
System.setProperty("java.security.auth.login.config", "<path to jaas.conf file>");
String urlString = "http://<IP>:8983/solr/test";
SolrServer server = new HttpSolrServer(urlString);
QueryResponse sresponse = server.query( squery );
Exception in Karaf on trying to query:
2016-12-15 15:02:17,969 | WARN | l Console Thread | RequestTargetAuthentication | ? ? | 271 - wrap_mvn_org.apache.httpcomponents_httpclient_4.3.2 - 0.0.0 | NEGOTIATE authentication error: No valid credentials p
rovided (Mechanism level: No valid credentials provided (Mechanism level: Invalid option setting in ticket request. (101)))
2016-12-15 15:03:10,731 | ERROR | l Console Thread | Error:org.apache.solr.client.solrj.impl.HttpSolrServer$RemoteSol
rException: Expected mime type application/octet-stream but got text/html. Apache Tomcat/6.0.44 - Error report HTTP Status 401 - Authentication requiredtype Status reportmessage Authentication requireddescription This request requires HTTP authentication.Apache Tomcat/6.0.44

Jitsi conversation history location

I am customizing Jitsi and I just want to ask if Jitsi stores conversation locally
or on server ?
If it stores locally than what is its location ? I have searched a lot but I am helpless. Please Help !
If you have Jitsi, the Java XMPP client, then your message history should be stored locally in an XML file if you haven't disabled the logging. The exact location depends on your OS. I would assume the default Java application storage locations like
Windows: %AppData%\Jitsi\history_ver1.0\messages
Mac: ~/Library/Application Support/Jitsi/history_ver1.0/messages
Linux: ~/.jitsi/history_ver1.0/messages
You can add a log statement to see the document that is being written and specifically to which file in the HistoryImpl source.
If you are using Jitsi-Meet, the browser based client, then your message history is not stored permanently by default as far as I know.
No matter which client you are using, on the server, your messages may or may not be stored. The following assumes you are connecting to an XMPP server. If you are using a XMPP server that chooses to store your messages through the XEP Message Archive Management, it will be stored. In that case it will be in the storage backend of the XMPP server, most likely a SQLite/MySQL/Postgres database. If you've used the Debian quick install, by default, Jitsi-Meet installs the XMPP server, Prosody, and routes all your chats there. Prosody supports MAM but it isn't on by default as of version 0.9 (it requires version 0.10+ according to their xeplist).
Note network architecture looks like follows. At any point if you are logging messages, then you could potentially find/reconstruct your message history.
Client (Jitsi or Jitsi-Meet browser frontend)
| |
| |
v |
443 |
+-------+ |
| | |
| NginX | |
| | |
+--+-+--+ |
| | |
+------------+ | | +--------------+ |
| | | | | | |
| jitsi-meet +<---+ +--->+ prosody/xmpp | |
| |files 5280 | | |
+------------+ +--------------+ v
5222,5347^ ^5347 4443
+--------+ | | +-------------+
| | | | | |
| jicofo +----^ ^----+ videobridge |
| | | |
+--------+ +-------------+
Diagram taken and slightly modified from the manual-install.md file in jitsi-meet's repo.

Apache ActiveMQ 5.10 startup issue

I downloaded Activemq_5.10 and configured using the command "activemq start" from the bin folder.
It is not moving after the last line and is not properly started, because of which the console is not up.
Extract of the log is:
| INFO | For help or more information please see: http://activemq.apache.org | org.apache.activemq.broker.BrokerService | main
| INFO | ActiveMQ WebConsole available at http://0.0.0.0:8161/ | org.apache.activemq.web.WebConsoleStarter | main
| INFO | Initializing Spring FrameworkServlet 'dispatcher' | /admin | main
| INFO | jolokia-agent: No access restrictor found at classpath:/jolokia-access.xml, access to all MBeans is allowed | /api | main
That is the last line logged, ActiveMQ should be started, eg when I do on ActiveMQ 5.10.0
bin/activemq console
I see
INFO | Apache ActiveMQ 5.10.0 (localhost, ID:davsclaus.air-62275-1403850867605-0:1) started
INFO | For help or more information please see: http://activemq.apache.org
WARN | Store limit is 102400 mb (current store usage is 0 mb). The data directory: /opt/apache-activemq-5.10.0/data/kahadb only has 74949 mb of usable space - resetting to maximum available disk space: 74949 mb
INFO | ActiveMQ WebConsole available at http://0.0.0.0:8161/
INFO | Initializing Spring FrameworkServlet 'dispatcher'
INFO | jolokia-agent: No access restrictor found at classpath:/jolokia-access.xml, access to all MBeans is allowed
And I can see the old web console at
http://localhost:8161/
And I can connect to the broker remotely using hawtio as documented here:
http://sensatic.net/activemq/activemq-and-hawtio.html
So I think your ActiveMQ is running as expected.

activeMQ master/slave SASL configuration

I have 2 servers running activeMQ, one is master, the other is slave, via zookeeper.
I run the following:
Downloads\apache-activemq-5.9.1-bin\apache-activemq-5.9.1\bin\win64>activemq.bat
some WARN here:
jvm 1 | WARN | SASL configuration failed: javax.security.auth.login.LoginException: No JAAS configuration section named 'Client' was found in specified JAAS configuration file: '../../conf/login.config'. Will continue connection to Zookeeper server without SASL authentication, if Zookeeper server allows it.
jvm 1 | INFO | Opening socket connection to server "server1"
jvm 1 | WARN | unprocessed event state: AuthFailed
jvm 1 | INFO | Socket connection established to blabla.local/10.112.0.17:2181, initiating session
jvm 1 | INFO | Session establishment complete on server blabla.local/10.112.0.17:2181, sessionid = 0x14651b3478a0005, negotiated timeout = 4000
My '../../conf/login.config' looks like :
activemq {
org.apache.activemq.jaas.PropertiesLoginModule required
org.apache.activemq.jaas.properties.user="users.properties"
org.apache.activemq.jaas.properties.group="groups.properties";
};
My "username" and "password" are configured in '../../conf/activemq.xml' via "simpleAuthenticationPlugin ", not in '../../conf/login.config'
anyone knows about the WARNING i have above?
Thanks
Make zookeeper client version the same with zookeeper server version:
zookeeper client jar location:
[ActiveMQ]/lib/optional/zookeeper.jar