Skip to content

Commit c91a893

Browse files
committed
2.0.3: fix the support for OCI_INSTANCE FQDNs in port-forwarding tunnels
1 parent eacbc2e commit c91a893

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

ssh-oci-bastion.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,10 @@ ENVIRONMENT
4545
* \`perl\`
4646
4747
* Required environment variables:
48-
* \`OCI_INSTANCE\`, Internal FQDN or Private IP e.g., \`kharkiv.subxxx.main.oraclevcn.com\`
4948
* \`OCI_INSTANCE_OCID\`, e.g., \`ocid1.instance.oc1.iad.xx\`
5049
* \`OCI_BASTION_OCID\`, e.g., \`ocid1.bastion.oc1.iad.xx\`
50+
* For \`host_user\` SSH sessions only:
51+
* \`OCI_INSTANCE\`, Internal FQDN or Private IP e.g., \`kharkiv.subxxx.main.oraclevcn.com\`
5152
5253
* One of the following SSH public keys in \`~/.ssh/\`: \`id_rsa.pub\`, \`id_dsa.pub\`, \`id_ecdsa.pub\`,
5354
\`id_ed25519.pub\`, or \`id_xmss.pub\`. If there are multiple keys the first one found in this order will be used.
@@ -61,7 +62,7 @@ ENVIRONMENT
6162
ProxyJump
6263
\`\`\`
6364
64-
v2.0.2 May 2023 Created by Dima Korobskiy
65+
v2.0.3 May 2023 Created by Dima Korobskiy
6566
Credits: George Chacko, Oracle
6667
HEREDOC
6768
exit 1
@@ -147,9 +148,10 @@ if [[ $port ]]; then
147148
# `--session-ttl`: session duration in seconds (defaults to 30 minutes, maximum is 3 hours).
148149
# `--wait-interval-seconds`: state check interval (defaults to 30 seconds).
149150
# `--ssh-public-key-file` is required
151+
# `--target-private-ip` "${OCI_INSTANCE}"
150152
# shellcheck disable=SC2086 # $PROFILE_OPT is a two-word CLI option
151153
session_ocid=$(time oci bastion session create-port-forwarding $PROFILE_OPT --bastion-id "$OCI_BASTION_OCID" \
152-
--target-resource-id "$OCI_INSTANCE_OCID" --target-private-ip "${OCI_INSTANCE}" --target-port "$port" \
154+
--target-resource-id "$OCI_INSTANCE_OCID" --target-port "$port" \
153155
--session-ttl $MAX_TTL --ssh-public-key-file $SSH_PUB_KEY --wait-for-state SUCCEEDED --wait-for-state FAILED \
154156
--wait-interval-seconds $CHECK_INTERVAL_SEC | jq --raw-output '.data.resources[0].identifier')
155157
echo "Bastion Port Forwarding Session OCID=$session_ocid"

0 commit comments

Comments
 (0)