ambari-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (AMBARI-22667) Use internal LDAP configuration values rather than ambari.properties values when accessing the configured LDAP server
Date Wed, 10 Jan 2018 08:50:03 GMT

    [ https://issues.apache.org/jira/browse/AMBARI-22667?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16319911#comment-16319911
] 

ASF GitHub Bot commented on AMBARI-22667:
-----------------------------------------

smolnar82 commented on a change in pull request #77: [AMBARI-22667] Use internal LDAP configuration
values rather than ambari.properties
URL: https://github.com/apache/ambari/pull/77#discussion_r160617955
 
 

 ##########
 File path: ambari-server/src/main/java/org/apache/ambari/server/utils/PasswordUtils.java
 ##########
 @@ -0,0 +1,137 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.server.utils;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.Charset;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
+import org.apache.ambari.server.AmbariException;
+import org.apache.ambari.server.configuration.Configuration;
+import org.apache.ambari.server.security.encryption.CredentialProvider;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.inject.Inject;
+
+/**
+ * Utility class to read passwords from files or the Credential Store
+ */
+public class PasswordUtils {
+
+  private static final Logger LOG = LoggerFactory.getLogger(PasswordUtils.class);
+  private static final Lock LOCK = new ReentrantLock();
+  private static final PasswordUtils INSTANCE = new PasswordUtils();
+
+  /**
+   * The constructor we need for creating a singleton instance
+   */
+  private PasswordUtils() {
+  }
+
+  @Inject
+  private static Configuration configuration;
+
+  private volatile CredentialProvider credentialProvider = null;
+
+  public static PasswordUtils getInstance() {
+    return INSTANCE;
+  }
+
+  public String readPassword(String passwordProperty, String defaultPassword) {
+    if (StringUtils.isNotBlank(passwordProperty)) {
+      if (CredentialProvider.isAliasString(passwordProperty)) {
+        return readPasswordFromStore(passwordProperty);
+      } else {
+        return readPasswordFromFile(passwordProperty, defaultPassword);
+      }
+    }
+    return defaultPassword;
+  }
+
+  public String readPasswordFromFile(String filePath, String defaultPassword) {
 
 Review comment:
   Generally I agree...
   However this is out of scope of this taks. Let me create a new JIRA to cover this topic.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> Use internal LDAP configuration values rather than ambari.properties values when accessing
the configured LDAP server
> ---------------------------------------------------------------------------------------------------------------------
>
>                 Key: AMBARI-22667
>                 URL: https://issues.apache.org/jira/browse/AMBARI-22667
>             Project: Ambari
>          Issue Type: Task
>          Components: ambari-server
>    Affects Versions: 3.0.0
>            Reporter: Sandor Molnar
>            Assignee: Sandor Molnar
>            Priority: Critical
>              Labels: ldap
>             Fix For: 3.0.0
>
>
> Use internal LDAP configuration values rather than ambari.properties values when accessing
the configured LDAP server for LDAP sync and authentication. 
> * Deprecate {{setup-ldap}} from the {{ambari-server}} script.  
> ** Rather then perform any operations, alert user to configure LDAP integration from
the Ambari UI
> * Lookup LDAP-specific properties from the Ambari configuration data under the "ldap-configuration"
category.
> * Remove relevant properties from {{org.apache.ambari.server.configuration.Configuration}}
> ** ambari.ldap.isConfigured
> ** authentication.ldap.useSSL
> ** authentication.ldap.primaryUrl
> ** authentication.ldap.secondaryUrl
> ** authentication.ldap.baseDn
> ** authentication.ldap.bindAnonymously
> ** authentication.ldap.managerDn
> ** authentication.ldap.managerPassword
> ** authentication.ldap.dnAttribute
> ** authentication.ldap.usernameAttribute
> ** authentication.ldap.username.forceLowercase
> ** authentication.ldap.userBase
> ** authentication.ldap.userObjectClass
> ** authentication.ldap.groupBase
> ** authentication.ldap.groupObjectClass
> ** authentication.ldap.groupNamingAttr
> ** authentication.ldap.groupMembershipAttr
> ** authorization.ldap.adminGroupMappingRules
> ** authentication.ldap.userSearchFilter
> ** authentication.ldap.alternateUserSearchEnabled
> ** authentication.ldap.alternateUserSearchFilter
> ** authorization.ldap.groupSearchFilter
> ** authentication.ldap.referral
> ** authentication.ldap.pagination.enabled
> ** authentication.ldap.sync.userMemberReplacePattern
> ** authentication.ldap.sync.groupMemberReplacePattern
> ** authentication.ldap.sync.userMemberFilter
> ** authentication.ldap.sync.groupMemberFilter
> ** ldap.sync.username.collision.behavior
>  



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message