accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubb...@apache.org
Subject [accumulo] branch master updated: ACCUMULO-2907 Remove warning from initialize (#301)
Date Wed, 27 Sep 2017 21:10:29 GMT
This is an automated email from the ASF dual-hosted git repository.

ctubbsii pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/master by this push:
     new 4731ac8  ACCUMULO-2907 Remove warning from initialize (#301)
4731ac8 is described below

commit 4731ac80af1589bc0e3209f73d85e69ced8e254f
Author: Mark Owens <31573345+jmark99@users.noreply.github.com>
AuthorDate: Wed Sep 27 17:10:26 2017 -0400

    ACCUMULO-2907 Remove warning from initialize (#301)
    
    Updated console message in the getRootPassword method to remove unneeded warning about
the security setup.
    
    Modified getRootPassword method of Initialize.java to appropriately
    display an security warning message when asking for initial password
    setup. If the value of default value of instance.security.authentication
    property differs from the Site configured value then a warning is
    displayed indicating that the security setup may not be applicable.
---
 .../org/apache/accumulo/server/init/Initialize.java | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/server/base/src/main/java/org/apache/accumulo/server/init/Initialize.java b/server/base/src/main/java/org/apache/accumulo/server/init/Initialize.java
index 0abe4c8..e12f790 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/init/Initialize.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/init/Initialize.java
@@ -632,7 +632,7 @@ public class Initialize implements KeywordExecutable {
     String rootpass;
     String confirmpass;
     do {
-      rootpass = getConsoleReader().readLine("Enter initial password for " + rootUser + "
(this may not be applicable for your security setup): ", '*');
+      rootpass = getConsoleReader().readLine("Enter initial password for " + rootUser + getInitialPasswordWarning(),
'*');
       if (rootpass == null)
         System.exit(0);
       confirmpass = getConsoleReader().readLine("Confirm initial password for " + rootUser
+ ": ", '*');
@@ -644,6 +644,25 @@ public class Initialize implements KeywordExecutable {
     return rootpass.getBytes(UTF_8);
   }
 
+  /**
+   * Create warning message related to initial password, if appropriate.
+   *
+   * ACCUMULO-2907 Remove unnecessary security warning from console message unless its actually
appropriate.
+   * The warning message should only be displayed when the value of <code>instance.security.authenticator</code>
+   * differs between the SiteConfiguration and the DefaultConfiguration values.
+   *
+   * @return String containing warning portion of console message.
+   */
+  private String getInitialPasswordWarning() {
+    String optionalWarning;
+    Property authenticatorProperty = Property.INSTANCE_SECURITY_AUTHENTICATOR;
+    if (SiteConfiguration.getInstance().get(authenticatorProperty).equals(authenticatorProperty.getDefaultValue()))
+      optionalWarning = ": ";
+    else
+      optionalWarning = " (this may not be applicable for your security setup): ";
+    return optionalWarning;
+  }
+
   private static void initSecurity(AccumuloServerContext context, Opts opts, String iid,
String rootUser) throws AccumuloSecurityException,
       ThriftSecurityException, IOException {
     AuditedSecurityOperation.getInstance(context, true).initializeSecurity(context.rpcCreds(),
rootUser, opts.rootpass);

-- 
To stop receiving notification emails like this one, please contact
['"commits@accumulo.apache.org" <commits@accumulo.apache.org>'].

Mime
View raw message