Skip to content

Tunnel creation is not stable without ExitOnForwardFailure and extra sleep #4

Open
@roman-finix

Description

first of all I hope https://circleci.com/developer/orbs/orb/eddiewebb/dmz#orb-source is this repo.

We have setup of this orb and it worked most of time stable.
But there are bunch of cases when tunnel creation is finished successfully but our next step is failing connect nu tunnel.
Unrelated to this orb log:

2020/07/13 23:30:41 Waiting for: tcp://localhost:****
2020/07/13 23:30:41 Problem with dial: dial tcp 127.0.0.1:****: connect: connection refused. Sleeping 1s
2020/07/13 23:30:42 Problem with dial: dial tcp 127.0.0.1:****: connect: connection refused. Sleeping 1s
2020/07/13 23:30:43 

restart of the whole CircleCI job, helps.
After bunch of experiments we found a solution by patching of orb with 1 extra argument for ssh and one extra command to let tunnel be created in our case sleep

example of modification:

      - run:
          # MODIFICATION: -o ExitOnForwardFailure=yes
          # MODIFICATION: sleep 5
          command: |
            ssh -o ExitOnForwardFailure=yes -4 -L <<parameters.local_port>>:<<parameters.target_host>>:<<parameters.target_port>> -Nf <<parameters.bastion_user>>@<<parameters.bastion_host>>
            sleep 5
          name: Open Local Port Forwarding on <<parameters.local_port>> to <<parameters.target_host>>:<<parameters.target_port>>
            via <<parameters.bastion_host>>

After more then 6 month of no problems I think we can discuss how to contribute it original repo.


I clearly understand that "sleep 5" is not ideal solution to keep, and what I can suggest is to make allow user to execute any command he wants eval << parameters.post_ssh_command>> to let use make any verification of tunnel or simply sleep X up to his amount and nuances of network.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions