6565from wlsdeploy .aliases .model_constants import SET_OPTION_DOMAIN_NAME
6666from wlsdeploy .aliases .model_constants import SET_OPTION_JAVA_HOME
6767from wlsdeploy .aliases .model_constants import SET_OPTION_SERVER_START_MODE
68+ from wlsdeploy .aliases .model_constants import SSL_ADMIN_USER
6869from wlsdeploy .aliases .model_constants import UNIX_MACHINE
6970from wlsdeploy .aliases .model_constants import URL
7071from wlsdeploy .aliases .model_constants import USER
7879from wlsdeploy .exception import exception_helper
7980from wlsdeploy .exception .expection_types import ExceptionType
8081from wlsdeploy .tool .create import atp_helper
82+ from wlsdeploy .tool .create import ssl_helper
8183from wlsdeploy .tool .create import rcudbinfo_helper
8284from wlsdeploy .tool .create .creator import Creator
8385from wlsdeploy .tool .create .security_provider_creator import SecurityProviderCreator
@@ -306,6 +308,13 @@ def __run_rcu(self):
306308 runner = RCURunner .createAtpRunner (domain_type , oracle_home , java_home , rcu_prefix , rcu_schemas ,
307309 rcu_db_info .get_rcu_variables (), rcu_runner_map )
308310
311+ elif rcu_db_info .is_use_ssl ():
312+ rcu_db = rcu_db_info .get_preferred_db ()
313+ rcu_properties_map = self .model .get_model_domain_info ()[RCU_DB_INFO ]
314+ rcu_runner_map = dict (rcu_properties_map )
315+ rcu_runner_map [SSL_ADMIN_USER ] = rcu_db_info .get_ssl_tns_admin ()
316+ runner = RCURunner .createSslRunner (domain_type , oracle_home , java_home , rcu_db , rcu_prefix , rcu_schemas ,
317+ rcu_db_info .get_rcu_variables (), rcu_runner_map )
309318 else :
310319 # Non-ATP database, use DB config from the command line or RCUDbInfo in the model.
311320 rcu_db = rcu_db_info .get_preferred_db ()
@@ -958,7 +967,7 @@ def __set_atp_connection_property(self, root_location, property_name, property_v
958967
959968 root_location .remove_name_token (property_name )
960969
961- def __retrieve_atp_rcudbinfo (self , rcu_db_info , checkAdminPwd = False ):
970+ def __retrieve_atp_rcudbinfo (self , rcu_db_info , check_admin_pwd = False ):
962971 """
963972 Check and return atp connection info and make sure atp rcudb info is complete
964973 :raises: CreateException: if an error occurs
@@ -998,7 +1007,7 @@ def __retrieve_atp_rcudbinfo(self, rcu_db_info, checkAdminPwd=False):
9981007 "'javax.net.ssl.trustStorePassword']" )
9991008 raise ex
10001009
1001- if checkAdminPwd :
1010+ if check_admin_pwd :
10021011 admin_pwd = rcu_db_info .get_admin_password ()
10031012 if admin_pwd is None :
10041013 ex = exception_helper .create_create_exception ('WLSDPLY-12413' ,'rcu_admin_password' ,
@@ -1008,6 +1017,44 @@ def __retrieve_atp_rcudbinfo(self, rcu_db_info, checkAdminPwd=False):
10081017
10091018 return tns_admin , rcu_database , keystore_pwd , truststore_pwd
10101019
1020+ def __retrieve_ssl_rcudbinfo (self , rcu_db_info , check_admin_pwd = False ):
1021+ """
1022+ Check and return ssl connection info and make sure ssl rcudb info is complete
1023+ :raises: CreateException: if an error occurs
1024+ """
1025+ _method_name = '__retrieve_ssl_rcudbinfo'
1026+ 1027+ tns_admin = rcu_db_info .get_ssl_tns_admin ()
1028+ truststore = rcu_db_info .get_truststore ()
1029+ if tns_admin is None or not os .path .exists (tns_admin + os .sep + "tnsnames.ora" ) \
1030+ or not os .path .exists (tns_admin + os .sep + truststore ):
1031+ ex = exception_helper .create_create_exception ('WLSDPLY-12562' )
1032+ self .logger .throwing (ex , class_name = self .__class_name , method_name = _method_name )
1033+ raise ex
1034+ 1035+ if rcu_db_info .get_ssl_entry () is None :
1036+ ex = exception_helper .create_create_exception ('WLSDPLY-12413' ,'tns.alias' ,
1037+ "['tns.alias','javax.net.ssl.keyStorePassword',"
1038+ "'javax.net.ssl.trustStorePassword']" )
1039+ self .logger .throwing (ex , class_name = self .__class_name , method_name = _method_name )
1040+ raise ex
1041+ 1042+ rcu_database , error = ssl_helper .get_ssl_connect_string (tns_admin + os .sep + 'tnsnames.ora' ,
1043+ rcu_db_info .get_ssl_entry ())
1044+ truststore = rcu_db_info .get_truststore ()
1045+ truststore_type = rcu_db_info .get_truststore_type ()
1046+ truststore_pwd = rcu_db_info .get_truststore_password ()
1047+ 1048+ if check_admin_pwd :
1049+ admin_pwd = rcu_db_info .get_admin_password ()
1050+ if admin_pwd is None :
1051+ ex = exception_helper .create_create_exception ('WLSDPLY-12413' ,'rcu_admin_password' ,
1052+ "['rcu_prefix','rcu_schema_password',"
1053+ "'rcu_admin_password']" )
1054+ raise ex
1055+ 1056+ return tns_admin , rcu_database , truststore_pwd , truststore_type , truststore
1057+ 10111058 def __configure_fmw_infra_database (self ):
10121059 """
10131060 Configure the FMW Infrastructure DataSources.
@@ -1042,14 +1089,19 @@ def __configure_fmw_infra_database(self):
10421089 # load atp connection properties from properties file
10431090 # HANDLE ATP case
10441091
1045- if rcu_db_info .has_atpdbinfo ():
1046- has_atp = 1
1092+ if rcu_db_info .has_atpdbinfo ()or rcu_db_info . is_use_ssl () :
1093+ has_atp = rcu_db_info . has_atpdbinfo ()
10471094 # parse the tnsnames.ora file and retrieve the connection string
10481095 # tns_admin is the wallet path either the path to $DOMAIN_HOME/atpwallet or
10491096 # specified in RCUDbinfo.oracle.net.tns_admin
10501097
1051- tns_admin , rcu_database , keystore_pwd , truststore_pwd = self .__retrieve_atp_rcudbinfo (rcu_db_info )
1052- 1098+ keystore_pwd = None
1099+ truststore_type = None
1100+ truststore = None
1101+ if has_atp :
1102+ tns_admin , rcu_database , keystore_pwd , truststore_pwd = self .__retrieve_atp_rcudbinfo (rcu_db_info )
1103+ else :
1104+ tns_admin , rcu_database , truststore_pwd , truststore_type , truststore = self .__retrieve_ssl_rcudbinfo (rcu_db_info )
10531105 # Need to set for the connection property for each datasource
10541106
10551107 fmw_database = self .wls_helper .get_jdbc_url_from_rcu_connect_string (rcu_database )
@@ -1094,23 +1146,30 @@ def __configure_fmw_infra_database(self):
10941146
10951147 location .remove_name_token (DRIVER_PARAMS_USER_PROPERTY )
10961148
1097- self .__set_atp_connection_property (location , DRIVER_PARAMS_kEYSTORE_PROPERTY , tns_admin + os .sep
1098- + 'keystore.jks' )
1099- self .__set_atp_connection_property (location , DRIVER_PARAMS_KEYSTORETYPE_PROPERTY ,
1100- 'JKS' )
1101- self .__set_atp_connection_property (location , DRIVER_PARAMS_KEYSTOREPWD_PROPERTY , keystore_pwd )
1102- self .__set_atp_connection_property (location , DRIVER_PARAMS_TRUSTSTORE_PROPERTY , tns_admin + os .sep
1103- + 'truststore.jks' )
1104- self .__set_atp_connection_property (location , DRIVER_PARAMS_TRUSTSTORETYPE_PROPERTY ,
1105- 'JKS' )
1106- self .__set_atp_connection_property (location , DRIVER_PARAMS_TRUSTSTOREPWD_PROPERTY , truststore_pwd )
1107- 1108- self .__set_atp_connection_property (location , DRIVER_PARAMS_NET_SSL_VERSION , '1.2' )
1109- self .__set_atp_connection_property (location , DRIVER_PARAMS_NET_SERVER_DN_MATCH_PROPERTY , 'true' )
1110- self .__set_atp_connection_property (location , DRIVER_PARAMS_NET_TNS_ADMIN , tns_admin )
1111- self .__set_atp_connection_property (location , DRIVER_PARAMS_NET_FAN_ENABLED , 'false' )
1112- 1113- if not has_atp :
1149+ if has_atp :
1150+ self .__set_atp_connection_property (location , DRIVER_PARAMS_kEYSTORE_PROPERTY , tns_admin + os .sep
1151+ + 'keystore.jks' )
1152+ self .__set_atp_connection_property (location , DRIVER_PARAMS_KEYSTORETYPE_PROPERTY ,
1153+ 'JKS' )
1154+ self .__set_atp_connection_property (location , DRIVER_PARAMS_KEYSTOREPWD_PROPERTY , keystore_pwd )
1155+ self .__set_atp_connection_property (location , DRIVER_PARAMS_TRUSTSTORE_PROPERTY , tns_admin + os .sep
1156+ + 'truststore.jks' )
1157+ self .__set_atp_connection_property (location , DRIVER_PARAMS_TRUSTSTORETYPE_PROPERTY ,
1158+ 'JKS' )
1159+ self .__set_atp_connection_property (location , DRIVER_PARAMS_TRUSTSTOREPWD_PROPERTY , truststore_pwd )
1160+ 1161+ self .__set_atp_connection_property (location , DRIVER_PARAMS_NET_SSL_VERSION , '1.2' )
1162+ self .__set_atp_connection_property (location , DRIVER_PARAMS_NET_SERVER_DN_MATCH_PROPERTY , 'true' )
1163+ self .__set_atp_connection_property (location , DRIVER_PARAMS_NET_TNS_ADMIN , tns_admin )
1164+ self .__set_atp_connection_property (location , DRIVER_PARAMS_NET_FAN_ENABLED , 'false' )
1165+ else :
1166+ self .__set_atp_connection_property (location , DRIVER_PARAMS_TRUSTSTORE_PROPERTY , tns_admin + os .sep
1167+ + truststore )
1168+ self .__set_atp_connection_property (location , DRIVER_PARAMS_TRUSTSTORETYPE_PROPERTY ,
1169+ truststore_type )
1170+ if truststore_pwd is not None and truststore_pwd != 'None' :
1171+ self .__set_atp_connection_property (location , DRIVER_PARAMS_TRUSTSTOREPWD_PROPERTY , truststore_pwd )
1172+ else :
11141173 rcu_database = rcu_db_info .get_preferred_db ()
11151174 if rcu_database is None :
11161175 ex = exception_helper .create_create_exception ('WLSDPLY-12564' )
0 commit comments