Skip to contentSkip to conversation

Add ssh client module code

PATCH Applied Dave Young 2 participants 2 messages Dec 26, 2011 – Jan 23, 2012 1 message not in the archive

lore
Share & tools
lore

Dave Young

author
#0 lore raw

PATCH v2 4/5 Add ssh client module code

Add ssh client module which support ssh key mode and interactive mode. with --sshkey option you can provide the ssh key to be installed

Quoted 1 line

why not call it "ssh" module?

ssh-client is better, maybe future there will be ssh-server come in. In debian these are also two different packages.

Usage:
1. sshkey mode:
transfer your public key to remote machine with ssh-copy-id or do it mannaully example of options:
./dracut -l -H -a ssh-client --sshkey /root/.ssh/id_rsa i.img
2. interactive mode:
need use --ctty option, ie.:
./dracut -l -H -a ssh-client --ctty i.img

[v2 changes]:
per wangcong: add patch description about module name add help line in usage()
remove useless comment

---
 dracut                                 |    4 ++-
 dracut.8.xml                           |    8 ++++
 modules.d/95ssh-client/module-setup.sh |   60 ++++++++++++++++++++++++++++++++
 3 files changed, 71 insertions(+), 1 deletions(-)
 create mode 100644 modules.d/95ssh-client/module-setup.sh
dracut +3 -1
index 24a89e6..b0a8e24 100755
@@ -118,6 +118,7 @@ Creates initial ramdisk images for preloading modules
   -M, --show-modules    Print included module's name to standard output during
                          build.
   --keep                Keep the temporary initramfs for debugging purposes
+  --sshkey [SSHKEY]     Add ssh key to initramfs (use with ssh-client module)
 EOF
 }
 
@@ -233,6 +234,7 @@ while (($# > 0)); do
         --debug)       debug="yes";;
         --profile)     profile="yes";;
         --ctty)        cttyhack="yes";;
+        --sshkey)      read_arg sshkey   "$@" || shift;;
         -v|--verbose)  ((verbosity_mod_l++));;
         -q|--quiet)    ((verbosity_mod_l--));;
         -l|--local)    allowlocal="yes" ;;
@@ -590,7 +592,7 @@ export initdir dracutbasedir dracutmodules drivers \
     add_drivers mdadmconf lvmconf filesystems \
     use_fstab libdir usrlibdir fscks nofscks cttyhack \
     stdloglvl sysloglvl fileloglvl kmsgloglvl logfile \
-    debug host_fs_types host_devs
+    debug host_fs_types host_devs sshkey
 
 # Create some directory structure first
 [[ $prefix ]] && mkdir -m 0755 -p "${initdir}${prefix}"
dracut.8.xml +8 -0
index a46fc04..a88fe16 100644
@@ -370,6 +370,14 @@ Default:
         </varlistentry>
         <varlistentry>
           <term>
+            <option>--sshkey&nbsp;<replaceable>&lt;sshkey file&gt;</replaceable></option>
+          </term>
+          <listitem>
+            <para>ssh key file used with ssh-client module.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>
             <option>-l</option>
           </term>
           <term>
modules.d/95ssh-client/module-setup.sh new file +60 -0

60 lines not on this page · raw message

Signature · 1 line
1.7.1
#2 lore raw
In reply to a message not in the archive

Am 26.12.2011 07:29, schrieb Dave Young:

Quoted 16 lines

Add ssh client module which support ssh key mode and interactive mode. with --sshkey option you can provide the ssh key to be installed

Quoted 1 line

why not call it "ssh" module?

ssh-client is better, maybe future there will be ssh-server come in. In debian these are also two different packages.

Usage:
1. sshkey mode:
transfer your public key to remote machine with ssh-copy-id or do it mannaully example of options:
./dracut -l -H -a ssh-client --sshkey /root/.ssh/id_rsa i.img
2. interactive mode:
need use --ctty option, ie.:
./dracut -l -H -a ssh-client --ctty i.img

Quoted 6 lines

[v2 changes]:
per wangcong: add patch description about module name add help line in usage()
remove useless comment

pushed