Skip to content

Conversation

@charmitro
Copy link
Contributor

Use platform-verifier feature of ureq to validate TLS certificates against the system's certificate store instead of bundled Mozilla certificates. This allows cargo-pgrx to work properly with corporate proxies (both explicit and transparent) that use custom certificate authorities for SSL inspection.

Previously, cargo-pgrx would fail with:

  Error:
     0: unable to retrieve https://www.postgresql.org/versions.rss
     1: io: invalid peer certificate: UnknownIssuer

when used behind corporate proxies, as it could not validate certificates signed by corporate CAs. By using the system's trusted certificate store, we can properly validate these certificates if they are trusted by the host OS.

Closes #2047

@tumluliu
Copy link

thanks! @charmitro , I will try it from my end

@tumluliu
Copy link

From my testing, it worked. I tried the installation with and without the option --no-default-features --features rustls. Both are through.

My OS is Ubuntu24.04.2, rust version is rustc 1.87.0 (17067e9ac 2025-05-09)

❯ echo $HTTPS_PROXY
http://127.0.0.1:8213
❯ cargo pgrx init
   Discovered Postgres v13.21, v14.18, v15.13, v16.9, v17.5
     Creating PGRX_HOME at `/home/xx/.pgrx`
  Downloading Postgres v13.21 from https://ftp.postgresql.org/pub/source/v13.21/postgresql-13.21.tar.bz2
  Downloading Postgres v14.18 from https://ftp.postgresql.org/pub/source/v14.18/postgresql-14.18.tar.bz2
  Downloading Postgres v15.13 from https://ftp.postgresql.org/pub/source/v15.13/postgresql-15.13.tar.bz2
  Downloading Postgres v16.9 from https://ftp.postgresql.org/pub/source/v16.9/postgresql-16.9.tar.bz2
  Downloading Postgres v17.5 from https://ftp.postgresql.org/pub/source/v17.5/postgresql-17.5.tar.bz2
    Untarring Postgres v14.18 to /home/xx/.pgrx/14.18_unpack
     Renaming /home/xx/.pgrx/14.18_unpack/postgresql-14.18 -> /home/xx/.pgrx/14.18
  Configuring Postgres v14.18
    Untarring Postgres v15.13 to /home/xx/.pgrx/15.13_unpack
     Renaming /home/xx/.pgrx/15.13_unpack/postgresql-15.13 -> /home/lu/.pgrx/15.13
  Configuring Postgres v15.13
    Untarring Postgres v13.21 to /home/xx/.pgrx/13.21_unpack
    Untarring Postgres v17.5 to /home/xx/.pgrx/17.5_unpack
    Untarring Postgres v16.9 to /home/xx/.pgrx/16.9_unpack
     Renaming /home/xx/.pgrx/13.21_unpack/postgresql-13.21 -> /home/xx/.pgrx/13.21
  Configuring Postgres v13.21
     Renaming /home/xx/.pgrx/17.5_unpack/postgresql-17.5 -> /home/xx/.pgrx/17.5
  Configuring Postgres v17.5
     Renaming /home/xx/.pgrx/16.9_unpack/postgresql-16.9 -> /home/xx/.pgrx/16.9
  Configuring Postgres v16.9
    Compiling Postgres v14.18
    Compiling Postgres v15.13
    Compiling Postgres v16.9
    Compiling Postgres v17.5
    Compiling Postgres v13.21
   Installing Postgres v13.21 to /home/xx/.pgrx/13.21/pgrx-install
   Installing Postgres v14.18 to /home/xx/.pgrx/14.18/pgrx-install
   Installing Postgres v15.13 to /home/xx/.pgrx/15.13/pgrx-install
   Installing Postgres v16.9 to /home/xx/.pgrx/16.9/pgrx-install
   Installing Postgres v17.5 to /home/xx/.pgrx/17.5/pgrx-install
   Validating /home/xx/.pgrx/13.21/pgrx-install/bin/pg_config
 Initializing data directory at /home/xx/.pgrx/data-13
   Validating /home/xx/.pgrx/14.18/pgrx-install/bin/pg_config
 Initializing data directory at /home/xx/.pgrx/data-14
   Validating /home/xx/.pgrx/15.13/pgrx-install/bin/pg_config
 Initializing data directory at /home/xx/.pgrx/data-15
   Validating /home/xx/.pgrx/16.9/pgrx-install/bin/pg_config
 Initializing data directory at /home/xx/.pgrx/data-16
   Validating /home/xx/.pgrx/17.5/pgrx-install/bin/pg_config
 Initializing data directory at /home/xx/.pgrx/data-17

Thanks for the fix @charmitro !

@charmitro
Copy link
Contributor Author

From my testing, it worked. I tried the installation with and without the option --no-default-features --features rustls. Both are through.

Perfect!

Thanks for the fix @charmitro !

Not a problem, it's up to the maintainers now I guess.

Use `platform-verifier` feature of ureq to validate TLS certificates
against the system's certificate store instead of bundled Mozilla
certificates. This allows cargo-pgrx to work properly with corporate
proxies (both explicit and transparent) that use custom certificate
authorities for SSL inspection.

Previously, cargo-pgrx would fail with:

  Error:
     0: unable to retrieve https://www.postgresql.org/versions.rss
     1: io: invalid peer certificate: UnknownIssuer

