[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Disable passphrase querying


On Fri, 2020-03-27 at 13:59 +0100, Maximiliano Pin wrote:
> Hi all,
> 
> I'm using ssh_userauth_publickey_auto(). I'd like to disable the
> "Enter PEM
> pass phrase:" prompt that appears when the user forgot to use ssh-add 
> (the
> private key is encrypted), and get an error instead.
> 
> This is a program with multiple threads doing non-interactive ssh
> communication, so that prompt is a problem.
> 
> With the 'ssh' command, I can achieve that using the BatchMode
> option. How
> can I achieve the same with libssh? Thanks!

You should be able to set auth_function callback. It can be either your
prompt for passphrase or just bogus function returning empty
passprahse, which will let libssh fail to decode the encrypted key and
the connection.

https://api.libssh.org/master/structssh__callbacks__struct.html#a5f79b2d36329d0ce6e9ac2cd3b77b046

Regards,
-- 
Jakub Jelen
Senior Software Engineer
Security Technologies
Red Hat, Inc.


Follow-Ups:
Re: Disable passphrase queryingMaximiliano Pin <mxcpin@xxxxxxxxx>
References:
Disable passphrase queryingMaximiliano Pin <mxcpin@xxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org