|
@ -8,7 +8,8 @@ USE_PROCD=1 |
|
|
PROG=/usr/sbin/sshd |
|
|
PROG=/usr/sbin/sshd |
|
|
|
|
|
|
|
|
start_service() { |
|
|
start_service() { |
|
|
for type in rsa ecdsa ed25519; do { |
|
|
|
|
|
|
|
|
for type in rsa ecdsa ed25519 |
|
|
|
|
|
do |
|
|
# check for keys |
|
|
# check for keys |
|
|
key=/etc/ssh/ssh_host_${type}_key |
|
|
key=/etc/ssh/ssh_host_${type}_key |
|
|
[ ! -f $key ] && { |
|
|
[ ! -f $key ] && { |
|
@ -17,10 +18,10 @@ start_service() { |
|
|
/usr/bin/ssh-keygen -N '' -t $type -f $key 2>&- >&- |
|
|
/usr/bin/ssh-keygen -N '' -t $type -f $key 2>&- >&- |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}; done |
|
|
|
|
|
|
|
|
done |
|
|
mkdir -m 0700 -p /var/empty |
|
|
mkdir -m 0700 -p /var/empty |
|
|
|
|
|
|
|
|
local lport=`grep ^Port /etc/ssh/sshd_config | cut -d " " -f 2` |
|
|
|
|
|
|
|
|
local lport=$(awk '/^Port / { print $2; exit }' /etc/ssh/sshd_config) |
|
|
[ -z $lport ] && lport=22 |
|
|
[ -z $lport ] && lport=22 |
|
|
|
|
|
|
|
|
procd_open_instance |
|
|
procd_open_instance |
|
@ -31,16 +32,13 @@ start_service() { |
|
|
|
|
|
|
|
|
shutdown() { |
|
|
shutdown() { |
|
|
local pid |
|
|
local pid |
|
|
local pids |
|
|
|
|
|
local pid_mine |
|
|
|
|
|
|
|
|
|
|
|
stop |
|
|
stop |
|
|
|
|
|
|
|
|
# kill active clients |
|
|
# kill active clients |
|
|
pid_mine="$$" |
|
|
|
|
|
pids="$(pidof sshd)" |
|
|
|
|
|
for pid in $pids; do |
|
|
|
|
|
[ "$pid" = "$pid_mine" ] && continue |
|
|
|
|
|
|
|
|
for pid in $(pidof sshd) |
|
|
|
|
|
do |
|
|
|
|
|
[ "$pid" == "$$" ] && continue |
|
|
[ -e "/proc/$pid/stat" ] && kill $pid |
|
|
[ -e "/proc/$pid/stat" ] && kill $pid |
|
|
done |
|
|
done |
|
|
} |
|
|
} |