summaryrefslogtreecommitdiff
path: root/system/early-ssh/slack.diff
blob: b0de9a33724f0ec074074506361607acc4fdf433 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
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