fhunleth

fhunleth

Co-author of Nerves

Erlang's ssh client and password-protected private keys

I was wondering how others handle password-protected private keys with Erlang’s ssh client (:ssh.connect/[3,4]). I’m currently passing the password in the clear with the :rsa_pass_phrase option to :ssh.connect/3. That’s not desirable to say the least.

It would be great if I could somehow use ssh-agent, but that doesn’t look possible with since the ssh_client_key_api API requires you to return decrypted private keys and not forward the negotiation steps. At least from my brief skim of the ssh-agent protocol, it won’t return a decrypted private key. That makes sense, though,

I may end up prompting for the password everytime the key is needed. From a workflow perspective, though, entering in a password is not great so I’m hoping for other options.

Most Liked

kenny-evitt

kenny-evitt

I just ran into this myself and thought the original participants and anyone (like me) that’s since found this post might be interested to know that there is (now at least) an Erlang ssh_agent module:

Example usage (with the Elixir sshex package):

{:ok, ssh_conn} = SSHEx.connect(ip: ip_address, user: user, key_cb: {:ssh_agent, []})

It seems to work (for me anyways)!

OvermindDL1

OvermindDL1

Make a library so it can, I bet others would love it too! :slight_smile:

bbense

bbense

I really wish the ssh library worked with both certs and ssh-agent, it’s kind of useless to me w/o that support. I guess I need to start looking at some code.

OvermindDL1

OvermindDL1

I usually get it from the environment or so. You have to get the password from ‘somewhere’, so it depends on where you are getting it from.

Where Next?

Popular in Questions Top

lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
yawaramin
In the Dialyzer docs ( http://erlang.org/doc/man/dialyzer.html#requesting-or-suppressing-warnings-in-source-files ), there is a way to tu...
New
Werner
Hi, I’m using Ubuntu 18.04 and after updating to OTP-24.0 yesterday i have this warning when I run “mix local.hex”: 14:57:30.512 [warn] ...
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod -- where is this set? Thanks.
New
Jim
As a follow up to my earlier question: I have the code compiling and running but not getting a successful login from the rest server. ...
New
mathew4509
I have a list say x = ["23gh", "56kh", "97mh"] I would like to pass each element to Val in each iteration. Say, in iteration 1 -------...
New
beno
I will often find my self writing things similar to: case some_value do nil -> something() "" -> something() _ -> someth...
New
lucidguppy
I have a super simple question about elixir - how would I take a file like this foo bar baz and output a new file that enumerates th...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New

Other popular topics Top

JDanielMartinez
Hi! May someone helps me, please! I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
Tee
can someone please explain to me how Enum.reduce works with maps
New
quazar
How to set Jason to encode all fields in ecto schema, I don’t care about security and implementing only is taking long list of attributes...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
johnnyicon
Hi all, I've just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage. I'm trying to use Postg...
New
AstonJ
We’ve put together this wiki for Phoenix LiveView - please feel free to add any info you feel is worth including. What is Phoenix LiveV...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New

We're in Beta

About us Mission Statement