tomazbracic
:ssh … killing me softly and slowly ![]()
Does anybody have a working example for using :ssh to do a (public/private) key based ssh reverse tunnel?
Having problems with :ssh and private key. Wasn’t able to connect. Various strange errors, but probably all due to my misconfigured setup. Didn’t find one yet, that I would be able to connect with private key.
Then I tried SSHex, but wan’t able to create a reverse tunnel on connect. I read somewhere that this is not supported.
Then i read about Librarian, with which I was actually able to at least connect, but then unable to create a reverse tunnel.
I need to do a reverse tunnel on initial connect.
If anybody has a working setup for :ssh I would really appreciate it.
Kind regards,
Tomaz
Trending in Questions
Hey guys,
I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly
Do you guys have any suggestions what is the best prac...
New
Hello!
Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app.
I creat...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
I’m trying to set up Emacs with elixir-ls via lsp-mode and credo via Flycheck. This should mostly be preconfigured as Flycheck picks up c...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #blog-post
- #elixirconf-us
- #elixir-ls
- #ai
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 5- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
Kevo
I have very little low level understanding of ssh, but looking at the docs, I don’t think it’s supported. Hopefully I’m missing something and incorrect, but you can investigate the specifics further here:
ausimian
Can you post the code you used against
:ssh? I’ve used this reverse tunnel facility in the past although I don’t have the sample to hand.tomazbracic
Hi,
having issues that I don’t know how to setup a “call” to do a reverse tunnel.
I know how to do this in linux →
This is a reverse tunnel from my Nerves device to the sshproxy VM in the cloud. The only thing on that VM is a change in sshd_config to allow other ports as well.
Then on my laptop I can do this
And land on my gateway device via SSH proxy from the 3rd machine.
BUUUT, trying this with :ssh is like this. Don’t really know how to pass all this command parts
ssh -i /home/tomaz/.ssh/nemo/nemo_ssh_key -nN -R 2222:localhost:22 nemouser@192.168.6.130to a :ssh.connect. Right now I am reallystuck here.LostKobrakai
Take a look at ssh — OTP 29.0.2 (ssh 6.0.1). SSH in erlang is not wrapping openssh, but is a pure erlang implemenation. Hence you cannot easily translate openssh cli parameters to erlang, you need to translate to how those same features are implemented on erlangs ssh module.
tomazbracic
Thank you @LostKobrakai !!
I solved this togetherwith my coleage @uhrovat
In order to have this as refence I will try to write this in a way that I wish would have this before.
So the usecase is this. I have a Nerves based devices out in the field, connected over closed LTE network. So I can’t really reach devices from my cloud base service or directly from my dev laptop. Though majority of features is supported/implemented with the use of MQTT calls between device and cloud, there is still a great feeling being able to jump on a device and do some system checks or maintenance. In my case latter as I will be dealing with custom data handling and processin solution.
OPENSSH way (tested without nerves on clasic linux box)
1.) I crated ssh reverse tunnel with this on boxA (like gateway on picture)
ssh -i /home/tomaz/.ssh/nemo/user_ssh_key -nN -R 2222:localhost:22 Auser@192.168.x.130user_ssh_key is a key on a proxy server, and Auser is a user on sshproxy server
2.) On ssh proxy I only added
3.) On my laptop I did
ssh -i gateway-id_rsa tomaz@192.168.x.130 -p 2222gateway-id_rsa is a key that resolves against the PKI on gateway, and tomaz is a user on gateway.
With this in place I gain access to the “TERMINAL” shell on my boxA - which kind of simulates a real nerves gateway on picture.
I do think this is really importnat for later.:SSH (Erlang way). - still without real Nerves gateway.
I’ve created a reverse tunnel on linux VM box (not actual Nerves gateway)
:sshlibrary expects file to beone of -> id_rsa, id_dsa or id_ecdsa. ssh — OTP 29.0.2 (ssh 6.0.1)I actually had to rename my key to be
id_rsaand not some random name even though I tried to point to itAnd this setup did establish the ssh reverse proxy. I logged everything in
/var/log/authon a sshproxy.Then on my laptop I did
ssh -i Auser Auser@192.168.x.130 -p 3333And with that I got access to linux shell (terminal) on the “gateway” linux VM box.
SSH (Erlang way) - NOW ON NERVES DEVICE
Similar approach as previous example but now on actual device.
Then from my dev laptop
ssh -i /Users/tomaz/.ssh/nemo/tomaz-id_rsa nerves@192.168.x.130 -p 3333private keyhas a public key on a gateway.Useris for gateway, andIPis for sshproxy server.And what I get is wooohooo!!!
currently my gateway is connected with ethernet cable, since my LTE doesn’t have a signal here.
Huge thumbs up to @uhrovat for joining efforts.
Hope this post helps others in the future.