commit 19a65ff89fd063871c473ae122d1cd0780798c50
parent e4e3a6fdabdc8ad9f2dc310418826cb5fc0dffad
Author: MikoĊaj <mikolaj.lenczewski308@gmail.com>
Date: Sat, 9 Jan 2021 23:15:06 +0000
Stripped out dropber ECD(SA) support in favour of ED25519
Also simplified bootscript directory structure slightly, and switched
over the sshd bootscript to generate a ED25519 key instead of a DSS key
Diffstat:
14 files changed, 255 insertions(+), 256 deletions(-)
diff --git a/bootscripts/Makefile b/bootscripts/Makefile
@@ -5,10 +5,10 @@ DIRMODE := 755
CONFMODE := 644
install-bootscripts: create-dirs
- install -m ${CONFMODE} clfs/rc.d/init.d/functions ${EXTDIR}/rc.d/init.d/
- install -m ${MODE} clfs/rc.d/startup ${EXTDIR}/rc.d/
- install -m ${MODE} clfs/rc.d/shutdown ${EXTDIR}/rc.d/
- install -m ${MODE} clfs/rc.d/init.d/syslog ${EXTDIR}/rc.d/init.d/
+ install -m ${CONFMODE} rc.d/init.d/common.sh ${EXTDIR}/rc.d/init.d/
+ install -m ${MODE} rc.d/startup ${EXTDIR}/rc.d/
+ install -m ${MODE} rc.d/shutdown ${EXTDIR}/rc.d/
+ install -m ${MODE} rc.d/init.d/syslog ${EXTDIR}/rc.d/init.d/
ln -sf ../init.d/syslog ${EXTDIR}/rc.d/start/S05syslog
ln -sf ../init.d/syslog ${EXTDIR}/rc.d/stop/K99syslog
@@ -20,12 +20,12 @@ create-dirs:
install -d -m ${DIRMODE} ${EXTDIR}/rc.d/stop
install-dropbear: create-dirs
- install -m ${MODE} clfs/rc.d/init.d/sshd ${EXTDIR}/rc.d/init.d/
+ install -m ${MODE} rc.d/init.d/sshd ${EXTDIR}/rc.d/init.d/
ln -sf ../init.d/sshd ${EXTDIR}/rc.d/start/S30sshd
ln -sf ../init.d/sshd ${EXTDIR}/rc.d/stop/K30sshd
install-netplug: create-dirs
- install -m ${MODE} clfs/rc.d/init.d/netplugd ${EXTDIR}/rc.d/init.d/
+ install -m ${MODE} rc.d/init.d/netplugd ${EXTDIR}/rc.d/init.d/
ln -sf ../init.d/netplugd ${EXTDIR}/rc.d/start/S10netplugd
ln -sf ../init.d/netplugd ${EXTDIR}/rc.d/stop/K90netplugd
diff --git a/bootscripts/clfs/rc.d/init.d/netplugd b/bootscripts/clfs/rc.d/init.d/netplugd
@@ -1,25 +0,0 @@
-#!/bin/ash
-
-# Netplugd Startup Script
-
-. /etc/rc.d/init.d/functions
-
-case "$1" in
-start)
- echo -n "Starting netplugd: "
- netplugd
- check_status
- ;;
-stop)
- echo -n "Stopping netplugd: "
- killall netplugd
- check_status
- ;;
-restart)
- $0 stop
- $0 start
- ;;
-*)
- echo "Usage: $0 {start|stop|restart}"
- exit 1
-esac
diff --git a/bootscripts/clfs/rc.d/init.d/sshd b/bootscripts/clfs/rc.d/init.d/sshd
@@ -1,54 +0,0 @@
-#!/bin/ash
-#
-# DropBear SSH
-
-. /etc/rc.d/init.d/functions
-
-DSSKEY=/etc/dropbear/dropbear_dss_host_key
-RSAKEY=/etc/dropbear/dropbear_rsa_host_key
-PIDFILE=/var/run/dropbear.pid
-
-case "$1" in
-start)
- if [ ! -r "$DSSKEY" ]; then
- echo -n "Generating DSS host key: "
- dropbearkey -t dss -f "$DSSKEY" >/dev/null 2>&1
- check_status
- fi
- if [ ! -r "$RSAKEY" ]; then
- echo -n "Generating RSA host key: "
- dropbearkey -t rsa -f "$RSAKEY" >/dev/null 2>&1
- check_status
- fi
- if [ -r "$PIDFILE" ]; then
- echo "Service dropbear already running."
- else
- echo -n "Starting SSH server: "
- dropbear
- check_status
- fi
- ;;
-stop)
- if [ -r "$PIDFILE" ]; then
- echo -n "Stopping dropbear SSH server: "
- kill `cat "$PIDFILE"`
- check_status
- else
- echo "Service dropbear not running."
- fi
- ;;
-restart)
- $0 stop
- $0 start
- ;;
-status)
- if [ -r "$PIDFILE" ]; then
- echo "Service dropbear running (PID $(cat "$PIDFILE"))."
- else
- echo "Service dropbear not running."
- fi
- ;;
-*)
- echo "Usage: $0 {start|stop|restart|status}"
- exit 1
-esac
diff --git a/bootscripts/clfs/rc.d/init.d/syslog b/bootscripts/clfs/rc.d/init.d/syslog
@@ -1,34 +0,0 @@
-#!/bin/ash
-
-# Syslog Startup Script
-#
-
-. /etc/rc.d/init.d/functions
-
-SYSLOG_ROTATE_SIZE=65536
-
-case "$1" in
-start)
- echo -n "Starting syslogd: "
- syslogd -m 0 -s $SYSLOG_ROTATE_SIZE -L
- check_status
- echo -n "Starting klogd: "
- klogd
- check_status
- ;;
-stop)
- echo -n "Stopping klogd: "
- killall klogd
- check_status
- echo -n "Stopping syslogd: "
- killall syslogd
- check_status
- ;;
-restart)
- $0 stop
- $0 start
- ;;
-*)
- echo "Usage: $0 {start|stop|restart}"
- exit 1
-esac
diff --git a/bootscripts/clfs/rc.d/shutdown b/bootscripts/clfs/rc.d/shutdown
@@ -1,40 +0,0 @@
-#!/bin/ash
-
-# System Shutdown Script
-#
-
-. /etc/rc.d/init.d/functions
-
-echo
-echo "System is going down for reboot or halt now."
-echo
-
-
-echo "Starting stop scripts."
-
-for i in /etc/rc.d/stop/*
-do
- if [ -x $i ]; then
- $i stop
- fi
-done
-
-if [ -x /sbin/hwclock ] && [ -e /dev/rtc0 ]; then
- echo -n "Syncing system clock to hardware clock: "
- hwclock --systohc --utc
- check_status
-fi
-
-if [ -x /sbin/swapoff ] && [ -s /etc/fstab ]; then
- echo -n "Disabling swap space: "
- swapoff -a
- check_status
-fi
-
-echo -n "Syncing all filesystems: "
-sync
-check_status
-
-echo -n "Unmounting all filesystems: "
-umount -a -r
-
diff --git a/bootscripts/clfs/rc.d/startup b/bootscripts/clfs/rc.d/startup
@@ -1,94 +0,0 @@
-#!/bin/ash
-
-# System Startup Script
-#
-. /etc/rc.d/init.d/functions
-
-/bin/mount -t proc none /proc
-/bin/mount -t sysfs none /sys
-/bin/mount -t tmpfs /tmp /tmp
-/bin/mkdir /dev/pts
-/bin/mkdir /dev/shm
-
-/bin/echo "/sbin/mdev" > /proc/sys/kernel/hotplug
-
-echo -n "Starting mdev: "
-/sbin/mdev -s
-check_status
-
-echo -n "Mounting devpts: "
-/bin/mount -t devpts none /dev/pts
-check_status
-
-echo -n "Mounting shared memory: "
-/bin/mount -t tmpfs none /dev/shm
-check_status
-
-if [ -x /sbin/hwclock ] && [ -e /dev/rtc0 ]; then
- echo -n "Setting system clock: "
- hwclock --hctosys --utc
- check_status
-fi
-
-if [ -x /sbin/fsck ]; then
- echo "Starting fsck for local filesystems."
- fsck -A -C -R -T -t nonfs,nosmbfs
- if [ "$?" -gt 2 ]; then
- echo "WARNING: Errors found while checking filesystems."
- echo "You can login as root now, the system will reboot after logout."
- sulogin
- reboot
- elif [ "$?" = "2" ]; then
- echo "NOTICE: System needs to be rebooted now."
- sleep 1
- reboot
- else
- echo -n "Checking local filesystems: "
- check_status
- fi
-fi
-
-
-if [ -x /sbin/swapon ]; then
- echo -n "Enabling swap space: "
- swapon -a
- check_status
-fi
-
-echo -n "Remounting root rw: "
-mount -o remount,rw /
-check_status
-
-echo -n "Linking /var/tmp and /tmp: "
-ln -s ../tmp /var/tmp
-check_status
-
-echo -n "Setting hostname: "
-hostname -F /etc/HOSTNAME
-check_status
-
-echo -n "Cleaning up system: "
-rm -rf /var/run/*
-> /var/run/utmp
-touch /var/log/wtmp
-touch /var/log/messages
-chmod 0664 /var/run/utmp
-chmod 0664 /var/log/wtmp
-chmod 0660 /var/log/messages
-rm -rf /tmp/*
-check_status
-
-echo -n "Setting up interface lo: "
-ifconfig lo up 127.0.0.1
-check_status
-
-echo "Running start scripts."
-
-for i in /etc/rc.d/start/*
-do
- if [ -x $i ]; then
- $i start
- fi
-done
-
-exit 0
diff --git a/bootscripts/clfs/rc.d/init.d/functions b/bootscripts/rc.d/init.d/common.sh
diff --git a/bootscripts/rc.d/init.d/netplugd b/bootscripts/rc.d/init.d/netplugd
@@ -0,0 +1,25 @@
+#!/bin/ash
+
+# Netplugd Startup Script
+
+. /etc/rc.d/init.d/common.sh
+
+case "$1" in
+start)
+ echo -n "Starting netplugd: "
+ netplugd
+ check_status
+ ;;
+stop)
+ echo -n "Stopping netplugd: "
+ killall netplugd
+ check_status
+ ;;
+restart)
+ $0 stop
+ $0 start
+ ;;
+*)
+ echo "Usage: $0 {start|stop|restart}"
+ exit 1
+esac
diff --git a/bootscripts/rc.d/init.d/sshd b/bootscripts/rc.d/init.d/sshd
@@ -0,0 +1,54 @@
+#!/bin/ash
+#
+# DropBear SSH
+
+. /etc/rc.d/init.d/common.sh
+
+ED25519KEY=/etc/dropbear/dropbear_ecdsa_host_key
+RSAKEY=/etc/dropbear/dropbear_rsa_host_key
+PIDFILE=/var/run/dropbear.pid
+
+case "$1" in
+start)
+ if [ ! -r "$ED25519KEY" ]; then
+ echo -n "Generating ECDSA host key: "
+ dropbearkey -t dss -f "$ED25519KEY" >/dev/null 2>&1
+ check_status
+ fi
+ if [ ! -r "$RSAKEY" ]; then
+ echo -n "Generating RSA host key: "
+ dropbearkey -t rsa -f "$RSAKEY" >/dev/null 2>&1
+ check_status
+ fi
+ if [ -r "$PIDFILE" ]; then
+ echo "Service dropbear already running."
+ else
+ echo -n "Starting SSH server: "
+ dropbear
+ check_status
+ fi
+ ;;
+stop)
+ if [ -r "$PIDFILE" ]; then
+ echo -n "Stopping dropbear SSH server: "
+ kill `cat "$PIDFILE"`
+ check_status
+ else
+ echo "Service dropbear not running."
+ fi
+ ;;
+restart)
+ $0 stop
+ $0 start
+ ;;
+status)
+ if [ -r "$PIDFILE" ]; then
+ echo "Service dropbear running (PID $(cat "$PIDFILE"))."
+ else
+ echo "Service dropbear not running."
+ fi
+ ;;
+*)
+ echo "Usage: $0 {start|stop|restart|status}"
+ exit 1
+esac
diff --git a/bootscripts/rc.d/init.d/syslog b/bootscripts/rc.d/init.d/syslog
@@ -0,0 +1,34 @@
+#!/bin/ash
+
+# Syslog Startup Script
+#
+
+. /etc/rc.d/init.d/common.sh
+
+SYSLOG_ROTATE_SIZE=65536
+
+case "$1" in
+start)
+ echo -n "Starting syslogd: "
+ syslogd -m 0 -s $SYSLOG_ROTATE_SIZE -L
+ check_status
+ echo -n "Starting klogd: "
+ klogd
+ check_status
+ ;;
+stop)
+ echo -n "Stopping klogd: "
+ killall klogd
+ check_status
+ echo -n "Stopping syslogd: "
+ killall syslogd
+ check_status
+ ;;
+restart)
+ $0 stop
+ $0 start
+ ;;
+*)
+ echo "Usage: $0 {start|stop|restart}"
+ exit 1
+esac
diff --git a/bootscripts/rc.d/shutdown b/bootscripts/rc.d/shutdown
@@ -0,0 +1,40 @@
+#!/bin/ash
+
+# System Shutdown Script
+#
+
+. /etc/rc.d/init.d/common.sh
+
+echo
+echo "System is going down for reboot or halt now."
+echo
+
+
+echo "Starting stop scripts."
+
+for i in /etc/rc.d/stop/*
+do
+ if [ -x $i ]; then
+ $i stop
+ fi
+done
+
+if [ -x /sbin/hwclock ] && [ -e /dev/rtc0 ]; then
+ echo -n "Syncing system clock to hardware clock: "
+ hwclock --systohc --utc
+ check_status
+fi
+
+if [ -x /sbin/swapoff ] && [ -s /etc/fstab ]; then
+ echo -n "Disabling swap space: "
+ swapoff -a
+ check_status
+fi
+
+echo -n "Syncing all filesystems: "
+sync
+check_status
+
+echo -n "Unmounting all filesystems: "
+umount -a -r
+
diff --git a/bootscripts/rc.d/startup b/bootscripts/rc.d/startup
@@ -0,0 +1,94 @@
+#!/bin/ash
+
+# System Startup Script
+#
+. /etc/rc.d/init.d/common.sh
+
+/bin/mount -t proc none /proc
+/bin/mount -t sysfs none /sys
+/bin/mount -t tmpfs /tmp /tmp
+/bin/mkdir /dev/pts
+/bin/mkdir /dev/shm
+
+/bin/echo "/sbin/mdev" > /proc/sys/kernel/hotplug
+
+echo -n "Starting mdev: "
+/sbin/mdev -s
+check_status
+
+echo -n "Mounting devpts: "
+/bin/mount -t devpts none /dev/pts
+check_status
+
+echo -n "Mounting shared memory: "
+/bin/mount -t tmpfs none /dev/shm
+check_status
+
+if [ -x /sbin/hwclock ] && [ -e /dev/rtc0 ]; then
+ echo -n "Setting system clock: "
+ hwclock --hctosys --utc
+ check_status
+fi
+
+if [ -x /sbin/fsck ]; then
+ echo "Starting fsck for local filesystems."
+ fsck -A -C -R -T -t nonfs,nosmbfs
+ if [ "$?" -gt 2 ]; then
+ echo "WARNING: Errors found while checking filesystems."
+ echo "You can login as root now, the system will reboot after logout."
+ sulogin
+ reboot
+ elif [ "$?" = "2" ]; then
+ echo "NOTICE: System needs to be rebooted now."
+ sleep 1
+ reboot
+ else
+ echo -n "Checking local filesystems: "
+ check_status
+ fi
+fi
+
+
+if [ -x /sbin/swapon ]; then
+ echo -n "Enabling swap space: "
+ swapon -a
+ check_status
+fi
+
+echo -n "Remounting root rw: "
+mount -o remount,rw /
+check_status
+
+echo -n "Linking /var/tmp and /tmp: "
+ln -s ../tmp /var/tmp
+check_status
+
+echo -n "Setting hostname: "
+hostname -F /etc/hostname
+check_status
+
+echo -n "Cleaning up system: "
+rm -rf /var/run/*
+> /var/run/utmp
+touch /var/log/wtmp
+touch /var/log/messages
+chmod 0664 /var/run/utmp
+chmod 0664 /var/log/wtmp
+chmod 0660 /var/log/messages
+rm -rf /tmp/*
+check_status
+
+echo -n "Setting up interface lo: "
+ifconfig lo up 127.0.0.1
+check_status
+
+echo "Running start scripts."
+
+for i in /etc/rc.d/start/*
+do
+ if [ -x $i ]; then
+ $i start
+ fi
+done
+
+exit 0
diff --git a/configs/dropbear_config.h b/configs/dropbear_config.h
@@ -111,7 +111,7 @@
/* ECDSA is significantly faster than RSA or DSS. Compiling in ECC
* code (either ECDSA or ECDH) increases binary size - around 30kB
* on x86-64 */
-#define DROPBEAR_ECDSA 1
+#define DROPBEAR_ECDSA 0
/* Ed25519 is faster than ECDSA. Compiling in Ed25519 code increases
binary size - around 7,5kB on x86-64 */
@@ -155,7 +155,7 @@
#define DROPBEAR_DH_GROUP14_SHA1 0
#define DROPBEAR_DH_GROUP14_SHA256 1
#define DROPBEAR_DH_GROUP16 1
-#define DROPBEAR_ECDH 1
+#define DROPBEAR_ECDH 0
#define DROPBEAR_CURVE25519 1
/* When group1 is enabled it will only be allowed by Dropbear client
diff --git a/scripts/build-core-packages.sh b/scripts/build-core-packages.sh
@@ -110,7 +110,6 @@ EXTRACT "IANA_ETC" IANA_ETC "core-pkg-iana-etc"
## Setting hostname
echo ${CLFS_HOSTNAME} > ${CLFS_ROOT}/etc/hostname
-ln -s hostname /etc/HOSTNAME # for compatibility
## Customising /etc/hosts