HOWTO ask user to type ssh passwird in initramfs.

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

 



Hi,
I fillany wrote my super systemimager dracut module that allows to image a computer from a PXE booted initramfs without rebooting (using rsync)
(see: screenshots: https://github.com/finley/SystemImager/wiki/ScreenShots (and video)
      dracut module:https://github.com/finley/SystemImager/tree/initrd-from-imageserver-and-dont-package-initrd/lib/dracut/modules.d/51systemimager )

I'm now in the process of adding the ssh tunnel option when connecting to the image server.
this can be done using keys, but also by asking interactively the image server ssh password

AND THAT'S MY PROBLEM. (test under latest CentOS-7 at least)

I'm totally unable to give a password to ssh.
I've tried many methods with no success or had to type the password twice.

I'm convinced that this is due to the fact I'm running in an environment where std input and output are modified (maybe by systemd or maybe by dracut hooks???)

So I need advises or help from dracut experts, hence this message.

What I did try: (plymouth is active with a specific theme (see screenshots) that works in GUI or text modes). Though problem is the same with normal plymouth theme

1/ without using the --command => unable to retreive the password from standard input.
SSHPASS="$(plymouth ask-for-password --prompt 'Please, enter password:')" sshpass -e ssh oscar-server 'hostname' > /tmp/result
=> Doesn't work. $SSHPASS is empty. 
plymouth ask-for-password --prompt 'Please, enter password:' > /tmp/password
=> creates an empty file

2/ using the --command directly with ssh => I must type the password twice???!!!
plymouth ask-for-password --prompt "Please, enter password:" --command "ssh my-server 'hostname'" --number-of-tries=3 > /tmp/result
=> 1st time I type password: the password dialog close when I hit enter. Then I type blindly and it works :-/
=> In text mode, I see the plymouth password prompt, I type the password, hit enter and then I get the ssh password prompt, I reenter password and it works.

3/ using the --command with "sshpass -e0 ssh ...."
=> exact same behavior as above.

4/ using the /lib/dracut-crypt-lib.sh ask-for-password
=> Same behavior as above except that when ssh ask for the password (second password query), I'm never able to type it correctly just like if some typing got lost.

5/ using systemd-ask-password => doesn't display password dialog under plymouth
SSHPASS="$(systemd-ask-password 'SSH password')" sshpass -e ssh oscar-server 'hostname' > /tmp/result
=> Works in text mode. In GUI mode, no password dialog appears.
=> Not available on centos-6 (that I have to support as it's still maintained).

So I'm out of solutions. Any advise explaining where I'm wrong or what special things I must do with descriptors before and after getting the password or any thechnical trick would be welcome.

Thanks in avance for any help.

-- 
   Olivier LAHAYE







--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux