]>
git.ipfire.org Git - people/teissler/ipfire-2.x.git/blob - src/initscripts/init.d/sshd
2 # Begin $rc_base/init.d/sshd
4 # Based on sysklogd script from LFS-3.1 and earlier.
5 # Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org
7 #$LastChangedBy: bdubbs $
8 #$Date: 2006-04-15 17:34:16 -0500 (Sat, 15 Apr 2006) $
15 if [ ! -e "/etc/ssh/ssh_host_key" ]; then
16 boot_mesg
"Generating SSH host key..."
17 ssh-keygen
-qf /etc
/ssh
/ssh_host_key
-N '' -t rsa1
21 for algo
in rsa dsa ecdsa ed25519
; do
22 keyfile
="/etc/ssh/ssh_host_${algo}_key"
24 # If the key already exists, there is nothing to do.
25 [ -e "${keyfile}" ] && continue
33 boot_mesg
"Generating SSH key (${algo})..."
34 ssh-keygen
-qf "${keyfile}" -N '' -t ${algo}
38 [ -e "/var/ipfire/remote/enablessh" ] ||
exit 0 # SSH is not enabled
39 boot_mesg
"Starting SSH Server..."
40 loadproc
/usr
/sbin
/sshd
42 # Also prevent ssh from being killed by out of memory conditions
45 pid
=$
(cat /var
/run
/sshd.pid
2>/dev
/null
)
46 [ -n "${pid}" ] && echo "-16" > "/proc/${pid}/oom_score_adj"
51 boot_mesg
"Stopping SSH Server..."
52 killproc
/usr
/sbin
/sshd
56 boot_mesg
"Reloading SSH Server..."
57 reloadproc
/usr
/sbin
/sshd
67 statusproc
/usr
/sbin
/sshd
71 echo "Usage: $0 {start|stop|reload|restart|status}"
76 # End $rc_base/init.d/sshd