summaryrefslogtreecommitdiffstats
path: root/initramfs/tpm/bin/fetch-sshkeys.sh
diff options
context:
space:
mode:
authorDirk von Suchodoletz2007-10-20 18:32:52 +0200
committerDirk von Suchodoletz2007-10-20 18:32:52 +0200
commita8ee9b6d2f15d34b189fb9a54aab77e86ec1c16a (patch)
treee4269ecd118e76863312c4a69b12b6367256f967 /initramfs/tpm/bin/fetch-sshkeys.sh
parentmkdxsinitrd: added functions for tpm-secured booting (diff)
downloadcore-a8ee9b6d2f15d34b189fb9a54aab77e86ec1c16a.tar.gz
core-a8ee9b6d2f15d34b189fb9a54aab77e86ec1c16a.tar.xz
core-a8ee9b6d2f15d34b189fb9a54aab77e86ec1c16a.zip
tpm stuff subdirectory ...
git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1392 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'initramfs/tpm/bin/fetch-sshkeys.sh')
-rwxr-xr-xinitramfs/tpm/bin/fetch-sshkeys.sh28
1 files changed, 28 insertions, 0 deletions
diff --git a/initramfs/tpm/bin/fetch-sshkeys.sh b/initramfs/tpm/bin/fetch-sshkeys.sh
new file mode 100755
index 00000000..1597d410
--- /dev/null
+++ b/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 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