when used behind corporate proxies, as it could not validate
certificates signed by corporate CAs. By using the system's trusted
certificate store, we can properly validate these certificates if they
are trusted by the host OS.

Signed-off-by: Charalampos Mitrodimas <[email protected]>
@charmitro charmitro force-pushed the system-certificate-store-for-https branch from 20123f8 to cd0e1d8 Compare May 19, 2025 13:11
@charmitro
Copy link
Contributor Author

@eeeebbbbrrrr

CI issue should be fixed now. Can we re-run the CI?

@eeeebbbbrrrr
Copy link
Contributor

CI issue should be fixed now. Can we re-run the CI?

Yup.

Thanks for the PR. Corporate networks are such a pain and basically impossible for the rest of us to even test/predict.

@charmitro
Copy link
Contributor Author

CI issue should be fixed now. Can we re-run the CI?

Yup.

Thanks for the PR. Corporate networks are such a pain and basically impossible for the rest of us to even test/predict.

Exactly, that's why I asked @tumluliu to test it, for which I'm thankful!

@eeeebbbbrrrr
Copy link
Contributor

Thanks for your work. Merging this now. I will probably get another pgrx release out this week, so y'all hang tight.

@eeeebbbbrrrr eeeebbbbrrrr merged commit f96b8e0 into pgcentralfoundation:develop May 19, 2025
15 checks passed
KenjiBrown pushed a commit to SoftwareLibreMx/pgrx that referenced this pull request May 27, 2025
…ralfoundation#2074)

Use `platform-verifier` feature of `ureq` to validate TLS certificates
against the system's certificate store instead of bundled Mozilla
certificates. This allows cargo-pgrx to work properly with corporate
proxies (both explicit and transparent) that use custom certificate
authorities for SSL inspection.

Signed-off-by: Charalampos Mitrodimas <[email protected]>
eeeebbbbrrrr added a commit that referenced this pull request Jun 28, 2025
Welcome to pgrx v0.15.0. This begins a new series for pgrx that includes
support for Postgres 18. As of this release, that means Postgres
18beta1.

This release does contain a few breaking API changes but they're largely
mechanical. Don't worry, the compiler will let you know!

As always, please install our CI tool with `cargo install cargo-pgrx
--version 0.15.0 --locked` and then run `cargo pgrx upgrade` in all of
your extension crates.

If you want to start working with Postgres 18beta1, you'll also need to
re-init your pgrx environment with `cargo pgrx init`. That will
automatically detect all the latest Postgres versions, including
18beta1.

At the top here, I'd like to thank @silver-ymz for the 18beta1 support.
It was a pleasant surprise to see that work come from the community --
it's no easy task to add a new Postgres version to pgrx!

That said, as Postgres 18 is currently beta, you should consider pgrx'
support for it as beta too. Please report any problems with 18beta1 (or
discrepancies with other versions) as GitHub issues.

Also, this release requires rust v1.88.0 or greater. `if-let` chains are
now a thing and we're not afraid to use them.

# What's Changed

## Postgres 18beta1 Support

* Support Postgres 18beta1 by @silver-ymz in
#2056
* pg18 support: add header and implement `#define` by @eeeebbbbrrrr in
#2094
* improve pg_magic_func by @usamoi in
#2088


## More Headers

* Added `catalog/heap.h` binding by @ccleve in
#2072
* include `utils/pg_status.h` by @eeeebbbbrrrr in
#2091


## `cargo-pgrx` improvements

* Pass `LLVM_*` variables to `--runas` command by @theory in
#2083
* `does_db_exist()`: fix `psql` argument order by @eeeebbbbrrrr in
#2093
* `cargo pgrx regress` output is no longer fully buffered by
@eeeebbbbrrrr in #2095
* Detect `pgrx_embed` name from lib name by @YohDeadfall in
#2035
* Fixed error message if no artifact found by @YohDeadfall in
#2034
* `cargo-pgrx`: use system certificate store for HTTPS validation by
@charmitro in #2074
* Decoding command output in Windows by @if0ne in
#2084


## Breaking Changes

* fix GUC by @usamoi in
#2064
* refactor GUC by @usamoi in
#2066

## New Stuff

* Added `pg_binary_protocol` attribute to derive send and receive
functions for `PostgresType` by @LucaCappelletti94 in
#2068
* Expose guc hooks by @thesuhas in
#2075
* Allows to create multiple aggregates for the same Rust type by @if0ne
in #2078



## General Code Cleanup

* `cargo clippy --fix` by @eeeebbbbrrrr in
#2092
* Use `if-let` to unpack Options by @stuhood in
#2089
* docs: fix typo in `rust_byte_slice_to_bytea()` docs by @burmecia in
#2071
* Added a missing `#[doc(hidden)]` by @LucaCappelletti94 in
#2079

## Administrative

* Updated Fedora to latest in CI by @YohDeadfall in
#2085
* fix ci on beta rust (1.89) by @usamoi in
#2087

## New Contributors

Much thanks to our new contributors! Your work is sincerely appreciated!

* @charmitro made their first contribution in
#2074
* @thesuhas made their first contribution in
#2075
* @if0ne made their first contribution in
#2084
* @stuhood made their first contribution in
#2089

**Full Changelog**:
v0.14.3...v0.15.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Issue when used with corporate proxy (transparent or not)

3 participants