Oracle: Configure Oracle to be used with SSL

1. Run the docker image with Oracle EE

docker run -t -p 1532:1532 -p 1521:1521 -e ORACLE_SID=APP -e ORACLE_PWD=pswd -v /local/docker/mounts/oracle:/opt/oracle/oradata oracle/database:12.1.0.2-ee 

2. Connected to the instance:

docker exec -it friendly_khorana /bin/bash

3. Create a wallet

orapki wallet create -wallet /opt/oracle/admin/APP/xdb_wallet -pwd WalletPasswd123 -auto_login_local
orapki wallet add -wallet /opt/oracle/admin/APP/xdb_wallet  -pwd WalletPasswd123   -dn "CN=`hostname`" -keysize 1024 -self_signed -validity 3650
orapki wallet display -wallet /opt/oracle/admin/APP/xdb_wallet -pwd WalletPasswd123
orapki wallet export -wallet /opt/oracle/admin/APP/xdb_wallet -pwd WalletPasswd123 -dn "CN=`hostname`" -cert /tmp/`hostname`-certificate.crt

4. Edit configuration

4.1 listener.ora

SSL_CLIENT_AUTHENTICATION = FALSE

WALLET_LOCATION =
  (SOURCE =
    (METHOD = FILE)
    (METHOD_DATA =
      (DIRECTORY = /opt/oracle/admin/APP/xdb_wallet)
    )
  )

LISTENER =
(DESCRIPTION_LIST =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
    (ADDRESS = (PROTOCOL = TCP)(HOST = 0.0.0.0)(PORT = 1521))
  )
  (DESCRIPTION =
     (ADDRESS = (PROTOCOL = TCPS)(HOST = 0.0.0.0)(PORT = 1532))
   )
)

DEDICATED_THROUGH_BROKER_LISTENER=ON
DIAG_ADR_ENABLED = off

4.2 sqlnet.ora

WALLET_LOCATION =
   (SOURCE =
     (METHOD = FILE)
     (METHOD_DATA =
       (DIRECTORY = /opt/oracle/admin/APP/xdb_wallet)
     )
   )

SQLNET.AUTHENTICATION_SERVICES = (TCPS,NTS,BEQ)
SSL_CLIENT_AUTHENTICATION = FALSE
SSL_CIPHER_SUITES = (SSL_RSA_WITH_AES_256_CBC_SHA, SSL_RSA_WITH_3DES_EDE_CBC_SHA)

4.3 tnsnames.ora

APP=
(DESCRIPTION =
  (ADDRESS = (PROTOCOL = TCPS)(HOST = 0.0.0.0)(PORT = 1532))
  (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = APP)
  )
)

5. Connect with SQLDeveloper

keytool -import -trustcacerts -alias oracle3 -file 15e31b633912-certificate.crt -keystore /u01/keystore/OracleTrustStore.jks

Update SqlDeveloper.conf /Applications/SQLDeveloper.app/Contents/Resources/sqldeveloper/sqldeveloper/bin/sqldeveloper.conf

AddVMOption -Djavax.net.ssl.trustStore=/u01/keystore/OracleTrustStore.jks
AddVMOption -Djavax.net.ssl.trustStorePassword=welcome1234
AddVMOption -Djavax.net.ssl.trustStoreType=JKS
To connect from sqldevloper restart sqldeveloper and use the advanced option in sqldeveloper:
Connection string:

jdbc:oracle:thin:@(DESCRIPTION =  (ADDRESS = (PROTOCOL = TCPS)(HOST = server_ip_addr)(PORT = 1532))(CONNECT_DATA =(SERVER = DEDICATED) (SERVICE_NAME = ORCLCDB)))

Leave a Reply