ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aonis...@apache.org
Subject [2/2] ambari git commit: AMBARI-14363. Cannot save KDC admin creds (aonishuk)
Date Sun, 13 Dec 2015 20:53:48 GMT
AMBARI-14363. Cannot save KDC admin creds (aonishuk)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/2a26ccb7
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2a26ccb7
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2a26ccb7

Branch: refs/heads/branch-2.2
Commit: 2a26ccb7c7d366e7e79caf3a020075c47af09097
Parents: 3c35fc7
Author: Andrew Onishuk <aonishuk@hortonworks.com>
Authored: Sun Dec 13 22:53:40 2015 +0200
Committer: Andrew Onishuk <aonishuk@hortonworks.com>
Committed: Sun Dec 13 22:53:40 2015 +0200

----------------------------------------------------------------------
 .../security/encryption/CredentialStoreServiceImpl.java       | 7 ++++++-
 .../server/security/encryption/MasterKeyServiceImpl.java      | 4 +---
 ambari-server/src/main/python/ambari_server/setupSecurity.py  | 1 +
 3 files changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/2a26ccb7/ambari-server/src/main/java/org/apache/ambari/server/security/encryption/CredentialStoreServiceImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/security/encryption/CredentialStoreServiceImpl.java
b/ambari-server/src/main/java/org/apache/ambari/server/security/encryption/CredentialStoreServiceImpl.java
index fe14004..cb4a677 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/security/encryption/CredentialStoreServiceImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/security/encryption/CredentialStoreServiceImpl.java
@@ -65,7 +65,12 @@ public class CredentialStoreServiceImpl implements CredentialStoreService
{
 
       // If the MasterKeyService is initialized, assume that we should be initializing the
persistent
       // CredentialStore; else do not initialize it.
-      MasterKeyService masterKeyService = new MasterKeyServiceImpl(masterKeyLocation);
+      MasterKeyService masterKeyService = null;
+      if(masterKeyLocation.exists()) {
+        masterKeyService = new MasterKeyServiceImpl(masterKeyLocation);
+      } else {
+        masterKeyService = new MasterKeyServiceImpl();
+      }
       if (masterKeyService.isMasterKeyInitialized()) {
         try {
           initializePersistedCredentialStore(configuration.getMasterKeyStoreLocation(), masterKeyService);

http://git-wip-us.apache.org/repos/asf/ambari/blob/2a26ccb7/ambari-server/src/main/java/org/apache/ambari/server/security/encryption/MasterKeyServiceImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/security/encryption/MasterKeyServiceImpl.java
b/ambari-server/src/main/java/org/apache/ambari/server/security/encryption/MasterKeyServiceImpl.java
index 759fd8e..19056fa 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/security/encryption/MasterKeyServiceImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/security/encryption/MasterKeyServiceImpl.java
@@ -88,9 +88,7 @@ public class MasterKeyServiceImpl implements MasterKeyService {
    */
   public MasterKeyServiceImpl() {
     String key = readMasterKey();
-    if (key == null) {
-      throw new IllegalStateException("Cannot read master key from environment.");
-    } else {
+    if (key != null) {
       this.master = key.toCharArray();
     }
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/2a26ccb7/ambari-server/src/main/python/ambari_server/setupSecurity.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/python/ambari_server/setupSecurity.py b/ambari-server/src/main/python/ambari_server/setupSecurity.py
index 19febcf..cc17825 100644
--- a/ambari-server/src/main/python/ambari_server/setupSecurity.py
+++ b/ambari-server/src/main/python/ambari_server/setupSecurity.py
@@ -742,6 +742,7 @@ def generate_env(options, ambari_user, current_user):
       import pwd
 
       masterKey = get_original_master_key(properties)
+      environ[SECURITY_KEY_ENV_VAR_NAME] = masterKey
       tempDir = tempfile.gettempdir()
       tempFilePath = tempDir + os.sep + "masterkey"
       save_master_key(options, masterKey, tempFilePath, True)


Mime
View raw message