Skip to content

fix(query): route transaction executor through the SSH tunnel - #339

Open
Maxteabag wants to merge 1 commit into
mainfrom
fix/ssh-tunnel-transaction-executor
Open

Maxteabag wants to merge 1 commit into
mainfrom
fix/ssh-tunnel-transaction-executor

Conversation

@Maxteabag

Copy link
Copy Markdown
Owner

Multi-statement scripts, gt and BEGIN (and every query when the process worker is off) opened a fresh connection from the original config, so they tried to reach the database host directly instead of going through the SSH tunnel. The transaction executor now reuses the session's tunnel, or opens and closes its own when there isn't one.

Reproduced and verified against the docker SSH bastion + postgres-ssh setup: all four paths failed with "could not translate host name" before, and all go through the tunnel's local port now. gt also keeps session state between statements over SSH.

Also fixes the SSH test container, which never actually had TCP forwarding enabled: the init script edited the template config instead of the one sshd runs with, and the tunnel mod gets skipped when lscr.io can't be reached.

Refs #337. Running a batch on one connection without BEGIN/COMMIT, the other thing asked for there, isn't part of this.

TransactionExecutor connected with the session's original config, so
multi-statement scripts, gt, BEGIN and (with the process worker off)
every query went straight to the database host and skipped the tunnel.
It now reuses the session's tunnel, or opens and closes its own.

Also fix the SSH test container: the init script edited the template
sshd_config instead of /config/sshd/sshd_config, and the tunnel mod is
skipped when lscr.io is unreachable, leaving AllowTcpForwarding off.

Refs #337

This branch has not been deployed

No deployments
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.

1 participant