help with oracle TLS connection #241
Replies: 1 comment 2 replies
-
The error For thin mode you should be able to add your CA root cert file to the OS store used by openssl (which is what Python uses for its TLS implementation). If it is setup for one-way TLS that's all you need. If you have two-way TLS you will need to have the client certificate and private key in PEM format in ewallet.pem and pass that through to the connect() call with the wallet_location parameter (and supply a wallet_password parameter as well if it is encrypted). There is a new ssl_context parameter available in unreleased code which you can use to perform whatever gymnastics are needed to get the TLS negotiation to complete -- the suggestions in the previous paragraph are preferred, though! So to answer your question: yes, cx_Oracle has support for TLS but you will have to setup a wallet file that it recognizes and configure it correctly in sqlnet.ora. And yes, python-oracledb thick mode behaves exactly the same as cx_Oracle did. Thin mode is more flexible, though. |
Beta Was this translation helpful? Give feedback.
-
Hi,
My org has been using cx_Oracle successfully for some time to talk to our Oracle database (19c) with username/password authentication. Our admin recently was given a new requirement to implement TLS1.2. They gave us a certificate file with a "p7b" extension. The subject of the cert is our database server hostname and it is signed by our org's internal CA. The p7b file does not contain a root cert as far as I can tell (but I do have a separate CA root cert file). "openssl pkcs7" cannot read the p7b file but "openssl x509" can (so what is it?); it appears to be in PEM format.
We were able to add this p7b cert to the Java trust store and that was all we needed to do to get our Java code working.
I'm trying to find the Python/cx_Oracle equivalent but have not had any luck. cx_Oracle fails with the error "ORA-28759: failure to open file".
Since the p7b file appears to not contain a root cert I'm confused as to why it worked with Java?
I experimented a bit with Python's ssl module (although I'm not sure if cx_Oracle uses it). I was able to get it to load the p7b file (but cx_Oracle still fails to connect). I also tried to load the separate CA cert but same result.
We are using cx_Oracle 8.3 on Python 3. Does it support this (TLS)? If not, will python-oracledb? I will upgrade if I have to but I'd rather not right now due to time constraints.
Would greatly appreciate any insight.
Beta Was this translation helpful? Give feedback.
All reactions