slackbuilds_ponce/system/early-ssh/slack.diff
Andrew Clemons 4d70287e53 system/early-ssh: Added (SSH server during boot).
Signed-off-by: David Spencer <idlemoor@slackbuilds.org>
2018-01-26 23:16:40 +00:00

98 lines
3.6 KiB
Diff

diff -Naur early-ssh-4acf000ddbe564dcafec626ec0dc7eadd821a857.orig/src/usr/share/initramfs-tools/hooks/early_ssh early-ssh-4acf000ddbe564dcafec626ec0dc7eadd821a857/src/usr/share/initramfs-tools/hooks/early_ssh
--- early-ssh-4acf000ddbe564dcafec626ec0dc7eadd821a857.orig/src/usr/share/initramfs-tools/hooks/early_ssh 2014-03-31 11:35:22.000000000 +1300
+++ early-ssh-4acf000ddbe564dcafec626ec0dc7eadd821a857/src/usr/share/initramfs-tools/hooks/early_ssh 2018-01-26 15:03:47.520179718 +1300
@@ -1,5 +1,9 @@
#!/bin/bash
+# Adjusted for slackware's initrd
+# Andrew Clemons
+# August 2016
+
PREREQ=""
prereqs()
{
@@ -13,58 +17,46 @@
;;
esac
-# load initramfs' hook functions
-source /usr/share/initramfs-tools/hook-functions
+if [ -z "$DESTDIR" ] ; then
+ echo "Missing destination directory. Use DESTDIR= to pass the destination directory."
+ exit 1
+fi
# create the needed directories
for i in /etc/dropbear /etc/early-ssh /root /root/.ssh /sbin /bin /usr/bin /var /var/log; do
[ ! -e "${DESTDIR}${i}" ] && mkdir -p "${DESTDIR}${i}"
done
+if [ ! -e "${DESTDIR}/tmp" ] ; then
+ mkdir "${DESTDIR}/tmp"
+ chmod 1777 "${DESTDIR}/tmp"
+fi
+
# copy the needed executables
-copy_exec /usr/sbin/dropbear sbin/
-copy_exec /sbin/ifconfig sbin/
-copy_exec /sbin/route sbin/
-[ -f /usr/bin/scp ] && copy_exec /usr/bin/scp bin/
+cp -a /usr/bin/dropbearmulti $DESTDIR/sbin/dropbear
+cp -a /usr/share/mkinitrd/scripts/early_ssh $DESTDIR/
# copy the configs
cp -rp /etc/dropbear/dropbear_dss_host_key $DESTDIR/etc/dropbear/
cp -rp /etc/dropbear/dropbear_rsa_host_key $DESTDIR/etc/dropbear/
+cp -rp /etc/dropbear/dropbear_ecdsa_host_key $DESTDIR/etc/dropbear/
cp -rp /etc/localtime $DESTDIR/etc/
[ -f /root/.ssh/authorized_keys ] && cp -rp /root/.ssh/authorized_keys $DESTDIR/root/.ssh/authorized_keys
cp -rp /etc/login.defs $DESTDIR/etc/
cp -rp /etc/early-ssh/early-ssh.conf $DESTDIR/etc/early-ssh/
-ls -1 /lib/libnss_files* 2>/dev/null >/dev/null
-if [ $? == 0 ]; then
- cp -rp /lib/libnss_files* $DESTDIR/lib/
-else
- cp -rp `dpkg -L libc6 | grep '/libnss_files' | tr '\n' ' '` $DESTDIR/lib/
-fi
-
-ln -s /usr/lib/libz.so.1 $DESTDIR/usr/libz.so.1
-
-echo "passwd: files
-group: files
-shadow: files
-" > $DESTDIR/etc/nsswitch.conf
-
. /etc/early-ssh/early-ssh.conf
if [ "$PASSWD_OVERRIDE" != "" ]; then
cat $PASSWD_OVERRIDE >> $DESTDIR/etc/passwd
-else
- cat /etc/passwd | grep -E '^root:' | sed -e 's/:\/bin\/bash/:\/bin\/sh/' >> $DESTDIR/etc/passwd
fi
if [ "$SHADOW_OVERRIDE" != "" ]; then
cat $SHADOW_OVERRIDE >> $DESTDIR/etc/shadow
-else
- cat /etc/shadow | grep -E '^root:' >> $DESTDIR/etc/shadow
fi
if [ "$GROUP_OVERRIDE" != "" ]; then
cat $GROUP_OVERRIDE >> $DESTDIR/etc/group
-else
- cat /etc/group | grep -E '^root:' >> $DESTDIR/etc/group
fi
+
+sed -i 's#/bin/bash#/bin/sh#g' $DESTDIR/etc/passwd
diff -Naur early-ssh-4acf000ddbe564dcafec626ec0dc7eadd821a857.orig/src/usr/share/initramfs-tools/scripts/local-top/early_ssh early-ssh-4acf000ddbe564dcafec626ec0dc7eadd821a857/src/usr/share/initramfs-tools/scripts/local-top/early_ssh
--- early-ssh-4acf000ddbe564dcafec626ec0dc7eadd821a857.orig/src/usr/share/initramfs-tools/scripts/local-top/early_ssh 2014-03-31 11:35:22.000000000 +1300
+++ early-ssh-4acf000ddbe564dcafec626ec0dc7eadd821a857/src/usr/share/initramfs-tools/scripts/local-top/early_ssh 2018-01-26 14:27:42.613242124 +1300
@@ -93,7 +93,7 @@
ln -s /dev/urandom /dev/random
# start the dropbear in the background
-/sbin/dropbear -d /etc/dropbear/dropbear_dss_host_key -r /etc/dropbear/dropbear_rsa_host_key -E -F -p $PORT &
+/sbin/dropbear -F -p $PORT &
dropbear_pid=$!
# give a notice to the user he/she can log in over SSH now