65
65
from wlsdeploy .aliases .model_constants import SET_OPTION_DOMAIN_NAME
66
66
from wlsdeploy .aliases .model_constants import SET_OPTION_JAVA_HOME
67
67
from wlsdeploy .aliases .model_constants import SET_OPTION_SERVER_START_MODE
68
+ from wlsdeploy .aliases .model_constants import SSL_ADMIN_USER
68
69
from wlsdeploy .aliases .model_constants import UNIX_MACHINE
69
70
from wlsdeploy .aliases .model_constants import URL
70
71
from wlsdeploy .aliases .model_constants import USER
78
79
from wlsdeploy .exception import exception_helper
79
80
from wlsdeploy .exception .expection_types import ExceptionType
80
81
from wlsdeploy .tool .create import atp_helper
82
+ from wlsdeploy .tool .create import ssl_helper
81
83
from wlsdeploy .tool .create import rcudbinfo_helper
82
84
from wlsdeploy .tool .create .creator import Creator
83
85
from wlsdeploy .tool .create .security_provider_creator import SecurityProviderCreator
@@ -306,6 +308,13 @@ def __run_rcu(self):
306
308
runner = RCURunner .createAtpRunner (domain_type , oracle_home , java_home , rcu_prefix , rcu_schemas ,
307
309
rcu_db_info .get_rcu_variables (), rcu_runner_map )
308
310
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 )
309
318
else :
310
319
# Non-ATP database, use DB config from the command line or RCUDbInfo in the model.
311
320
rcu_db = rcu_db_info .get_preferred_db ()
@@ -958,7 +967,7 @@ def __set_atp_connection_property(self, root_location, property_name, property_v
958
967
959
968
root_location .remove_name_token (property_name )
960
969
961
- def __retrieve_atp_rcudbinfo (self , rcu_db_info , checkAdminPwd = False ):
970
+ def __retrieve_atp_rcudbinfo (self , rcu_db_info , check_admin_pwd = False ):
962
971
"""
963
972
Check and return atp connection info and make sure atp rcudb info is complete
964
973
:raises: CreateException: if an error occurs
@@ -998,7 +1007,7 @@ def __retrieve_atp_rcudbinfo(self, rcu_db_info, checkAdminPwd=False):
998
1007
"'javax.net.ssl.trustStorePassword']" )
999
1008
raise ex
1000
1009
1001
- if checkAdminPwd :
1010
+ if check_admin_pwd :
1002
1011
admin_pwd = rcu_db_info .get_admin_password ()
1003
1012
if admin_pwd is None :
1004
1013
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):
1008
1017
1009
1018
return tns_admin , rcu_database , keystore_pwd , truststore_pwd
1010
1019
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
+
1011
1058
def __configure_fmw_infra_database (self ):
1012
1059
"""
1013
1060
Configure the FMW Infrastructure DataSources.
@@ -1042,14 +1089,19 @@ def __configure_fmw_infra_database(self):
1042
1089
# load atp connection properties from properties file
1043
1090
# HANDLE ATP case
1044
1091
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 ()
1047
1094
# parse the tnsnames.ora file and retrieve the connection string
1048
1095
# tns_admin is the wallet path either the path to $DOMAIN_HOME/atpwallet or
1049
1096
# specified in RCUDbinfo.oracle.net.tns_admin
1050
1097
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 )
1053
1105
# Need to set for the connection property for each datasource
1054
1106
1055
1107
fmw_database = self .wls_helper .get_jdbc_url_from_rcu_connect_string (rcu_database )
@@ -1094,23 +1146,30 @@ def __configure_fmw_infra_database(self):
1094
1146
1095
1147
location .remove_name_token (DRIVER_PARAMS_USER_PROPERTY )
1096
1148
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 :
1114
1173
rcu_database = rcu_db_info .get_preferred_db ()
1115
1174
if rcu_database is None :
1116
1175
ex = exception_helper .create_create_exception ('WLSDPLY-12564' )
0 commit comments