recent changes in trunk allow us to specify the userid inside the openwrt makefile. the info is stored int he meta data of the IPK contorl file and users are generated by the new generic postinst trigger. Signed-off-by: John Crispin <blogic@openwrt.org>
42 lines
711 B
Bash
42 lines
711 B
Bash
#!/bin/sh /etc/rc.common
|
|
# Copyright (C) 2006-2011 OpenWrt.org
|
|
|
|
START=50
|
|
STOP=50
|
|
|
|
USE_PROCD=1
|
|
PROG=/usr/sbin/sshd
|
|
|
|
start_service() {
|
|
for type in rsa dsa; do {
|
|
# check for keys
|
|
key=/etc/ssh/ssh_host_${type}_key
|
|
[ ! -f $key ] && {
|
|
# generate missing keys
|
|
[ -x /usr/bin/ssh-keygen ] && {
|
|
/usr/bin/ssh-keygen -N '' -t $type -f $key 2>&- >&-
|
|
}
|
|
}
|
|
}; done
|
|
mkdir -m 0700 -p /var/empty
|
|
|
|
procd_open_instance
|
|
procd_set_param command $PROG -D
|
|
procd_close_instance
|
|
}
|
|
|
|
shutdown() {
|
|
local pid
|
|
local pids
|
|
local pid_mine
|
|
|
|
stop
|
|
|
|
# kill active clients
|
|
pid_mine="$$"
|
|
pids="$(pidof sshd)"
|
|
for pid in $pids; do
|
|
[ "$pid" = "$pid_mine" ] && continue
|
|
[ -e "/proc/$pid/stat" ] && kill $pid
|
|
done
|
|
}
|