Skip to content

Commit 6013c75

Browse files
skip credentials under domain security if unused or default (#711)
1 parent b73f17a commit 6013c75

File tree

3 files changed

+29
-3
lines changed

3 files changed

+29
-3
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,9 @@
253253
SCRIPT_ACTION = 'ScriptAction'
254254
SECURITY = 'Security'
255255
SECURITY_CONFIGURATION = 'SecurityConfiguration'
256+
SECURITY_CONFIGURATION_CD_ENABLED = 'CrossDomainSecurityEnabled'
257+
SECURITY_CONFIGURATION_PASSWORD = 'CredentialEncrypted'
258+
SECURITY_CONFIGURATION_NM_PASSWORD = 'NodeManagerPasswordEncrypted'
256259
SECURITY_PARAMS = 'SecurityParams'
257260
SELF_TUNING = 'SelfTuning'
258261
SERVER = 'Server'

core/src/main/python/wlsdeploy/tool/discover/topology_discoverer.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
44
"""
55
from java.io import File
6+
from java.lang import Boolean
67
from java.lang import IllegalArgumentException
78

89
from oracle.weblogic.deploy.discover import DiscoverException
@@ -83,6 +84,7 @@ def discover(self):
8384
model_top_folder_name, machines = self.get_machines(unix_machines)
8485
discoverer.add_to_model_if_not_empty(self._dictionary, model_top_folder_name, machines)
8586

87+
# make sure this is after discovery of machines / node managers as we will do some massaging
8688
model_top_folder_name, security_configuration = self.discover_security_configuration()
8789
discoverer.add_to_model_if_not_empty(self._dictionary, model_top_folder_name, security_configuration)
8890

@@ -318,6 +320,7 @@ def discover_security_configuration(self):
318320
_logger.info('WLSDPLY-06622', class_name=_class_name, method_name=_method_name)
319321
location.add_name_token(self._aliases.get_name_token(location), security_configuration)
320322
self._populate_model_parameters(result, location)
323+
self._massage_security_credential(result)
321324
try:
322325
self._discover_subfolders(result, location)
323326
except DiscoverException, de:
@@ -474,6 +477,25 @@ def _get_xml_registries(self):
474477
_logger.exiting(class_name=_class_name, method_name=_method_name, result=model_top_folder_name)
475478
return model_top_folder_name, result
476479

480+
def _massage_security_credential(self, result):
481+
_method_name = 'massage_security_credential'
482+
# Determine if the SecurityConfiguration/CredentialEncrypted can be removed
483+
if model_constants.SECURITY_CONFIGURATION_PASSWORD in result:
484+
# default is false
485+
if model_constants.SECURITY_CONFIGURATION_CD_ENABLED in result and \
486+
Boolean.valueOf(result[model_constants.SECURITY_CONFIGURATION_CD_ENABLED]) == Boolean.TRUE:
487+
_logger.finer('WLSDPLY-06615', class_name=_class_name, method_name=_method_name)
488+
else:
489+
del result[model_constants.SECURITY_CONFIGURATION_PASSWORD]
490+
_logger.fine('WLSDPLY-06616', class_name=_class_name, method_name=_method_name)
491+
# Determine if the SecurityConfiguration/NodeManagerEncryptedPassword can be removed
492+
if model_constants.SECURITY_CONFIGURATION_NM_PASSWORD in result:
493+
if model_constants.MACHINE in self._dictionary or model_constants.UNIX_MACHINE in self._dictionary:
494+
_logger.finer('WLSDPLY-06645', class_name=_class_name, method_name=_method_name)
495+
else:
496+
del result[model_constants.SECURITY_CONFIGURATION_NM_PASSWORD]
497+
_logger.finer('WLSDPLY-06646', class_name=_class_name, method_name=_method_name)
498+
477499
def _has_machines_folder(self, base_folder):
478500
"""
479501
This is a private method.

core/src/main/resources/oracle/weblogic/deploy/messages/wlsdeploy_rb.properties

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -718,9 +718,8 @@ WLSDPLY-06611=Discovering {0} machines
718718
WLSDPLY-06612=Adding Machine {0}
719719
WLSDPLY-06613=Dynamic Server {0} discovered in online mode will not be added to the model
720720
WLSDPLY-06614=Server {0} is a configured Server and will be added to the model
721-
722-
723-
721+
WLSDPLY-06615=Cross Domain Security is enabled, do not remove SecurityConfiguration CredentialEncrypted
722+
WLSDPLY-06616=Removing SecurityConfiguration CredentialEncrypted from the model
724723
WLSDPLY-06617=Adding Server {0} Classpath {1}
725724
WLSDPLY-06618=Remove Classpath entry {0} for server {1}. This entry references an oracle home location
726725
WLSDPLY-06619=Add Classpath file or directory {0} for Server {1} to the archive file
@@ -751,6 +750,8 @@ WLSDPLY-06642=Custom Keystore file {0} at location {1} is a kss type which is no
751750
add the file to the target domain
752751

753752
WLSDPLY-06644=Adding Domain {0}
753+
WLSDPLY-06645=Machine is not present in domain. Remove SecurityConfiguration NodeManagerPasswordEncrypted default
754+
WLSDPLY-06646=Machine is present in domain so will not remove SecurityConfiguration NodeManagerPasswordEncrypted default
754755

755756

756757
# multi_tenant_discoverer.py, multi_tenant_resources_dsi

0 commit comments

Comments
 (0)