ssh timeout

benjamin January 9, 2025

 

Trying to connect to our SSH server and having trouble: keep getting "Operation timed Out"

My network team tells me we have allowed atlassian IPs

Tried atlassinan ip ranges = true

Do I need to use the OIDC stuff?  If so, is there and example?

Our Yaml code is below I have debug enabled but i'm not sure how to decipher the debug results which are also below

 

# This is an example Starter pipeline configuration # Use a skeleton to build, test and deploy using manual and parallel steps # ----- # You can specify a custom docker image from Docker Hub as your build environment. #image: atlassian/default-image:3 options: runtime: cloud: atlassian-ip-ranges: true pipelines: custom: # Pipelines that can only be triggered manually custom-name-and-region: #name of this pipeline - variables: #list variable names under here - name: ProgramName - step: script: - echo $ProgramName deployment-to-prod: - variables: #list variable names under here - name: ProgramName - step: size: 2x script: - echo "Program Name is " $ProgramName - pipe: atlassian/ssh-run:0.8.1 variables: SSH_USER: 'USER' SERVER: 'SERVER' EXTRA_ARGS: '-vvvv SERVER' #EXTRA_ARGS: '-o IPQoS=none USER@SERVER' #EXTRA_ARGS: #'-strictHostKeyChecking=no' #EXTRA_ARGS: '-vvvv SERVER -o -strictHostKeyChecking=no' #- '-o ControlMaster=auto' # - "-vvv SERVER" #- "-o StrictHostKeyChecking=no" # Optional DEBUG: 'true' COMMAND: 'echo $HOSTNAME' #COMMAND: '"powershell.exe -Dir C:\data\" ' # - ssh USER@SERVER 'echo "connected"' #- echo "powershell.exe -FILE Z:\OBJECT\PUBLISHOBJECTS.BAT $ProgramName" #- pipe: atlassian/ssh-run:0.6.0 # variables: # SSH_USER: USER # SERVER: SERVER #DEBUG: 'true' #COMMAND: 'powershell.exe -FILE Z:\OBJECT\PUBLISHOBJECTS.BAT'

 

here is the debug:  (I have replaced the user and server ip for security reasons)

 

