[X2Go-Commits] [live-build-x2go] 03/04: this script downloads an ssh public key file for root

git-admin at x2go.org git-admin at x2go.org
Fri Dec 15 22:06:28 CET 2023


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch mini
in repository live-build-x2go.

commit c84f42ee6cb2e9cf6b284c4a7ea33ac024b8ae8b
Author: Stefan Baur (BAUR-ITCS) <kontakt at baur-itcs.de>
Date:   Fri Aug 5 21:16:35 2016 +0200

    this script downloads an ssh public key file for root
---
 .../includes.chroot/lib/live/config/2150-setsshkey | 43 ++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/config/includes.chroot/lib/live/config/2150-setsshkey b/config/includes.chroot/lib/live/config/2150-setsshkey
new file mode 100755
index 0000000..01dbaa2
--- /dev/null
+++ b/config/includes.chroot/lib/live/config/2150-setsshkey
@@ -0,0 +1,43 @@
+#!/bin/sh
+
+SetSSHKey ()
+{
+
+# Output startup message
+#
+echo -n " setsshkey"
+
+
+PUBKEYURL=\$(cat /proc/cmdline | \
+	    tr ' ' '\n' | \
+	    awk -F'=' ' /^pubkey=/ { print \$2 }')
+
+if [ -n "$PUBKEYURL" ] ; then
+
+# Set Keyfile
+#
+mkdir -p /root/.ssh
+chmod 600 /root/.ssh
+touch /root/.ssh/authorized_keys
+chmod 600 /root/.ssh/authorized_keys
+
+if echo "$PUBKEY" | grep -q "^tftp://" ; then
+        PUBKEYSERVER=$(echo "$PUBKEYURL" | sed 's#^tftp://\([^/]*\)/.*$#\1#' )
+        PUBKEYPATH=$(echo "$PUBKEYURL" | sed 's#^tftp://[^/]*/\(.*\)$#\1#' )
+        if [ -n "$PUBKEYSERVER" ] && [ -n "$PUBKEYPATH" ] ; then
+                while ! atftp $PUBKEYSERVER -g -r $PUBKEYPATH -l /root/.ssh/authorized_keys ; do
+                        echo "Waiting for SSH Public Key ..."
+                        sleep 5
+                done
+        fi
+else
+        while ! wget -q -O - $PUBKEYURL >/root/.ssh/authorized_keys ; do
+                echo "Waiting for SSH Public Key ..."
+                sleep 5
+        done
+fi
+
+}
+
+SetSSHKey
+

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/live-build-x2go.git


More information about the x2go-commits mailing list