Skip to content

Commit a4ead66

Browse files
jshum2479ddsharpe
authored andcommitted
run decrypt for admin credentials before creating boot.properites as … (#407)
* run decrypt for admin credentials before creating boot.properites as they may have encrypted. * Refactor code and only generate boot.properties when not in production mode
1 parent 16da3f4 commit a4ead66

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

core/src/main/python/wlsdeploy/aliases/model_constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@
187187
PLAN_PATH = 'PlanPath'
188188
PREPEND = 'prepend'
189189
PROPERTIES = 'Properties'
190+
PRODUCTION_MODE_ENABLED='ProductionModeEnabled'
190191
QUEUE = 'Queue'
191192
QUOTA = 'Quota'
192193
REALM = 'Realm'

core/src/main/python/wlsdeploy/tool/create/domain_creator.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from java.util import Properties
1010
from oracle.weblogic.deploy.create import RCURunner
1111
from oracle.weblogic.deploy.util import WLSDeployArchive, FileUtils
12+
from wlsdeploy.util import string_utils
1213
from wlsdeploy.aliases.location_context import LocationContext
1314
from wlsdeploy.aliases.model_constants import ADMIN_PASSWORD
1415
from wlsdeploy.aliases.model_constants import ADMIN_SERVER_NAME
@@ -48,6 +49,7 @@
4849
from wlsdeploy.aliases.model_constants import PARTITION
4950
from wlsdeploy.aliases.model_constants import PASSWORD
5051
from wlsdeploy.aliases.model_constants import PASSWORD_ENCRYPTED
52+
from wlsdeploy.aliases.model_constants import PRODUCTION_MODE_ENABLED
5153
from wlsdeploy.aliases.model_constants import RCU_ADMIN_PASSWORD
5254
from wlsdeploy.aliases.model_constants import RCU_DB_CONN
5355
from wlsdeploy.aliases.model_constants import RCU_DB_INFO
@@ -1110,6 +1112,16 @@ def _configure_security_configuration(self):
11101112
def __create_boot_dot_properties(self):
11111113
_method_name = '__create_boot_dot_properties'
11121114
self.logger.entering(class_name=self.__class_name, method_name=_method_name)
1115+
1116+
if SERVER_START_MODE in self._domain_info:
1117+
server_start_mode = self._domain_info[SERVER_START_MODE]
1118+
if server_start_mode == 'prod' or server_start_mode == 'PROD':
1119+
return
1120+
1121+
if PRODUCTION_MODE_ENABLED in self._topology:
1122+
if string_utils.to_boolean(self._topology[PRODUCTION_MODE_ENABLED]):
1123+
return
1124+
11131125
systemIni = SerializedSystemIni.getEncryptionService(self._domain_home)
11141126
encryptionService = ClearOrEncryptedService(systemIni)
11151127
admin_password = self._domain_info[ADMIN_PASSWORD]
@@ -1124,10 +1136,14 @@ def __create_boot_dot_properties(self):
11241136
name = self.wlst_helper.get_quoted_name_for_wlst(model_name)
11251137
servers.append(name)
11261138

1139+
admin_username = self.aliases.decrypt_password(admin_username)
1140+
admin_password = self.aliases.decrypt_password(admin_password)
1141+
encrypted_username = encryptionService.encrypt(admin_username)
1142+
encrypted_password = encryptionService.encrypt(admin_password)
11271143
for server in servers:
11281144
properties = Properties()
1129-
properties.put("username", encryptionService.encrypt(admin_username))
1130-
properties.put("password", encryptionService.encrypt(admin_password))
1145+
properties.put("username", encrypted_username)
1146+
properties.put("password", encrypted_password)
11311147
file_directory = self._domain_home + "/servers/" + server + "/security"
11321148
file_location = file_directory + "/boot.properties"
11331149
if not os.path.exists(file_directory):

0 commit comments

Comments
 (0)