Upstart script for Dropbear SSH server

A very sleak upstart job script for dropbear.

I’ve replaced the classic OpenSSH server with Dropbear: it’s basically the same speed, lot less on memory and I don’t use most of the functions of OpenSSH.

Since I’m on Ubuntu 12.04, the elengant way would be to use Upstart ( also, the respawn is very useful ), so here is my script in /etc/init/dropbear.conf:


description "Dropbear SSH server"
author "Peter Molnar <hello @petermolnar.eu>"

start on filesystem or runlevel [2345]
stop on runlevel [!2345]

respawn
respawn limit 10 5
umask 022

env DROPBEAR_PORT=2222
env DROPBEAR_RSAKEY=/etc/dropbear/dropbear_rsa_host_key
env DROPBEAR_DSSKEY=/etc/dropbear/dropbear_dss_host_key
env DROPBEAR_RECEIVE_WINDOW=65535

pre-start script
        test -x /usr/sbin/dropbear || { stop; exit 1; }
end script

expect daemon

exec /usr/sbin/dropbear -d $DROPBEAR_DSSKEY -r $DROPBEAR_RSAKEY -p $DROPBEAR_PORT -W $DROPBEAR_RECEIVE_WINDOW


Encourage creation!

If this entry helped you, or you simply liked it, leave a tip.