enable-ssh.sh turns a factory raw SD image (King Kong LE 0.97) into an SSH-enabled one: injects the static dropbear/dropbearkey/sftp-server binaries, the SysV init script (/etc/init.d/sshd), the S30sshd boot symlink and the caller-supplied public key into the ext3 rootfs partition with debugfs (no mounting). The input image is never modified, the output path must be explicit and distinct, and every byte outside p2 is verified identical afterwards. The public key is an explicit -k argument — nothing is baked in and private keys are rejected. --dry-run supported; --force for non-standard p2 geometry. bin/ is byte-identical to the deployed king_kong_le-0_97_0.ssh image. validate-image.sh functionally proves a result (boots the image's own init script under qemu, real ssh pubkey login, password auth refused, sftp round-trip); build-binaries.sh rebuilds bin/ in Docker. Co-Authored-By: Claude Code <noreply@anthropic.com>
37 lines
633 B
Bash
Executable File
37 lines
633 B
Bash
Executable File
#!/bin/sh
|
|
|
|
DAEMON=/usr/local/bin/dropbear
|
|
KEYDIR=/data/dropbear
|
|
|
|
NAME=dropbear
|
|
case "$1" in
|
|
start)
|
|
echo -n "Starting $NAME: "
|
|
mkdir -p $KEYDIR
|
|
for T in rsa ecdsa ed25519; do
|
|
if [ ! -f $KEYDIR/dropbear_${T}_host_key ]; then
|
|
/usr/local/bin/dropbearkey -t $T -f $KEYDIR/dropbear_${T}_host_key
|
|
fi
|
|
done
|
|
$DAEMON \
|
|
-r $KEYDIR/dropbear_rsa_host_key \
|
|
-r $KEYDIR/dropbear_ecdsa_host_key \
|
|
-r $KEYDIR/dropbear_ed25519_host_key
|
|
echo "OK"
|
|
;;
|
|
stop)
|
|
echo -n "Stopping $NAME: "
|
|
start-stop-daemon -K -n $NAME
|
|
echo "OK"
|
|
;;
|
|
restart)
|
|
$0 stop
|
|
$0 start
|
|
;;
|
|
*)
|
|
echo "Usage: $0 {start|stop|restart}"
|
|
exit 1
|
|
esac
|
|
|
|
exit 0
|