Repository navigation
Verify the server certificate against the host name in utilities run over an SSH tunnel. #10861 - #10915
Conversation
…over an SSH tunnel. pgadmin-org#10861 Backup, restore, maintenance, import/export and the materialised view refresh were given the tunnel's local address as their host, so with sslmode=verify-full libpq checked the server certificate against 127.0.0.1 and the utility failed. They now get the database host name and the tunnel's local port, and reach the local end of the tunnel through PGHOSTADDR, as the interactive connection does. Closes pgadmin-org#10861
|
No actionable comments were generated in the recent review. WalkthroughFor SSH-tunneled connections, utility invocations now use the configured database host while retaining the tunnel’s local port. Background processes set ChangesUtility Connections Through SSH Tunnels
Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix · Severity of issue fixed: Medium Suggested reviewers: Merge Risk:
|
Summary
127.0.0.1) as the host, so withsslmode=verify-fulllibpq checked the certificate against that address and the utility failed.--host(orPGHOST) with the tunnel's local port, andBatchProcess._set_env_variables()setsPGHOSTADDRto the tunnel's local address in place of dropping it, matching the interactive connection (create_connection_string()already useshostplushostaddr).PGHOSTADDRis inherited by thepg_dumpprocessespg_dumpallstarts, so they route through the tunnel too.127.0.0.1.Test plan
utils.tests.test_utility_ssh_tunnel:--host/--portfor backup,pg_restoreand plain restore, andPGHOSTADDRin the utility environment, with and without a tunnel; 5 of its scenarios fail on master.misc.bgprocess.tests,tools.backup.tests,tools.restore.tests,tools.maintenance.tests,tools.import_export.tests,utils.tests.test_utility_conninfo_call_sitespsql -h db.example.invalidwithPGHOSTADDR=127.0.0.1connects through the given address, and withPGSSLMODE=verify-fullgoes on to certificate verification.Closes #10861
Summary by CodeRabbit