Skip to content

Commit

Permalink
13758: SSH control host port setting not used when tunneling (#14295)
Browse files Browse the repository at this point in the history
* 13758: ssh port fixed

* 13758: version updated

* 13758: changelog updated

* 13758: merge fix

* 13758: docker image version updated

* 13758: docker image version updated

* 13758: docker image version updated as deployment was unsuccesful

Co-authored-by: Greg Solovyev <grishick@users.noreply.github.com>
  • Loading branch information
kimerinn and grishick authored Aug 4, 2022
1 parent 79a54a8 commit 8161d8d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion airbyte-integrations/bases/base-normalization/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ WORKDIR /airbyte
ENV AIRBYTE_ENTRYPOINT "/airbyte/entrypoint.sh"
ENTRYPOINT ["/airbyte/entrypoint.sh"]

LABEL io.airbyte.version=0.2.14
LABEL io.airbyte.version=0.2.16
LABEL io.airbyte.name=airbyte/normalization
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
public class NormalizationRunnerFactory {

public static final String BASE_NORMALIZATION_IMAGE_NAME = "airbyte/normalization";
public static final String NORMALIZATION_VERSION = "0.2.14";
public static final String NORMALIZATION_VERSION = "0.2.16";

static final Map<String, ImmutablePair<String, DefaultNormalizationRunner.DestinationType>> NORMALIZATION_MAPPING =
ImmutableMap.<String, ImmutablePair<String, DefaultNormalizationRunner.DestinationType>>builder()
Expand Down
11 changes: 6 additions & 5 deletions airbyte-workers/src/main/resources/sshtunneling.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ function openssh() {
tunnel_method=$(cat $1 | jq -r '.tunnel_map.tunnel_method' | tr '[:lower:]' '[:upper:]')
tunnel_username=$(cat $1 | jq -r '.tunnel_map.tunnel_user')
tunnel_host=$(cat $1 | jq -r '.tunnel_map.tunnel_host')
tunnel_port=$(cat $1 | jq -r '.tunnel_map.tunnel_port')
tunnel_local_port=$(cat $1 | jq -r '.local_port')
# set a path for a control socket, allowing us to close this specific ssh connection when desired
tmpcontrolsocket="/tmp/sshsocket${tunnel_db_remote_port}-${RANDOM}"
Expand All @@ -33,8 +34,8 @@ function openssh() {
tmpkeyfile=$(mktemp /tmp/xyzfile.XXXXXXXXXXX) || return 1
cat $1 | jq -r '.tunnel_map.ssh_key | gsub("\\\\n"; "\n")' > $tmpkeyfile
# -f=background -N=no remote command -M=master mode StrictHostKeyChecking=no auto-adds host
echo "Running: ssh -f -N -M -o StrictHostKeyChecking=no -S {control socket} -i {key file} -l ${tunnel_username} -L ${tunnel_local_port}:${tunnel_db_host}:${tunnel_db_port} ${tunnel_host}"
ssh -f -N -M -o StrictHostKeyChecking=no -S $tmpcontrolsocket -i $tmpkeyfile -l ${tunnel_username} -L ${tunnel_local_port}:${tunnel_db_host}:${tunnel_db_port} ${tunnel_host} &&
echo "Running: ssh -f -N -M -o StrictHostKeyChecking=no -S {control socket} -i {key file} -l ${tunnel_username} -L ${tunnel_local_port}:${tunnel_db_host}:${tunnel_db_port} -p ${tunnel_port} ${tunnel_host}"
ssh -f -N -M -o StrictHostKeyChecking=no -S $tmpcontrolsocket -i $tmpkeyfile -l ${tunnel_username} -L ${tunnel_local_port}:${tunnel_db_host}:${tunnel_db_port} -p ${tunnel_port} ${tunnel_host} &&
sshopen="yes" &&
echo "ssh tunnel opened"
rm -f $tmpkeyfile
Expand All @@ -49,8 +50,8 @@ function openssh() {
fi
# put ssh password in env var for use in sshpass. Better than directly passing with -p
export SSHPASS=$(cat $1 | jq -r '.tunnel_map.tunnel_user_password')
echo "Running: sshpass -e ssh -f -N -M -o StrictHostKeyChecking=no -S {control socket} -l ${tunnel_username} -L ${tunnel_local_port}:${tunnel_db_host}:${tunnel_db_port} ${tunnel_host}"
sshpass -e ssh -f -N -M -o StrictHostKeyChecking=no -S $tmpcontrolsocket -l ${tunnel_username} -L ${tunnel_local_port}:${tunnel_db_host}:${tunnel_db_port} ${tunnel_host} &&
echo "Running: sshpass -e ssh -f -N -M -o StrictHostKeyChecking=no -S {control socket} -l ${tunnel_username} -L ${tunnel_local_port}:${tunnel_db_host}:${tunnel_db_port} -p ${tunnel_port} ${tunnel_host}"
sshpass -e ssh -f -N -M -o StrictHostKeyChecking=no -S $tmpcontrolsocket -l ${tunnel_username} -L ${tunnel_local_port}:${tunnel_db_host}:${tunnel_db_port} -p ${tunnel_port} ${tunnel_host} &&
sshopen="yes" &&
echo "ssh tunnel opened"
fi
Expand All @@ -61,7 +62,7 @@ function openssh() {
function closessh() {
# $sshopen $tmpcontrolsocket comes from openssh() function
if [ ! -z "$sshopen" ] ; then
ssh -S $tmpcontrolsocket -O exit ${tunnel_host} &&
ssh -S $tmpcontrolsocket -O exit -p ${tunnel_port} ${tunnel_host} &&
echo "closed ssh tunnel"
trap 'rm -f "$tmpcontrolsocket"' EXIT
fi
Expand Down
1 change: 1 addition & 0 deletions docs/understanding-airbyte/basic-normalization.md
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ Therefore, in order to "upgrade" to the desired normalization version, you need

| Airbyte Version | Normalization Version | Date | Pull Request | Subject |
|:----------------|:----------------------|:-----------| :--- |:---------------------------------------------------------------------------|
| | 0.2.16 | 2022-08-04 | [\#14295](https://github.com/airbytehq/airbyte/pull/14295) | Fixed SSH tunnel port usage |
| | 0.2.14 | 2022-08-01 | [\#14790](https://github.com/airbytehq/airbyte/pull/14790) | Add and persist job failures for Normalization |
| | 0.2.13 | 2022-07-27 | [\#14683](https://github.com/airbytehq/airbyte/pull/14683) | Quote schema name to allow reserved keywords |
| | 0.2.12 | 2022-07-26 | [\#14362](https://github.com/airbytehq/airbyte/pull/14362) | Handle timezone in date-time format. Parse date correct in clickhouse. |
Expand Down

0 comments on commit 8161d8d

Please sign in to comment.