-
Notifications
You must be signed in to change notification settings - Fork 86
Improve TLS connection implementation to support use of one way TLS certificates without needing OS recognition #65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
To be clear: unencrypted .pem for mTLS connections work just fine. The issue is that if the .pem file does NOT contain a private key, the code fails -- this occurs with one-way TLS, when only the certificates are included. The usual solution is to get the OS to recognize the certificates, but if this is not an option, some approach is needed to get Python to recognize them for this particular TLS connection. As such, simply checking for the |
Hi Anthony, Ok, I see. Sorry for me using the wrong terminology here, I don't have speific knowledge about encryption protocols in general, and TLS connection in particular. I have updated the title of the issue, but not my first post. Hm, ok. I agree that, ideally, the change that I suggested is not enough, insofar as the behavior of the function / of the library needs to be consistent overall, and that this change would need to be properly advertised / we would need to let people know how it works. Anyway, thank you for considering it. |
Looking further into this, I suspect it may be possible to just do this: try:
ssl_context.load_cert_chain(pem_file_name,
password=params._get_wallet_password())
except ssl.SSLError:
pass In other words, try to load the certificate chain from the supplied PEM file and simply ignore the error if it is unsuccessful. The error (as noted) isn't really all that helpful anyway! If one-way TLS is set up, it will work, and if 2-way TLS is required, a different error will be raised. I'm just checking internally to see what that looks like with an older database. Stay tuned! |
Hi Anthony, |
Not yet, unfortunately. I'm still waiting but will prod internally again. :-) |
than requiring OS recognition of certificates (#65).
I was finally able to test with an older database. When supplying an invalid password for an encrypted PEM file, instead of this error
you will now get
And for your case, you can now supply a PEM file containing just certificates and this will be used to validate the server without requiring the OS to recognize the server certificate. This patch will go into the next release of python-oracledb. Thanks for your patience! |
Hi Anthony, Awesome, thank you! |
You're welcome. This will likely become part of 1.1.2, but it depends on a number of factors. You can "watch" this repository -- just for new releases if that is all you're interested in! |
Nice, did not know about this functionality of github, thank you! Should I let you close this issue, once the release has occurred? Or should I do it myself? |
I usually add one more comment when the release is made and then close it, but if you prefer to close it now, that's fine, too! |
Ok, then no, I would prefer that you do as you usually do : ) |
This is part of oracledb 1.2.0 which was just released. |
Got it, I saw that, now things work great on my end, thank you : ) ! |
Hi Francois, |
Hi @rudolfnoe , I'm sorry, but I'm not a maintainer of this library, and now that the need that I had opened this issue for has been met, I have forgotten much about it. |
Hi @FrancoisNoyez, |
Hi @rudolfnoe |
Hi @FrancoisNoyez, |
Hi @rudolfnoe |
Hello @rudolfnoe |
Talking about version 1.1.0.
The current version does not allow to use unencrypted .pem file for mTLS connection, for which the following code, found at line 134 of the 'src/oracledb/impl/thin/crypto.pyx' module, fails in that case:
Things work if we make this code line conditional, for instance on whether a password to decrypt the certificate is actually provided:
Cf this discussion on the forum: something like that is necessary when one is using the Oracle Cloud functionality of the Amazon Cloud service, and notably when one is not admin of the server actually hosting the Oracle database.
The text was updated successfully, but these errors were encountered: