#!/bin/sh ### # # FreeWLAN Addons - http://www.freewlan.info # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301, USA # # http://www.gnu.org/copyleft/gpl.html # ### . /etc/functions.sh config_load remote config_get ssh method ssh config_get ssh_port method ssh_port for type in rsa dss; do { # check for keys key=/etc/dropbear/dropbear_${type}_host_key [ ! -f $key ] && { # generate missing keys mkdir -p /etc/dropbear [ -x /usr/bin/dropbearkey ] && { /usr/bin/dropbearkey -t $type -f $key 2>&- >&- && exec $0 $* } & exit 0 } }; done case $1 in start) if enabled $ssh $0 stop then if [ ! -f /var/run/dropbear.pid ] then if [ ${#ssh_port} = "0" ]; then /usr/sbin/dropbear else /usr/sbin/dropbear -p 22 -p $ssh_port fi fi fi exit 0 ;; stop) if [ -f /var/run/dropbear.pid ] then killall dropbear fi if [ -f /var/run/dropbear.pid ] then rm -f /var/run/dropbear.pid fi exit 0 ;; *) echo "Usage: $0 (start|stop)" exit 1 ;; esac