| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| else: | ||
| sslmode = SSLMode.disable | ||
|
|
||
| if sslcert is None: |
There was a problem hiding this comment.
An explicit SSLContext passed to connect() is considered to be of higher priority than the environment, so let's move this block inside if isinstance(ssl, (str, SSLMode)): above.
Sorry, something went wrong.
| if sslcert: | ||
| ssl.load_cert_chain(sslcert, keyfile=sslkey) | ||
| if sslrootcert: | ||
| ssl.load_verify_locations(cafile=sslrootcert) |
There was a problem hiding this comment.
load_verify_locations also supports CRL (just call it again), so let's add that while we are here.
Sorry, something went wrong.
|
You are a hero! This works great. |
Sorry, something went wrong.
|
Can this PR be approved and merged please ? Most deployments use SSL settings. |
Sorry, something went wrong.
| max_cacheable_statement_size=1024 * 15, | ||
| command_timeout=None, | ||
| ssl=None, | ||
| sslcert=None, |
There was a problem hiding this comment.
There's no need for all the extra arguments in connect(). If you need to customize the certs, you are supposed to pass an appropriate SSLContext in the ssl argument.
Sorry, something went wrong.
|
I removed the redundant ssl* arguments from connect(), added examples on how to properly configure SSLContext to achieve the same result and wrote tests for client certificate validation. @fantix, please take a quick look. |
Sorry, something went wrong.
There was a problem hiding this comment.
I tested to call SSLContext.load_verify_locations() twice - as far as the second is CRL, the CA cert set in the first call is not overwritten, so I think this PR is good.
Sorry, something went wrong.
Changes ------- * Drop support for Python 3.5 (#777) (by @and-semakin in da58cd2 for #777) * Add support for Python 3.10 (#795) (by @elprans in abf5569 for #795) * Add support for asynchronous iterables to copy_records_to_table() (#713) (by @elprans in 1d33ff6 for #713) * Add support for coroutine functions as listener callbacks (#802) (by @elprans in 41da093 for #802) * Add support for sslcert, sslkey and sslrootcert parameters to DSN (#768) (by @jdobes and @elprans in c674e86 for #768) * Add copy_ wrappers to Pool (#661) (by @elprans in a6b0f28 for #661) * Add issubset and issuperset methods to the Range type (#563) (by @kdorsel in de07d0a for #563) Fixes ----- * Break connection internal circular reference (#774) (by @fantix in d08a9b8 for #774) * Make Server Version Extraction More Flexible (#778) (by @Natrinicle in d076169 for #778)
Changes ------- * Drop support for Python 3.5 (#777) (by @and-semakin in da58cd2 for #777) * Add support for Python 3.10 (#795) (by @elprans in abf5569 for #795) * Add support for asynchronous iterables to copy_records_to_table() (#713) (by @elprans in 1d33ff6 for #713) * Add support for coroutine functions as listener callbacks (#802) (by @elprans in 41da093 for #802) * Add support for sslcert, sslkey and sslrootcert parameters to DSN (#768) (by @jdobes and @elprans in c674e86 for #768) * Add copy_ wrappers to Pool (#661) (by @elprans in a6b0f28 for #661) * Add issubset and issuperset methods to the Range type (#563) (by @kdorsel in de07d0a for #563) Fixes ----- * Break connection internal circular reference (#774) (by @fantix in d08a9b8 for #774) * Make Server Version Extraction More Flexible (#778) (by @Natrinicle in d076169 for #778)
Changes ------- * Drop support for Python 3.5 (#777) (by @and-semakin in da58cd2 for #777) * Add support for Python 3.10 (#795) (by @elprans in abf5569 for #795) * Add support for asynchronous iterables to copy_records_to_table() (#713) (by @elprans in 1d33ff6 for #713) * Add support for coroutine functions as listener callbacks (#802) (by @elprans in 41da093 for #802) * Add support for sslcert, sslkey and sslrootcert parameters to DSN (#768) (by @jdobes and @elprans in c674e86 for #768) * Add copy_ wrappers to Pool (#661) (by @elprans in a6b0f28 for #661) * Add issubset and issuperset methods to the Range type (#563) (by @kdorsel in de07d0a for #563) Fixes ----- * Break connection internal circular reference (#774) (by @fantix in d08a9b8 for #774) * Make Server Version Extraction More Flexible (#778) (by @Natrinicle in d076169 for #778)
| Back | FazBrowse Home | New Git URL |
Allows to set sslcert, sslkey and sslrootcert connection parameters. Fixes #238 as it's not possible to set custom SSLContext object with loaded CA certificate in current version.
Example:
conn = await asyncpg.connect(user='user', password='password', database='database', host='some.rds.aws.com', ssl='verify-full', sslrootcert='/etc/rds.pem')