Skip to content

run decrypt for admin credentials before creating boot.properites as … #407

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions core/src/main/python/wlsdeploy/aliases/model_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@
PLAN_PATH = 'PlanPath'
PREPEND = 'prepend'
PROPERTIES = 'Properties'
PRODUCTION_MODE_ENABLED='ProductionModeEnabled'
QUEUE = 'Queue'
QUOTA = 'Quota'
REALM = 'Realm'
Expand Down
20 changes: 18 additions & 2 deletions core/src/main/python/wlsdeploy/tool/create/domain_creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from java.util import Properties
from oracle.weblogic.deploy.create import RCURunner
from oracle.weblogic.deploy.util import WLSDeployArchive, FileUtils
from wlsdeploy.util import string_utils
from wlsdeploy.aliases.location_context import LocationContext
from wlsdeploy.aliases.model_constants import ADMIN_PASSWORD
from wlsdeploy.aliases.model_constants import ADMIN_SERVER_NAME
Expand Down Expand Up @@ -48,6 +49,7 @@
from wlsdeploy.aliases.model_constants import PARTITION
from wlsdeploy.aliases.model_constants import PASSWORD
from wlsdeploy.aliases.model_constants import PASSWORD_ENCRYPTED
from wlsdeploy.aliases.model_constants import PRODUCTION_MODE_ENABLED
from wlsdeploy.aliases.model_constants import RCU_ADMIN_PASSWORD
from wlsdeploy.aliases.model_constants import RCU_DB_CONN
from wlsdeploy.aliases.model_constants import RCU_DB_INFO
Expand Down Expand Up @@ -1110,6 +1112,16 @@ def _configure_security_configuration(self):
def __create_boot_dot_properties(self):
_method_name = '__create_boot_dot_properties'
self.logger.entering(class_name=self.__class_name, method_name=_method_name)

if SERVER_START_MODE in self._domain_info:
server_start_mode = self._domain_info[SERVER_START_MODE]
if server_start_mode == 'prod' or server_start_mode == 'PROD':
return

if PRODUCTION_MODE_ENABLED in self._topology:
if string_utils.to_boolean(self._topology[PRODUCTION_MODE_ENABLED]):
return

systemIni = SerializedSystemIni.getEncryptionService(self._domain_home)
encryptionService = ClearOrEncryptedService(systemIni)
admin_password = self._domain_info[ADMIN_PASSWORD]
Expand All @@ -1124,10 +1136,14 @@ def __create_boot_dot_properties(self):
name = self.wlst_helper.get_quoted_name_for_wlst(model_name)
servers.append(name)

admin_username = self.aliases.decrypt_password(admin_username)
admin_password = self.aliases.decrypt_password(admin_password)
encrypted_username = encryptionService.encrypt(admin_username)
encrypted_password = encryptionService.encrypt(admin_password)
for server in servers:
properties = Properties()
properties.put("username", encryptionService.encrypt(admin_username))
properties.put("password", encryptionService.encrypt(admin_password))
properties.put("username", encrypted_username)
properties.put("password", encrypted_password)
file_directory = self._domain_home + "/servers/" + server + "/security"
file_location = file_directory + "/boot.properties"
if not os.path.exists(file_directory):
Expand Down