Re: Support for NSS as a libpq TLS backend
Jacob Champion <pchampion@vmware.com>
From: Jacob Champion <pchampion@vmware.com>
To: "daniel@yesql.se" <daniel@yesql.se>
Cc: "hlinnaka@iki.fi" <hlinnaka@iki.fi>, "pgsql-hackers@lists.postgresql.org" <pgsql-hackers@lists.postgresql.org>, "andrew.dunstan@2ndquadrant.com" <andrew.dunstan@2ndquadrant.com>, "sfrost@snowman.net" <sfrost@snowman.net>, "thomas.munro@gmail.com" <thomas.munro@gmail.com>, "michael@paquier.xyz" <michael@paquier.xyz>, "andres@anarazel.de" <andres@anarazel.de>
Date: 2021-02-02T00:42:23Z
Lists: pgsql-hackers
On Mon, 2021-02-01 at 21:49 +0100, Daniel Gustafsson wrote: > > On 29 Jan 2021, at 19:46, Jacob Champion <pchampion@vmware.com> wrote: > > I think the bad news is that the static approach will need support for > > ENABLE_THREAD_SAFETY. > > I did some more reading today and noticed that the NSS documentation (and their > sample code for doing crypto without TLS connections) says to use NSS_NoDB_Init > to perform a read-only init which don't require a matching close call. Now, > the docs aren't terribly clear and also seems to have gone offline from MDN, > and skimming the code isn't entirelt self-explanatory, so I may well have > missed something. The v24 patchset posted changes to this and at least passes > tests with decent performance so it seems worth investigating. Nice! Not having to close helps quite a bit. (Looks like thread safety for NSS_Init was added in 3.13, so we have an absolute version floor.) > > (It looks like the NSS implementation of pgtls_close() needs some thread > > support too?) > > Storing the context in conn would probably be better? Agreed. > > The good(?) news is that I don't understand why OpenSSL's > > implementation of cryptohash doesn't _also_ need the thread-safety > > code. (Shouldn't we need to call CRYPTO_set_locking_callback() et al > > before using any of its cryptohash implementation?) So maybe we can > > implement the same global setup/teardown API for OpenSSL too and not > > have to one-off it for NSS... > > No idea here, wouldn't that impact pgcrypto as well in that case? If pgcrypto is backend-only then I don't think it should need multithreading protection; is that right? --Jacob
Commits
-
Add tab-completion for CREATE FOREIGN TABLE.
- 74527c3e022d 15.0 cited
-
Add tap tests for the schema publications.
- 6b0f6f79eef2 15.0 cited
-
Move Perl test modules to a better namespace
- b3b4d8e68ae8 15.0 cited
-
Adjust configure to insist on Perl version >= 5.8.3.
- 92e6a98c3636 15.0 cited
-
Simplify code related to compilation of SSL and OpenSSL
- 092b785fad3d 14.0 landed
-
Introduce --with-ssl={openssl} as a configure option
- fe61df7f82aa 14.0 landed
-
Implement support for bulk inserts in postgres_fdw
- b663a4136331 14.0 cited
-
Fix redundant error messages in client tools
- 6be725e70161 14.0 cited
-
doc: Apply more consistently <productname> markup for OpenSSL
- 089da3c4778f 14.0 landed
-
Check ssl_in_use flag when reporting statistics
- 6a5c750f3f72 14.0 cited