janmojzis / tinyssh

TinySSH is small server (less than 100000 words of code)
Creative Commons Zero v1.0 Universal
1.44k stars 79 forks source link

tinyssh-initramfs scripts for debian users #40

Open blob42 opened 5 years ago

blob42 commented 5 years ago

Hi,

I looked for an equivalent to mkinitcpio-tinyssh for debian and could not find it anywhere.
I made a quick one using initramfs-tools based on the already existing dropbear hooks and the Arch one.

Sharing it here for future users, feel free to include it in your repo if you wish.

https://git.sp4ke.com/sp4ke/tinyssh-initramfs

alexmyczko commented 3 years ago

do you also have an /etc/init.d/tinysshd by chance?

blob42 commented 3 years ago

I'm not sure what you need buy on the main system I'm using a systemd socket+service

alexmyczko commented 3 years ago

there's no systemd for debian gnu/kfreebsd.

terefang commented 3 years ago

@alexmyczko you might use this one (requires busybox)

#!/bin/sh
# ***********
if [ ! -e /etc/tinyssh/ed25519.pk ]; then
  mkdir /etc/tinysshd
  tinysshd-makekey /etc/tinysshd
fi
#
case "$1" in
  start)
    echo -n "starting tiny-sshd ... "
    /bin/busybox start-stop-daemon -p /var/run/tinysshd.pid -m -S /bin/busybox -- tcpsvd 0 22 /usr/sbin/tinysshd -v /etc/tinysshd &
    while [ ! -e /var/run/tinysshd.pid ]; do
      echo -n '!'
      sleep 1
    done
    echo '!'
    ;;
  stop)
    echo "stopping tiny-sshd ..."
    /bin/busybox start-stop-daemon -p /var/run/tinysshd.pid -s KILL -K
    ;;
  *) exit 1
    ;;
esac
#