Skip to content

Commit

Permalink
Merge pull request #7 from paolobarbolini/direction
Browse files Browse the repository at this point in the history
Add tunnel direction option
  • Loading branch information
tersmitten authored Jan 9, 2020
2 parents b3d2294 + 5485733 commit 8cbeaed
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ None
* `autossh_tunnel_client_ssh_options`: [default: `['ServerAliveInterval 60', 'ServerAliveCountMax 3', 'BatchMode=yes', 'StrictHostKeyChecking=no']`]: SSH options

* `autossh_tunnel_client_forward`: [required]: Port forward to set up (e.g. `['3307:127.0.0.1:3306']`)
* `autossh_tunnel_client_forward_direction`: [default: `L`]: Specifies the direction of the tunnel. If it is set to `R`, then the direction of the tunnel is reversed making it into a reverse ssh tunnel

## Dependencies

Expand Down
2 changes: 2 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ autossh_tunnel_client_ssh_options:
- 'ServerAliveCountMax 3'
- 'BatchMode=yes'
- 'StrictHostKeyChecking=no'

autossh_tunnel_client_forward_direction: L
2 changes: 1 addition & 1 deletion templates/usr/local/bin/autossh-tunnel-client-wrapper.j2
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ set +a;
/usr/bin/install -d -m 0755 {{ autossh_tunnel_client_autossh_pidfile | dirname }};

exec ${DAEMON}{% for autossh_options in autossh_tunnel_client_autossh_options %} -{{ autossh_options }}{% endfor %} \
{% for forward in autossh_tunnel_client_forward %}-L {{ forward }} {% endfor %}\
{% for forward in autossh_tunnel_client_forward %}-{{ autossh_tunnel_client_forward_direction }} {{ forward }} {% endfor %}\
{{ autossh_tunnel_client_user }}@{{ autossh_tunnel_client_host }} \
-p {{ autossh_tunnel_client_port }} \
-i {{ autossh_tunnel_client_configuration_directory }}/{{ autossh_tunnel_client_identity }} \
Expand Down

0 comments on commit 8cbeaed

Please sign in to comment.