Hello. I’ve noticed the tcpip_tunnel_in
option in the Erlang documentation for the ssh
module and trying to make it work.
defmodule MyApp.SSHDaemon do
@sys_dir String.to_charlist("#{Path.expand(".")}/sys_dir")
def start_link do
:ssh.daemon(
4445,
system_dir: @sys_dir,
no_auth_needed: true,
# disconnectfun: &log_it/1,
# connectfun: &log_it/3,
# failfun: &log_it/3,
tcpip_tunnel_in: true
)
end
def child_spec(_) do
%{
id: __MODULE__,
start: {__MODULE__, :start_link, []},
name: __MODULE__
}
end
def log_it(a1, a2 \\ nil, a3 \\ nil, a4 \\ nil, a5 \\ nil, a6 \\ nil) do
require Logger
Logger.debug(
"#{inspect(a1)}, #{inspect(a2)}, #{inspect(a3)}, #{inspect(a4)}, #{inspect(a5)}, #{inspect(a6)}"
)
end
end
Here’s how I’ve generated the sample keys:
mkdir sys_dir
ssh-keygen -N '' -b 256 -t ecdsa -f sys_dir/ssh_host_ecdsa_key
Connecting to it this way:
❯❯❯ ssh -R 8082:localhost:8080 127.0.0.1 -p 4445
Warning: remote port forwarding failed for listen port 8082
Eshell V14.1.1 (press Ctrl+G to abort, type help(). for help)
1>
Any advice or examples on getting TCP port forwarding to work here?