Skip to content

Commit b600e41

Browse files
Added changes to support TWO-WAY Authentication while connecting to oracle DB while bringing up JRF domain (#1181)
* Added changes to support TWO-Way Authentication while connecting to oracle DB * Added changes to support TWO-Way Authentication while connecting to oracle DB * Made changes to re-use existing function * Update rcuinfo.md * Update rcuinfo.md Co-authored-by: [email protected] <ganeshs@cagbu-phx-491.snphxprshared1.gbucdsint02phx.oraclevcn.com>
1 parent 3672255 commit b600e41

File tree

5 files changed

+84
-16
lines changed

5 files changed

+84
-16
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
@@ -356,6 +356,7 @@
356356
DESTINATION_SERVER = 'DestinationServer'
357357
DRIVER_NAME = 'DriverName'
358358
DRIVER_PARAMS_PROPERTY_VALUE = 'Value'
359+
DRIVER_PARAMS_PROPERTY_VALUE_ENCRYPTED = 'EncryptedValueEncrypted'
359360
DRIVER_PARAMS_USER_PROPERTY = 'user'
360361
DRIVER_PARAMS_TRUSTSTORE_PROPERTY = 'javax.net.ssl.trustStore'
361362
DRIVER_PARAMS_kEYSTORE_PROPERTY = 'javax.net.ssl.keyStore'

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

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
from wlsdeploy.aliases.model_constants import DRIVER_PARAMS_NET_SSL_VERSION
3535
from wlsdeploy.aliases.model_constants import DRIVER_PARAMS_NET_TNS_ADMIN
3636
from wlsdeploy.aliases.model_constants import DRIVER_PARAMS_PROPERTY_VALUE
37+
from wlsdeploy.aliases.model_constants import DRIVER_PARAMS_PROPERTY_VALUE_ENCRYPTED
3738
from wlsdeploy.aliases.model_constants import DRIVER_PARAMS_TRUSTSTOREPWD_PROPERTY
3839
from wlsdeploy.aliases.model_constants import DRIVER_PARAMS_TRUSTSTORETYPE_PROPERTY
3940
from wlsdeploy.aliases.model_constants import DRIVER_PARAMS_TRUSTSTORE_PROPERTY
@@ -941,7 +942,7 @@ def __create_other_domain_artifacts(self, location, mbean_type_list):
941942
self.logger.exiting(class_name=self.__class_name, method_name=_method_name)
942943
return
943944

944-
def __set_atp_connection_property(self, root_location, property_name, property_value):
945+
def __set_atp_connection_property(self, root_location, property_name, property_value, encrypted=False):
945946
create_path = self.aliases.get_wlst_create_path(root_location)
946947

947948
self.wlst_helper.cd(create_path)
@@ -959,14 +960,18 @@ def __set_atp_connection_property(self, root_location, property_name, property_v
959960
wlst_path = self.aliases.get_wlst_attributes_path(root_location)
960961

961962
self.wlst_helper.cd(wlst_path)
962-
963+
964+
if encrypted:
965+
value_property = DRIVER_PARAMS_PROPERTY_VALUE_ENCRYPTED
966+
else:
967+
value_property = DRIVER_PARAMS_PROPERTY_VALUE
968+
963969
wlst_name, wlst_value = \
964-
self.aliases.get_wlst_attribute_name_and_value(root_location, DRIVER_PARAMS_PROPERTY_VALUE,
965-
property_value)
970+
self.aliases.get_wlst_attribute_name_and_value(root_location, value_property, property_value)
966971
self.wlst_helper.set(wlst_name, wlst_value)
967972

968973
root_location.remove_name_token(property_name)
969-
974+
970975
def __retrieve_atp_rcudbinfo(self, rcu_db_info, check_admin_pwd=False):
971976
"""
972977
Check and return atp connection info and make sure atp rcudb info is complete
@@ -1044,6 +1049,9 @@ def __retrieve_ssl_rcudbinfo(self, rcu_db_info, check_admin_pwd=False):
10441049
truststore = rcu_db_info.get_truststore()
10451050
truststore_type = rcu_db_info.get_truststore_type()
10461051
truststore_pwd = rcu_db_info.get_truststore_password()
1052+
keystore = rcu_db_info.get_keystore()
1053+
keystore_type = rcu_db_info.get_keystore_type()
1054+
keystore_pwd = rcu_db_info.get_keystore_password()
10471055

10481056
if check_admin_pwd:
10491057
admin_pwd = rcu_db_info.get_admin_password()
@@ -1053,7 +1061,7 @@ def __retrieve_ssl_rcudbinfo(self, rcu_db_info, check_admin_pwd=False):
10531061
"'rcu_admin_password']")
10541062
raise ex
10551063

1056-
return tns_admin, rcu_database, truststore_pwd, truststore_type, truststore
1064+
return tns_admin, rcu_database, truststore_pwd, truststore_type, truststore, keystore_pwd, keystore_type, keystore
10571065

10581066
def __configure_fmw_infra_database(self):
10591067
"""
@@ -1098,10 +1106,12 @@ def __configure_fmw_infra_database(self):
10981106
keystore_pwd = None
10991107
truststore_type = None
11001108
truststore = None
1109+
keystore_type = None
1110+
keystore = None
11011111
if has_atp:
11021112
tns_admin, rcu_database, keystore_pwd, truststore_pwd = self.__retrieve_atp_rcudbinfo(rcu_db_info)
11031113
else:
1104-
tns_admin, rcu_database, truststore_pwd, truststore_type, truststore = self.__retrieve_ssl_rcudbinfo(rcu_db_info)
1114+
tns_admin, rcu_database, truststore_pwd, truststore_type, truststore, keystore_pwd, keystore_type, keystore = self.__retrieve_ssl_rcudbinfo(rcu_db_info)
11051115
# Need to set for the connection property for each datasource
11061116

11071117
fmw_database = self.wls_helper.get_jdbc_url_from_rcu_connect_string(rcu_database)
@@ -1168,7 +1178,15 @@ def __configure_fmw_infra_database(self):
11681178
self.__set_atp_connection_property(location, DRIVER_PARAMS_TRUSTSTORETYPE_PROPERTY,
11691179
truststore_type)
11701180
if truststore_pwd is not None and truststore_pwd != 'None':
1171-
self.__set_atp_connection_property(location, DRIVER_PARAMS_TRUSTSTOREPWD_PROPERTY, truststore_pwd)
1181+
self.__set_atp_connection_property(location, DRIVER_PARAMS_TRUSTSTOREPWD_PROPERTY, truststore_pwd, encrypted=True)
1182+
if keystore is not None and keystore != 'None':
1183+
self.__set_atp_connection_property(location, DRIVER_PARAMS_kEYSTORE_PROPERTY, tns_admin + os.sep
1184+
+ keystore)
1185+
if keystore_type is not None and keystore_type != 'None':
1186+
self.__set_atp_connection_property(location, DRIVER_PARAMS_KEYSTORETYPE_PROPERTY,
1187+
keystore_type)
1188+
if keystore_pwd is not None and keystore_pwd != 'None':
1189+
self.__set_atp_connection_property(location, DRIVER_PARAMS_KEYSTOREPWD_PROPERTY, keystore_pwd, encrypted=True)
11721190
else:
11731191
rcu_database = rcu_db_info.get_preferred_db()
11741192
if rcu_database is None:

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
from wlsdeploy.aliases.model_constants import ATP_TEMPORARY_TABLESPACE
99
from wlsdeploy.aliases.model_constants import ATP_TNS_ENTRY
1010
from wlsdeploy.aliases.model_constants import DOMAIN_INFO
11+
from wlsdeploy.aliases.model_constants import DRIVER_PARAMS_kEYSTORE_PROPERTY
12+
from wlsdeploy.aliases.model_constants import DRIVER_PARAMS_KEYSTORETYPE_PROPERTY
1113
from wlsdeploy.aliases.model_constants import DRIVER_PARAMS_KEYSTOREPWD_PROPERTY
1214
from wlsdeploy.aliases.model_constants import DRIVER_PARAMS_NET_TNS_ADMIN
1315
from wlsdeploy.aliases.model_constants import DRIVER_PARAMS_TRUSTSTORE_PROPERTY
@@ -61,6 +63,12 @@ def get_rcu_schema_password(self):
6163
password = dictionary_utils.get_element(self.rcu_properties_map, RCU_SCHEMA_PASSWORD)
6264
return self.aliases.decrypt_password(password)
6365

66+
def get_keystore(self):
67+
return dictionary_utils.get_element(self.rcu_properties_map, DRIVER_PARAMS_kEYSTORE_PROPERTY)
68+
69+
def get_keystore_type(self):
70+
return dictionary_utils.get_element(self.rcu_properties_map, DRIVER_PARAMS_KEYSTORETYPE_PROPERTY)
71+
6472
def get_keystore_password(self):
6573
password = dictionary_utils.get_element(self.rcu_properties_map, DRIVER_PARAMS_KEYSTOREPWD_PROPERTY)
6674
return self.aliases.decrypt_password(password)

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

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
_logger = PlatformLogger('wlsdeploy.create')
1515

16-
def set_ssl_properties(xml_doc, atp_creds_path, truststore, truststore_type, truststore_password):
16+
def set_ssl_properties(xml_doc, atp_creds_path, truststore, truststore_type, truststore_password, keystore, keystore_type, keystore_password):
1717
'''
1818
Add SSL config properties to the specified XML document.
1919
:param xml_doc: The XML document
@@ -31,6 +31,12 @@ def set_ssl_properties(xml_doc, atp_creds_path, truststore, truststore_type, tru
3131
set_property(dom_tree, prop, 'oracle.net.tns_admin', atp_creds_path)
3232
if truststore_password is not None:
3333
set_property(dom_tree, prop, 'javax.net.ssl.trustStorePassword', truststore_password)
34+
if keystore is not None:
35+
set_property(dom_tree, prop, 'javax.net.ssl.keyStore', atp_creds_path + '/' + keystore)
36+
if keystore_type is not None:
37+
set_property(dom_tree, prop, 'javax.net.ssl.keyStoreType', keystore_type)
38+
if keystore_password is not None:
39+
set_property(dom_tree, prop, 'javax.net.ssl.keyStorePassword', keystore_password)
3440
# Persist the changes in the xml file
3541
file_handle = open(xml_doc,"w")
3642
dom_tree.writexml(file_handle)
@@ -57,12 +63,14 @@ def fix_jps_config(rcu_db_info, model_context):
5763
truststore = rcu_db_info.get_truststore()
5864
truststore_type = rcu_db_info.get_truststore_type()
5965
truststore_password = rcu_db_info.get_truststore_password()
66+
keystore = rcu_db_info.get_keystore()
67+
keystore_type = rcu_db_info.get_keystore_type()
68+
keystore_password = rcu_db_info.get_keystore_password()
6069

6170
jsp_config = model_context.get_domain_home() + '/config/fmwconfig/jps-config.xml'
6271
jsp_config_jse = model_context.get_domain_home() + '/config/fmwconfig/jps-config-jse.xml'
63-
set_ssl_properties(jsp_config, tns_admin, truststore, truststore_type, truststore_password)
64-
set_ssl_properties(jsp_config_jse, tns_admin, truststore, truststore_type, truststore_password)
65-
72+
set_ssl_properties(jsp_config, tns_admin, truststore, truststore_type, truststore_password, keystore, keystore_type, keystore_password)
73+
set_ssl_properties(jsp_config_jse, tns_admin, truststore, truststore_type, truststore_password, keystore, keystore_type, keystore_password)
6674

6775
def get_ssl_connect_string(tnsnames_ora_path, tns_sid_name):
6876
try:

documentation/2.0/content/rcuinfo.md

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ Or, by specifying the unzipped root directory of the ATP wallet ZIP file in `ora
4747

4848
#### SSL database using SSO for authentication
4949

50-
For an SSL database, with an `SSO` wallet, use the following example:
50+
For an Oracle SSL database with TW0_WAY SSL enabled, with an `SSO` wallet, use the following example:
5151
```yaml
5252
domainInfo:
5353
RCUDbInfo:
5454
useSSL : true
55-
rcu_db_conn_string: <reuired URL string for use with -run_rcu>
55+
rcu_db_conn_string: <required URL string for use with -run_rcu>
5656
rcu_prefix : DEV
5757
rcu_admin_password: <required with -run_rcu flag>
5858
rcu_schema_password: <required with -run_rcu flag>
@@ -64,14 +64,31 @@ domainInfo:
6464
oracle.net.tns_admin: <absolute path of the unzipped wallet root directory>
6565
6666
```
67+
68+
For an Oracle SSL database with ONE_WAY SSL enabled, with an `SSO` wallet, use the following example:
69+
```yaml
70+
domainInfo:
71+
RCUDbInfo:
72+
useSSL : true
73+
rcu_db_conn_string: <required URL string for use with -run_rcu>
74+
rcu_prefix : DEV
75+
rcu_admin_password: <required with -run_rcu flag>
76+
rcu_schema_password: <required with -run_rcu flag>
77+
tns.alias: <alias of ssl db in the tnsnames.ora file>
78+
javax.net,ssl.trustStore: <truststore found in unzipped wallet, i.e cwallet.sso>
79+
javax.net.ssl.trustStoreType: SSO
80+
oracle.net.tns_admin: <absolute path of the unzipped wallet root directory>
81+
82+
```
83+
6784
#### SSL database using PKCS12 for authentication
6885

69-
For an SSL database, with a `PKCS12` wallet, use the following example:
86+
For an Oracle SSL database with TW0_WAY SSL enabled, with a `PKCS12` wallet, use the following example:
7087
```yaml
7188
domainInfo:
7289
RCUDbInfo:
7390
useSSL : true
74-
rcu_db_conn_string: <reuired URL string for use with -run_rcu>
91+
rcu_db_conn_string: <required URL string for use with -run_rcu>
7592
rcu_prefix : DEV
7693
rcu_admin_password: <required with -run_rcu flag>
7794
rcu_schema_password: <required with -run_rcu flag>
@@ -84,6 +101,22 @@ domainInfo:
84101
javax.net.ssl.trustStorePassword: <password of the truststore>
85102
oracle.net.tns_admin: <absolute path of the unzipped wallet root directory>
86103
104+
```
105+
For an Oracle SSL database with ONE_WAY SSL enabled, with a `PKCS12` wallet, use the following example:
106+
```yaml
107+
domainInfo:
108+
RCUDbInfo:
109+
useSSL : true
110+
rcu_db_conn_string: <required URL string for use with -run_rcu>
111+
rcu_prefix : DEV
112+
rcu_admin_password: <required with -run_rcu flag>
113+
rcu_schema_password: <required with -run_rcu flag>
114+
tns.alias: <alias of ssl db in the tnsnames.ora file>
115+
javax.net.ssl.trustStore: <truststore found in the unzipped wallet, i.e ewallet.p12>
116+
javax.net.ssl.trustStoreType: PKCS12
117+
javax.net.ssl.trustStorePassword: <password of the truststore>
118+
oracle.net.tns_admin: <absolute path of the unzipped wallet root directory>
119+
87120
```
88121
When using a PKCS12 wallet, you must include the Oracle PKI provider to access your wallet. Add the Oracle PKI provider to your Java `java.security` file. For more information, see Section 2.2.4 "How can Oracle wallets be used in Java" in [SSL with Oracle JDBC Thin Driver](https://www.oracle.com/technetwork/topics/wp-oracle-jdbc-thin-ssl-130128.pdf).
89122

0 commit comments

Comments
 (0)