|
| 1 | +# Oracle 19c — connecting a bound app |
| 2 | + |
| 3 | +After `cf bind-service`, the credentials appear in `VCAP_SERVICES` under the |
| 4 | +`aws-rds` service. Reading credentials (`cf env`), opening space egress |
| 5 | +(`cf bind-security-group trusted_local_networks_egress`), and tunnelling from a |
| 6 | +laptop (`cf ssh -L`) are identical to the Postgres/MySQL flow — see the top-level |
| 7 | +[README.md](../../README.md). This page covers only the Oracle-specific connection |
| 8 | +detail. |
| 9 | + |
| 10 | +## Binding payload (Oracle-specific keys) |
| 11 | + |
| 12 | +```json |
| 13 | +{ |
| 14 | + "uri": "oracle://APP_USER:REDACTED@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCPS)(HOST=my-oracle.abc.us-gov-west-1.rds.amazonaws.com)(PORT=2484))(CONNECT_DATA=(SID=ORCL)))", |
| 15 | + "jdbcUrl": "jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCPS)(HOST=my-oracle.abc.us-gov-west-1.rds.amazonaws.com)(PORT=2484))(CONNECT_DATA=(SID=ORCL)))", |
| 16 | + "port": "2484", |
| 17 | + "protocol": "tcps", |
| 18 | + "service_name": "ORCL", |
| 19 | + "sid": "ORCL", |
| 20 | + "ssl_required": "true", |
| 21 | + "ssl_server_dn_match": "true", |
| 22 | + "ca_cert_bundle_url": "https://truststore.pki.us-gov-west-1.rds.amazonaws.com/global/global-bundle.pem" |
| 23 | +} |
| 24 | +``` |
| 25 | + |
| 26 | +The binding uses a full Oracle connect `DESCRIPTION` on the **TCPS listener (port |
| 27 | +2484)** — not EZConnect, which cannot express `PROTOCOL=TCPS`. `ssl_required=true` |
| 28 | +and `ssl_server_dn_match=true` tell the client to encrypt **and** verify the server |
| 29 | +identity against `ca_cert_bundle_url` (the GovCloud RDS CA bundle). No hardcoded |
| 30 | +server-cert DN is published — the RDS cert subject is Amazon-owned and rotates, so |
| 31 | +the driver derives it from the trusted cert. The instance uses the RDS default RSA CA |
| 32 | +(`rds-ca-rsa2048-g1`), compatible with the ECDHE_RSA cipher. |
| 33 | + |
| 34 | +## JDBC (Java) |
| 35 | + |
| 36 | +```bash |
| 37 | +# import the GovCloud RDS CA bundle (ca_cert_bundle_url from the binding): |
| 38 | +wget https://truststore.pki.us-gov-west-1.rds.amazonaws.com/global/global-bundle.pem |
| 39 | +keytool -importcert -alias rds-ca -file global-bundle.pem \ |
| 40 | + -keystore truststore.jks -storepass "$TRUSTSTORE_PW" -noprompt |
| 41 | +``` |
| 42 | + |
| 43 | +```java |
| 44 | +String url = System.getenv("ORACLE_JDBC_URL"); // the TCPS jdbcUrl from the binding |
| 45 | +Properties p = new Properties(); |
| 46 | +p.put("user", username); |
| 47 | +p.put("password", password); |
| 48 | +p.put("oracle.net.ssl_server_dn_match", "true"); // ssl_server_dn_match=true |
| 49 | +p.put("javax.net.ssl.trustStore", "truststore.jks"); |
| 50 | +p.put("javax.net.ssl.trustStorePassword", System.getenv("TRUSTSTORE_PW")); |
| 51 | +Connection c = DriverManager.getConnection(url, p); |
| 52 | +``` |
| 53 | + |
| 54 | +## SQL*Plus |
| 55 | + |
| 56 | +```bash |
| 57 | +# full TCPS connect descriptor (EZConnect cannot express PROTOCOL=TCPS): |
| 58 | +sqlplus 'APP_USER@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCPS)(HOST=<host>)(PORT=2484))(CONNECT_DATA=(SID=ORCL)))' |
| 59 | +``` |
| 60 | + |
| 61 | +Configure a wallet / truststore holding the imported GovCloud RDS CA bundle so the |
| 62 | +client trusts the server certificate. |
| 63 | + |
| 64 | +## Python (python-oracledb, thin mode) |
| 65 | + |
| 66 | +```python |
| 67 | +import oracledb |
| 68 | + |
| 69 | +dsn = ( |
| 70 | + "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCPS)(HOST=<host>)(PORT=2484))" |
| 71 | + "(CONNECT_DATA=(SID=ORCL))" |
| 72 | + "(SECURITY=(SSL_SERVER_DN_MATCH=TRUE)))" |
| 73 | +) |
| 74 | +# config_dir points at a directory holding the imported GovCloud RDS CA bundle |
| 75 | +# (ca_cert_bundle_url) as the trust store the thin driver reads. |
| 76 | +conn = oracledb.connect(user=username, password=password, dsn=dsn, |
| 77 | + config_dir="/path/to/wallet") |
| 78 | +``` |
| 79 | + |
| 80 | +The listener negotiates **TLS 1.2** (RDS Oracle has no 1.3) with the FIPS-validated |
| 81 | +AEAD cipher `TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384`; `FIPS.SSLFIPS_140=TRUE` means |
| 82 | +the client **must** offer a FIPS cipher or the handshake fails. See |
| 83 | +[hardening-baseline.md](hardening-baseline.md). |
| 84 | + |
| 85 | +> **Use a least-privilege user, not the master.** The bound credential is the |
| 86 | +> instance master, which on Oracle is **DBA-class**. Connect as the master once to |
| 87 | +> create a least-privilege application user, then run your app as that user. |
| 88 | +> Creating in-database users is the customer's responsibility — see |
| 89 | +> [limitations.md](limitations.md). |
0 commit comments