diff options
author | elijah <elijah@riseup.net> | 2015-09-14 12:13:29 -0700 |
---|---|---|
committer | elijah <elijah@riseup.net> | 2015-09-14 12:13:29 -0700 |
commit | ce5baecd3e831a6ab2af33a15a99419fab39d04a (patch) | |
tree | f9ad3bcec2d5fe2e24db65bb23c82e87e92e0023 /lib/leap_cli/commands | |
parent | 9a646678014424e560dff489dd9fdb7ee5283efc (diff) |
Added help/warning if running tunnel command without TCP forwarding enabled.
Diffstat (limited to 'lib/leap_cli/commands')
-rw-r--r-- | lib/leap_cli/commands/ssh.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/leap_cli/commands/ssh.rb b/lib/leap_cli/commands/ssh.rb index 1a81902c..3887618e 100644 --- a/lib/leap_cli/commands/ssh.rb +++ b/lib/leap_cli/commands/ssh.rb @@ -27,6 +27,11 @@ module LeapCli; module Commands c.flag 'port', :arg_name => 'SSH_PORT', :desc => 'Override default SSH port used when trying to connect to the server. Same as `--ssh "-p SSH_PORT"`.' c.action do |global_options,options,args| local_port, node, remote_port = parse_tunnel_arg(args.first) + unless node.ssh.config.AllowTcpForwarding == "yes" + log :warning, "It looks like TCP forwarding is not enabled. "+ + "The tunnel command requires that the node property ssh.config.AllowTcpForwarding "+ + "be set to 'yes'. Add this property to #{node.name}.json, deploy, and then try tunnel again." + end options[:ssh] = [options[:ssh], "-N -L 127.0.0.1:#{local_port}:0.0.0.0:#{remote_port}"].join(' ') log("Forward port localhost:#{local_port} to #{node.name}:#{remote_port}") if is_port_available?(local_port) |