cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tylerho...@apache.org
Subject [1/2] cassandra git commit: Backport CASSANDRA-8085 to cassandra-2.0
Date Thu, 26 Mar 2015 18:23:21 GMT
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.1 14327e4b9 -> 93156d761


Backport CASSANDRA-8085 to cassandra-2.0


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/1b1acae9
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/1b1acae9
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/1b1acae9

Branch: refs/heads/cassandra-2.1
Commit: 1b1acae9afbd6faf2f628d5ae7ba0763aaac1e86
Parents: 9625910
Author: Tyler Hobbs <tyler@datastax.com>
Authored: Thu Mar 26 13:22:09 2015 -0500
Committer: Tyler Hobbs <tyler@datastax.com>
Committed: Thu Mar 26 13:22:09 2015 -0500

----------------------------------------------------------------------
 CHANGES.txt                                          |  1 +
 .../apache/cassandra/auth/PasswordAuthenticator.java | 15 +++++++++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/1b1acae9/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 293dc55..adc0d59 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.0.14:
+ * Make PasswordAuthenticator number of hashing rounds configurable (CASSANDRA-8085)
  * Lower logging level from ERROR to DEBUG when a scheduled schema pull
    cannot be completed due to a node being down (CASSANDRA-9032)
  * Fix MOVED_NODE client event (CASSANDRA-8516)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/1b1acae9/src/java/org/apache/cassandra/auth/PasswordAuthenticator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/auth/PasswordAuthenticator.java b/src/java/org/apache/cassandra/auth/PasswordAuthenticator.java
index e4c00b7..3c6d1af 100644
--- a/src/java/org/apache/cassandra/auth/PasswordAuthenticator.java
+++ b/src/java/org/apache/cassandra/auth/PasswordAuthenticator.java
@@ -53,8 +53,19 @@ public class PasswordAuthenticator implements ISaslAwareAuthenticator
 {
     private static final Logger logger = LoggerFactory.getLogger(PasswordAuthenticator.class);
 
-    // 2 ** GENSALT_LOG2_ROUNS rounds of hashing will be performed.
-    private static final int GENSALT_LOG2_ROUNDS = 10;
+    // 2 ** GENSALT_LOG2_ROUNDS rounds of hashing will be performed.
+    private static final String GENSALT_LOG2_ROUNDS_PROPERTY = "cassandra.auth_bcrypt_gensalt_log2_rounds";
+    private static final int GENSALT_LOG2_ROUNDS = getGensaltLogRounds();
+
+    static int getGensaltLogRounds()
+    {
+        int rounds = Integer.getInteger(GENSALT_LOG2_ROUNDS_PROPERTY, 10);
+        if (rounds < 4 || rounds > 31)
+            throw new RuntimeException(new ConfigurationException(String.format("Bad value
for system property -D%s. " +
+                                                                                "Please use
a value 4 and 31",
+                                                                                GENSALT_LOG2_ROUNDS_PROPERTY)));
+        return rounds;
+    }
 
     // name of the hash column.
     private static final String SALTED_HASH = "salted_hash";


Mime
View raw message