You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
778 B
41 lines
778 B
8 years ago
|
#!/bin/sh
|
||
|
|
||
7 years ago
|
. /etc/init.d/globals
|
||
8 years ago
|
|
||
|
ETCDIR=/etc/dropbear
|
||
|
|
||
|
genkeys() {
|
||
6 years ago
|
for keytype in dss rsa ecdsa; do
|
||
7 years ago
|
keyfile=$ETCDIR/dropbear_${keytype}_host_key
|
||
|
test -e $keyfile && continue
|
||
4 years ago
|
/usr/bin/dropbearkey -t $keytype -f $keyfile
|
||
8 years ago
|
done
|
||
|
}
|
||
|
|
||
|
fixperms() {
|
||
|
# /root must be owned by root and must not world writable.
|
||
|
# fresh from the buildsystem it belongs to the building user...
|
||
|
test -L /root -o ! -d /root && return # not a directory
|
||
|
chown 0:0 /root
|
||
|
chmod go-w /root
|
||
|
}
|
||
|
|
||
|
case $1 in
|
||
7 years ago
|
start)
|
||
|
if [ -e /var/etc/.dropbear ]; then
|
||
|
genkeys
|
||
|
fixperms
|
||
4 years ago
|
/usr/sbin/dropbear
|
||
7 years ago
|
fi
|
||
|
;;
|
||
|
stop)
|
||
7 years ago
|
if [ -e /var/etc/.dropbear ]; then
|
||
|
pid=$(cat /var/run/dropbear.pid 2>/dev/null)
|
||
|
test -n "$pid" && kill $pid || true
|
||
|
fi
|
||
7 years ago
|
;;
|
||
|
*)
|
||
|
echo "[${BASENAME}] Usage: $0 {start|stop}"
|
||
|
;;
|
||
8 years ago
|
esac
|