Implement Oracle TCPS Listener and automated Wallet configuration#419
Implement Oracle TCPS Listener and automated Wallet configuration#419sahsagar-google merged 22 commits intogoogle:masterfrom
Conversation
|
Took care of Marc's feedback on the earlier PR (closed unintentionally) |
mfielding
left a comment
There was a problem hiding this comment.
Adding a few comments based on observing the code, but I do want to actually test a real deployment too.
But I should ask this question first: I noticed that the actual certificate authority and cloud DNS setup weren't in the terraform config. Is this because we need them to be shared across deployments? If so, can you create a sample Terraform config for the one-time setup we need?
And as a bonus, it will help me test this out myself too.
Another comment not associated with a file changed here:
We open a port on the host firewall for the listener in
I imaging that with a TCPS listener, we'd want to open the TCPS listener port only.
|
@sahsagar-google just to keep the history of changes and comments here, could you please merge-commit https://github.com/sahsagar-google/oracle-toolkit/tree/fix-tls-review-comments here? I don't mind the extra commit in the history. (Or, alternately, grant me privileges on your repo and I can do it on your behalf) AI-suggested commands: |
mfielding
left a comment
There was a problem hiding this comment.
Looking good! I'll do some testing on my end, but here are a few quick comments to start.
mfielding
left a comment
There was a problem hiding this comment.
Thanks for all your work here. As part of testing to get a config working myself, here are a few things that came up.
mfielding
left a comment
There was a problem hiding this comment.
One more request after going through
mfielding
left a comment
There was a problem hiding this comment.
I finally got a successful connection in my 26ai test, but it took a few more fixes to work, notably for dynamic listener registration, and sqlnet.ora/listener.ora syncing.
I've added comments below.
for the CA/DNS setup, I left them out of the main config since they're shared infrastructure, but I just added a one-time setup example (with a sample .tfvars) in terraform/data-guard-tls/ so you can easily test it out (I'm testing it as I speak too). Also, great call on the firewall. I updated the listener role to only open the TCPS port when TLS is enabled instead of opening both. |
mfielding
left a comment
There was a problem hiding this comment.
Looking good! Just some minor comments.
mfielding
left a comment
There was a problem hiding this comment.
Looks good My tests succeed too.
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mfielding, sahsagar-google The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Automated TLS Encryption for Oracle Database (Multi-Node & 26ai Compliant)
Summary
This PR implements end-to-end automation for securing Oracle Database deployments using Transport Layer Security (TLS). It introduces enterprise-grade Terraform resources for Certificate Authority (CA) integration and secure Secret Manager storage, engineered to natively support multi-node Data Guard clusters.
Additionally, it introduces a new Ansible role (
tls-setup) that dynamically provisions node-specific Oracle Wallets and Listeners. By utilizing a non-destructive block-append strategy, the automation is fully compliant with both legacy 19c deployments and modern Oracle 23ai/26aiWALLET_ROOTand Transparent Data Encryption (TDE) architectures.Key Changes
1. Infrastructure Security & Multi-Node Support (Terraform)
terraform/main.tf&terraform/variables.tf:for_eachloops to dynamically mint distinct Private Keys, CSRs, Certificates (google_privateca_certificate), and DNS A-Records for every node in a deployment (e.g., Primary and Standby).google_secret_manager_secretper node.secretAccessorrights only to their specific node-level secret, ensuring least-privilege access post-deployment.2. Configuration Management (Ansible)
roles/tls-setup/(New Role):{{ inventory_hostname }}-tls-secretviagcloudto ensure each Data Guard node fetches its correct, unique cryptographic payload.blockinfile): Safely appends TCPS parameters tolistener.oraandsqlnet.orawithout wiping out critical DBCA-generated defaults (such as standard TCP ports and native TDE encryption paths).{{ oracle_base }}/admin/{{ oracle_db_name }}/wallet_root/tls. Introduced conditional Jinja2 logic directly inside theblockinfileblock to explicitly mapWALLET_LOCATIONfor 19c databases, while relying natively on the system-levelWALLET_ROOTfor 23ai/26ai to prevent TDE conflicts.orapkiandopensslto create auto-login wallets (cwallet.sso), splitting the commands into distinct tasks with explicitcreatesparameters to ensure perfect idempotency.lsnrctl status LISTENER_TCPSdirectly to the Ansible standard output, providing immediate, verifiable proof of the TCPS endpoint in the pipeline logs.client_bundle.zipdirectly in the Oracle user's home directory (/home/oracle/) to simplify secure downstream client connectivity.roles/db-start/templates/:* Updated
start_all.sh.j2andstop_all.sh.j2to ensure the new dedicatedLISTENER_TCPSstarts and stops cleanly alongside the default database services during reboot ordbora.servicecycles.main.yml&validate_passwords.yml):.msgvariables instead of.stderrwhen executables fail or are missing, ensuring clean and accurate pipeline error outputs.3. Orchestration & Config
install-oracle.sh: Streamlined argument parsing based on reviewer feedback. Removed the redundant--enable-tlsflag, now intelligently inferring TLS enablement directly from the presence of the secret.config-db.yml: Integrated the conditional execution of thetls-setuprole into the core database configuration playbook.presubmit_tests/26ai-dg.tfvars: Updated test configuration to validate the new TLS pathways on multi-node Data Guard deployments.Testing & Verification
The changes were verified via full end-to-end deployments using the automated CI/CD test harnesses for Data Guard topologies. The pipeline now explicitly captures and outputs the listener status for immediate visual validation, alongside the implicit proof of a successful deployment.
1. Non-Destructive Integration Proof
Wallet Files Generated and Secured:
The
findmodule successfully located the wallet files and applied the strict0600permissions so Oracle could read them without throwing ownership errors.Explicit Listener Verification: The pipeline logs now explicitly output the results of
lsnrctl status LISTENER_TCPS, visually confirming the secure protocol is active and correctly bound to port2484while leaving the default TCP listener untouched:Database Startup Success:
The pipeline successfully completed the
db-startsequence (viadbora.service). Because the nativedbstartscript strictly relies on the default TCP port (1521) to verify listener health, this proves ourblockinfilestrategy successfully preserved the default DBCA listener.TDE Encryption Preserved:
The database successfully mounted and opened without ORA decryption errors. This proves that our conditional logic successfully suppressed the global
WALLET_LOCATIONoverride on 26ai, allowing the database engine to natively read its TDE keys.2. Multi-Node Replication Proof
Data Guard Synchronization:
The pipeline successfully executed the
dg-configrole, which natively runs aDGMGRL> SHOW CONFIGURATIONverification step. The resultingSUCCESSstate confirms that the Primary and Standby nodes successfully exchanged passwords, started their respective listeners without crashing, and established robust Data Guard communication over the newly configured environment.Result:
The pipeline returned an
ansible_completed_successstate with zero fatal errors.User Guide
go/user-guide-otk-tls-encryption