summaryrefslogtreecommitdiffstats
path: root/src/initramfs/tpm/bin/fetch-sshkeys.sh
diff options
context:
space:
mode:
authorSebastian Schmelzer2010-09-02 17:50:49 +0200
committerSebastian Schmelzer2010-09-02 17:50:49 +0200
commit416ab8a37f1b07dc9f6c0fb3ff1a8ff2036510b5 (patch)
tree4715f7d742fec50931017f38fe6ff0a89d4ceccc /src/initramfs/tpm/bin/fetch-sshkeys.sh
parentFix for the problem reported on the list (sed filter forgotten for the (diff)
downloadcore-416ab8a37f1b07dc9f6c0fb3ff1a8ff2036510b5.tar.gz
core-416ab8a37f1b07dc9f6c0fb3ff1a8ff2036510b5.tar.xz
core-416ab8a37f1b07dc9f6c0fb3ff1a8ff2036510b5.zip
change dir structure
Diffstat (limited to 'src/initramfs/tpm/bin/fetch-sshkeys.sh')
-rwxr-xr-xsrc/initramfs/tpm/bin/fetch-sshkeys.sh28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/initramfs/tpm/bin/fetch-sshkeys.sh b/src/initramfs/tpm/bin/fetch-sshkeys.sh
new file mode 100755
index 00000000..c385fd47
--- /dev/null
+++ b/src/initramfs/tpm/bin/fetch-sshkeys.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+#
+
+SHOWMAC="/bin/showmac.sh"
+KEYTRG="/root/.ssh"
+
+# FIXME: remote-host could be determined from kernel-cmdline, should we?
+RHOST="132.230.4.180"
+
+if [ ! -x "$SHOWMAC" ] ; then
+ echo "Can't find $SHOWMAC, exiting."
+ exit 1
+fi
+MAC_ETH0="$($SHOWMAC eth0)"
+
+mkdir -p "$KEYTRG"
+
+PRIVKEY="id_rsa.tpm-${MAC_ETH0}.sealed"
+
+echo -n "trying to fetch private key (via tftp):"
+tftp -r client-config/tpm/$PRIVKEY -l $KEYTRG/id_rsa -g $RHOST
+if [ "$?" -gt 0 ] ; then
+ echo " FAILED!"
+ echo "ERROR: can't find private key for this MAC-address: $MAC_ETH0."
+ exit 2
+fi
+echo " $PRIVKEY"
+chmod 600 $KEYTRG/id_rsa