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

Re[2]: passing passphrase as parameter?


Well I was not thinking about writing these passwords in the program itself but storing them somewhere on the disk, encrypted, simply as an extra protection. I've been studying the code for hours and it looks that I have to set a callback by using ssh_set_callbacks function, and I tried it but still prompts for passwords. pseudocode:

port = 5555;
hsession= ssh_new();
hbind= ssh_bind_new();
ssh_bind_options_set(hbind, SSH_BIND_OPTIONS_BINDPORT, &port);
ssh_bind_options_set(hbind, SSH_BIND_OPTIONS_DSAKEY, "ssh_host_dsa_key");
ssh_bind_options_set(hbind, SSH_BIND_OPTIONS_RSAKEY, "ssh_host_rsa_key");

memset(&cb, 0, sizeof(cb));
ssh_callbacks_init(&cb);
cb.auth_function = custom_auth;
ssh_set_callbacks(hbind, &cb);

ssh_bind_listen(hbind);

btw, I'm using 0.7.2.


>Friday, January 27, 2017 8:15 AM UTC from Tilo Eckert <tilo.eckert@xxxxxxx>:
>
>Hi Alex
>
>why don't you generate host keys without a password? If you put the
>password of the keys into your code instead of entering it manually, it
>is as good as having no password at all. Private SSH host keys should
>never leave the machine they were generated on anyway and should only be
>accessible by root.
>
>Regards
>Tilo
>
>Am 27.01.2017 um 06:11 schrieb alex rosky:
>> 
>> 
>> 
>> Hello there,
>> 
>> I'm coding a simple SSH server for learning and I have created dsa and
>> rsa keys passing a passphrase. now in my ssh server code, when calling
>> ssh_bind_listen, it prompts for this passphrase so my question is, is
>> there any way to pass this passphrase as parameter or by callback or
>> something without needing to write this manually? my pseudocode:
>> 
>>  port = 5555;
>> hsession= ssh_new();
>> hbind= ssh_bind_new();
>> ssh_bind_options_set(hbind, SSH_BIND_OPTIONS_BINDPORT, &port);
>> ssh_bind_options_set(hbind, SSH_BIND_OPTIONS_DSAKEY, "ssh_host_dsa_key");
>> ssh_bind_options_set(hbind, SSH_BIND_OPTIONS_RSAKEY, "ssh_host_rsa_key");
>> 
>> ssh_bind_listen(hbind)
>> 
>> Thanks.
>> 
>> Alex Jackson.
>
>




References:
passing passphrase as parameter?alex rosky <alex22sky@xxxxxxx>
Re: passing passphrase as parameter?Tilo Eckert <tilo.eckert@xxxxxxx>
Archive administrator: postmaster@lists.cynapses.org