#57 4210c2fbitbucket-pipelines.yml edited online with Bitbucket - no imagewill use default main custom: deployment-to-prod Learn more about reports 2min 39 sec 11 minutes ago benjamin Pipeline Step 1 2m 38s Build docker Artifacts Build setup17s echo "Program Name is " $ProgramName<1s pipe: atlassian/ssh-run:0.8.12m 13s + docker container run \ --volume=/opt/atlassian/pipelines/agent/build:/opt/atlassian/pipelines/agent/build \ --volume=/opt/atlassian/pipelines/agent/ssh:/opt/atlassian/pipelines/agent/ssh:ro \ --volume=/opt/atlassian/pipelines/bin/docker:/usr/local/bin/docker:ro \ --volume=/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes:/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes \ --volume=/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes/atlassian/ssh-run:/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes/atlassian/ssh-run \ --workdir=$(pwd) \ --label=org.bitbucket.pipelines.system=true \ --env=BITBUCKET_STEP_TRIGGERER_UUID="$BITBUCKET_STEP_TRIGGERER_UUID" \ --env=BITBUCKET_REPO_FULL_NAME="$BITBUCKET_REPO_FULL_NAME" \ --env=BITBUCKET_GIT_HTTP_ORIGIN="$BITBUCKET_GIT_HTTP_ORIGIN" \ --env=BITBUCKET_PROJECT_UUID="$BITBUCKET_PROJECT_UUID" \ --env=BITBUCKET_REPO_IS_PRIVATE="$BITBUCKET_REPO_IS_PRIVATE" \ --env=BITBUCKET_WORKSPACE="$BITBUCKET_WORKSPACE" \ --env=BITBUCKET_SSH_KEY_FILE="$BITBUCKET_SSH_KEY_FILE" \ --env=BITBUCKET_REPO_OWNER_UUID="$BITBUCKET_REPO_OWNER_UUID" \ --env=BITBUCKET_BRANCH="$BITBUCKET_BRANCH" \ --env=BITBUCKET_REPO_UUID="$BITBUCKET_REPO_UUID" \ --env=BITBUCKET_PROJECT_KEY="$BITBUCKET_PROJECT_KEY" \ --env=BITBUCKET_REPO_SLUG="$BITBUCKET_REPO_SLUG" \ --env=CI="$CI" \ --env=BITBUCKET_REPO_OWNER="$BITBUCKET_REPO_OWNER" \ --env=BITBUCKET_STEP_RUN_NUMBER="$BITBUCKET_STEP_RUN_NUMBER" \ --env=BITBUCKET_BUILD_NUMBER="$BITBUCKET_BUILD_NUMBER" \ --env=BITBUCKET_GIT_SSH_ORIGIN="$BITBUCKET_GIT_SSH_ORIGIN" \ --env=BITBUCKET_PIPELINE_UUID="$BITBUCKET_PIPELINE_UUID" \ --env=BITBUCKET_COMMIT="$BITBUCKET_COMMIT" \ --env=BITBUCKET_CLONE_DIR="$BITBUCKET_CLONE_DIR" \ --env=PIPELINES_JWT_TOKEN="$PIPELINES_JWT_TOKEN" \ --env=BITBUCKET_STEP_UUID="$BITBUCKET_STEP_UUID" \ --env=BITBUCKET_DOCKER_HOST_INTERNAL="$BITBUCKET_DOCKER_HOST_INTERNAL" \ --env=DOCKER_HOST="tcp://host.docker.internal:2375" \ --env=BITBUCKET_PIPE_SHARED_STORAGE_DIR="/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes" \ --env=BITBUCKET_PIPE_STORAGE_DIR="/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes/atlassian/ssh-run" \ --env=COMMAND="echo $HOSTNAME" \ --env=DEBUG="true" \ --env=EXTRA_ARGS="-o IPQoS=none -o ControlMaster=auto -vvv" \ --env=SERVER="SERVER" \ --env=SSH_USER="USER" \ --add-host="host.docker.internal:$BITBUCKET_DOCKER_HOST_INTERNAL" \ bitbucketpipelines/ssh-run:0.8.1 Unable to find image 'bitbucketpipelines/ssh-run:0.8.1' locally 0.8.1: Pulling from bitbucketpipelines/ssh-run 930bdd4d222e: Pulling fs layer 6fcdd0828300: Pulling fs layer 5f1d0e572c66: Pulling fs layer 178d833920d1: Pulling fs layer 178d833920d1: Waiting 5f1d0e572c66: Verifying Checksum 5f1d0e572c66: Download complete 6fcdd0828300: Verifying Checksum 6fcdd0828300: Download complete 178d833920d1: Verifying Checksum 178d833920d1: Download complete 930bdd4d222e: Verifying Checksum 930bdd4d222e: Download complete 930bdd4d222e: Pull complete 6fcdd0828300: Pull complete 5f1d0e572c66: Pull complete 178d833920d1: Pull complete Digest: sha256:3c4b6223ce5f06ae407b8c184a02c49802c78dabf59c12b7825e24792fc54d10 Status: Downloaded newer image for bitbucketpipelines/ssh-run:0.8.1 INFO: Executing the pipe... INFO: Enabling debug mode. + validate + : SSH_USER=USER + : SERVER=SERVER + : COMMAND=echo df83cfc4-ee07-4bc6-b519-c64972c94648-fx9k9 + : MODE=command + : DEBUG=true + setup_ssh_dir + INJECTED_SSH_CONFIG_DIR=/opt/atlassian/pipelines/agent/ssh + IDENTITY_FILE=/opt/atlassian/pipelines/agent/ssh/id_rsa_tmp + KNOWN_SERVERS_FILE=/opt/atlassian/pipelines/agent/ssh/known_hosts + mkdir -p /root/.ssh + touch /root/.ssh/authorized_keys + '[' -n '' ']' + '[' '!' -f /opt/atlassian/pipelines/agent/ssh/id_rsa_tmp ']' INFO: Using default ssh key + info 'Using default ssh key' + echo -e '\e[36mINFO: Using default ssh key\e[0m' + cp /opt/atlassian/pipelines/agent/ssh/id_rsa_tmp /root/.ssh/pipelines_id + '[' '!' -f /opt/atlassian/pipelines/agent/ssh/known_hosts ']' + cat /opt/atlassian/pipelines/agent/ssh/known_hosts + '[' -f /root/.ssh/config ']' + echo 'IdentityFile ~/.ssh/pipelines_id' + chmod -R go-rwx /root/.ssh/ + run_pipe + '[' '!' -z ']' + IFS=' ' + read -r -a EXTRA_ARGS + '[' '!' -z ']' + IFS=' ' + read -r -a ENV_VARS + [[ command = \c\o\m\m\a\n\d ]] + info 'Executing command on SERVER' + echo -e '\e[36mINFO: Executing command on SERVER\e[0m' INFO: Executing command on SERVER + run ssh -A -tt -i /root/.ssh/pipelines_id -o StrictHostKeyChecking=no -p 22 -o IPQoS=none -o ControlMaster=auto -vvv USER@SERVER 'bash -c '\''echo df83cfc4-ee07-4bc6-b519-c64972c94648-fx9k9'\''' ++ date +%s ssh -A -tt -i /root/.ssh/pipelines_id -o StrictHostKeyChecking=no -p 22 -o IPQoS=none -o ControlMaster=auto -vvv USER@SERVER bash -c 'echo df83cfc4-ee07-4bc6-b519-c64972c94648-fx9k9' + output_file=/var/tmp/pipe-1736444113-21005 + echo ssh -A -tt -i /root/.ssh/pipelines_id -o StrictHostKeyChecking=no -p 22 -o IPQoS=none -o ControlMaster=auto -vvv USER@SERVER 'bash -c '\''echo df83cfc4-ee07-4bc6-b519-c64972c94648-fx9k9'\''' + set +e + ssh -A -tt -i /root/.ssh/pipelines_id -o StrictHostKeyChecking=no -p 22 -o IPQoS=none -o ControlMaster=auto -vvv USER@SERVER 'bash -c '\''echo df83cfc4-ee07-4bc6-b519-c64972c94648-fx9k9'\''' + tee /var/tmp/pipe-1736444113-21005 OpenSSH_9.3p2, OpenSSL 3.1.6 4 Jun 2024 debug1: Reading configuration data /root/.ssh/config debug1: Reading configuration data /etc/ssh/ssh_config debug2: resolve_canonicalize: hostname SERVER is address debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/root/.ssh/known_hosts' debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/root/.ssh/known_hosts2' debug3: ssh_connect_direct: entering debug1: Connecting to SERVER [SERVER] port 22. debug1: connect to address SERVER port 22: Operation timed out ssh: connect to host SERVER port 22: Operation timed out + status=255 + set -e ✖ Execution failed. + [[ 255 == \0 ]] + fail 'Execution failed.' + echo -e '\e[31m✖ Execution failed.\e[0m' + exit 1 Build teardown<1s

 

1 answer

0 votes
Sahir Maharaj
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 12, 2025

Hello @benjamin

Based on my understanding - an SSH timeout error typically indicates connectivity issues, even if Atlassian IPs are allowed.

First, verify that your firewall or network policies are not interfering with SSH traffic, and ensure the SSH server is configured to accept connections from your Bitbucket Pipelines.

Using -vvvv in your SSH command provides detailed debugging information, which can help pinpoint the issue.

P.S. If you suspect it’s related to OIDC (OpenID Connect), ensure proper configuration in your YAML file to authenticate securely.

For advanced debugging, I recommend opening a ticket with Atlassian support at https://support.atlassian.com/contact/#/.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin Site Admin
TAGS
AUG Leaders

Atlassian Community Events