Skip to content

Authentication with Private Key #37

@btihen

Description

@btihen

Hello, I have a multitenant system where we pull in data via sftp for processing, everything works very well, with passwords, but with private_keys, I have a probem.

I see the options:

  * `:user_dir` - The directory to read private keys from.

  * `:private_key_path` - The path to the private key to use for authentication.

  * `:key_cb` - A 2-item tuple containing:
     - A module that implements `:ssh_client_key_api` behaviour.
     - `:ssh_client_key_api` behaviour opts.

might be helpful when using private keys. user_dir is unlikely to be helpful in my case given we don't have user_dir for each user.
I am trying to use: :private_key_path - so I store the private key in a temp file and using this attribute send that with the options, however, I get:

connection_result: {:error,
 %SFTPClient.ConnError{
   message: "Unable to connect using the available authentication methods"
 }}

I have also tried to use: {:key_cb, {AvkService.SSHApi.DatabaseClientKey, private_key: auth_secret}}and then override def user_key(algorithm, opts) do`, but I get the same error.

Finally, I have also played with the modify_algorithms - as mentioned on the home page, but I always get the public key, but always the same error:

{:modify_algorithms, [
  prepend: [
    public_key: [:"ssh-ed25519", :"ecdsa-sha2-nistp256"]  # Try these first
  ],
  append: [
    public_key: [:"ssh-rsa"]  # Try this as a last resort
  ]
]}

Can you give me a some help implementing private keys for multiple users against multiple sftp servers? Thanks,
Bill

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions