|
@@ -32,7 +32,7 @@ from ambari_commons.logging_utils import print_warning_msg, print_error_msg, pri
|
|
from ambari_commons.os_check import OSConst
|
|
from ambari_commons.os_check import OSConst
|
|
from ambari_commons.os_family_impl import OsFamilyFuncImpl, OsFamilyImpl
|
|
from ambari_commons.os_family_impl import OsFamilyFuncImpl, OsFamilyImpl
|
|
from ambari_commons.os_utils import is_root, set_file_permissions, \
|
|
from ambari_commons.os_utils import is_root, set_file_permissions, \
|
|
- run_os_command, search_file, is_valid_filepath
|
|
|
|
|
|
+ run_os_command, search_file, is_valid_filepath, change_owner
|
|
from ambari_server.serverConfiguration import configDefaults, \
|
|
from ambari_server.serverConfiguration import configDefaults, \
|
|
encrypt_password, find_jdk, find_properties_file, get_alias_string, get_ambari_properties, get_conf_dir, \
|
|
encrypt_password, find_jdk, find_properties_file, get_alias_string, get_ambari_properties, get_conf_dir, \
|
|
get_credential_store_location, get_full_ambari_classpath, get_is_persisted, get_is_secure, get_master_key_location, \
|
|
get_credential_store_location, get_full_ambari_classpath, get_is_persisted, get_is_secure, get_master_key_location, \
|
|
@@ -44,7 +44,8 @@ from ambari_server.serverConfiguration import configDefaults, \
|
|
LDAP_PRIMARY_URL_PROPERTY, SECURITY_IS_ENCRYPTION_ENABLED, SECURITY_KEY_ENV_VAR_NAME, SECURITY_KERBEROS_JASS_FILENAME, \
|
|
LDAP_PRIMARY_URL_PROPERTY, SECURITY_IS_ENCRYPTION_ENABLED, SECURITY_KEY_ENV_VAR_NAME, SECURITY_KERBEROS_JASS_FILENAME, \
|
|
SECURITY_PROVIDER_KEY_CMD, SECURITY_MASTER_KEY_FILENAME, SSL_TRUSTSTORE_PASSWORD_ALIAS, \
|
|
SECURITY_PROVIDER_KEY_CMD, SECURITY_MASTER_KEY_FILENAME, SSL_TRUSTSTORE_PASSWORD_ALIAS, \
|
|
SSL_TRUSTSTORE_PASSWORD_PROPERTY, SSL_TRUSTSTORE_PATH_PROPERTY, SSL_TRUSTSTORE_TYPE_PROPERTY, \
|
|
SSL_TRUSTSTORE_PASSWORD_PROPERTY, SSL_TRUSTSTORE_PATH_PROPERTY, SSL_TRUSTSTORE_TYPE_PROPERTY, \
|
|
- SSL_API, SSL_API_PORT, DEFAULT_SSL_API_PORT, CLIENT_API_PORT
|
|
|
|
|
|
+ SSL_API, SSL_API_PORT, DEFAULT_SSL_API_PORT, CLIENT_API_PORT, JDK_NAME_PROPERTY, JCE_NAME_PROPERTY, JAVA_HOME_PROPERTY, \
|
|
|
|
+ get_resources_location
|
|
from ambari_server.serverUtils import is_server_runing, get_ambari_server_api_base
|
|
from ambari_server.serverUtils import is_server_runing, get_ambari_server_api_base
|
|
from ambari_server.setupActions import SETUP_ACTION, LDAP_SETUP_ACTION
|
|
from ambari_server.setupActions import SETUP_ACTION, LDAP_SETUP_ACTION
|
|
from ambari_server.userInput import get_validated_string_input, get_prompt_default, read_password, get_YN_input
|
|
from ambari_server.userInput import get_validated_string_input, get_prompt_default, read_password, get_YN_input
|
|
@@ -134,13 +135,33 @@ def adjust_directory_permissions(ambari_user):
|
|
keyLocation = get_master_key_location(properties)
|
|
keyLocation = get_master_key_location(properties)
|
|
masterKeyFile = search_file(SECURITY_MASTER_KEY_FILENAME, keyLocation)
|
|
masterKeyFile = search_file(SECURITY_MASTER_KEY_FILENAME, keyLocation)
|
|
if masterKeyFile:
|
|
if masterKeyFile:
|
|
- configDefaults.NR_ADJUST_OWNERSHIP_LIST.append((masterKeyFile, configDefaults.MASTER_KEY_FILE_PERMISSIONS, "{0}", "{0}", False))
|
|
|
|
|
|
+ configDefaults.NR_ADJUST_OWNERSHIP_LIST.append((masterKeyFile, configDefaults.MASTER_KEY_FILE_PERMISSIONS, "{0}", False))
|
|
credStoreFile = get_credential_store_location(properties)
|
|
credStoreFile = get_credential_store_location(properties)
|
|
if os.path.exists(credStoreFile):
|
|
if os.path.exists(credStoreFile):
|
|
- configDefaults.NR_ADJUST_OWNERSHIP_LIST.append((credStoreFile, configDefaults.CREDENTIALS_STORE_FILE_PERMISSIONS, "{0}", "{0}", False))
|
|
|
|
|
|
+ configDefaults.NR_ADJUST_OWNERSHIP_LIST.append((credStoreFile, configDefaults.CREDENTIALS_STORE_FILE_PERMISSIONS, "{0}", False))
|
|
trust_store_location = properties[SSL_TRUSTSTORE_PATH_PROPERTY]
|
|
trust_store_location = properties[SSL_TRUSTSTORE_PATH_PROPERTY]
|
|
if trust_store_location:
|
|
if trust_store_location:
|
|
- configDefaults.NR_ADJUST_OWNERSHIP_LIST.append((trust_store_location, configDefaults.TRUST_STORE_LOCATION_PERMISSIONS, "{0}", "{0}", False))
|
|
|
|
|
|
+ configDefaults.NR_ADJUST_OWNERSHIP_LIST.append((trust_store_location, configDefaults.TRUST_STORE_LOCATION_PERMISSIONS, "{0}", False))
|
|
|
|
+
|
|
|
|
+ # Update JDK and JCE permissions
|
|
|
|
+ resources_dir = get_resources_location(properties)
|
|
|
|
+ jdk_file_name = properties.get_property(JDK_NAME_PROPERTY)
|
|
|
|
+ jce_file_name = properties.get_property(JCE_NAME_PROPERTY)
|
|
|
|
+ java_home = properties.get_property(JAVA_HOME_PROPERTY)
|
|
|
|
+ if jdk_file_name:
|
|
|
|
+ jdk_file_path = os.path.abspath(os.path.join(resources_dir, jdk_file_name))
|
|
|
|
+ if(os.path.exists(jdk_file_path)):
|
|
|
|
+ configDefaults.NR_ADJUST_OWNERSHIP_LIST.append((jdk_file_path, "644", "{0}", False))
|
|
|
|
+ if jce_file_name:
|
|
|
|
+ jce_file_path = os.path.abspath(os.path.join(resources_dir, jce_file_name))
|
|
|
|
+ if(os.path.exists(jce_file_path)):
|
|
|
|
+ configDefaults.NR_ADJUST_OWNERSHIP_LIST.append((jce_file_path, "644", "{0}", False))
|
|
|
|
+ if java_home:
|
|
|
|
+ jdk_security_dir = os.path.abspath(os.path.join(java_home, configDefaults.JDK_SECURITY_DIR))
|
|
|
|
+ if(os.path.exists(jce_file_path)):
|
|
|
|
+ configDefaults.NR_ADJUST_OWNERSHIP_LIST.append((jdk_security_dir, "644", "{0}", True))
|
|
|
|
+ configDefaults.NR_ADJUST_OWNERSHIP_LIST.append((jdk_security_dir, "755", "{0}", False))
|
|
|
|
+
|
|
print "Adjusting ambari-server permissions and ownership..."
|
|
print "Adjusting ambari-server permissions and ownership..."
|
|
|
|
|
|
for pack in configDefaults.NR_ADJUST_OWNERSHIP_LIST:
|
|
for pack in configDefaults.NR_ADJUST_OWNERSHIP_LIST:
|
|
@@ -148,8 +169,16 @@ def adjust_directory_permissions(ambari_user):
|
|
mod = pack[1]
|
|
mod = pack[1]
|
|
user = pack[2].format(ambari_user)
|
|
user = pack[2].format(ambari_user)
|
|
recursive = pack[3]
|
|
recursive = pack[3]
|
|
|
|
+ print_info_msg("Setting file permissions: {0} {1} {2} {3}".format(file, mod, user, recursive))
|
|
set_file_permissions(file, mod, user, recursive)
|
|
set_file_permissions(file, mod, user, recursive)
|
|
|
|
|
|
|
|
+ for pack in configDefaults.NR_CHANGE_OWNERSHIP_LIST:
|
|
|
|
+ path = pack[0]
|
|
|
|
+ user = pack[1].format(ambari_user)
|
|
|
|
+ recursive = pack[2]
|
|
|
|
+ print_info_msg("Changing ownership: {0} {1} {2}".format(path, user, recursive))
|
|
|
|
+ change_owner(path, user, recursive)
|
|
|
|
+
|
|
def configure_ldap_password():
|
|
def configure_ldap_password():
|
|
passwordDefault = ""
|
|
passwordDefault = ""
|
|
passwordPrompt = 'Enter Manager Password* : '
|
|
passwordPrompt = 'Enter Manager Password* : '
|