comparison network/openssh/sshd @ 533:9f90de3d806f

network: use new FHS
author David Demelier <markand@malikania.fr>
date Wed, 10 Apr 2019 20:16:00 +0200
parents f2c94d482098
children 657ee4987f4d
comparison
equal deleted inserted replaced
532:341987b63363 533:9f90de3d806f
1 #!/bin/sh 1 #!/bin/sh
2 # 2 #
3 # /etc/rc.d/sshd: run control script for sshd 3 # /etc/rc.d/sshd: run control script for sshd
4 4
5 if [ -f /etc/rc.conf ]; then 5 if [ -f /etc/rc.conf ]; then
6 source /etc/rc.conf 6 . /etc/rc.conf
7 fi 7 fi
8 8
9 : ${SSHD_CMD:=/usr/sbin/sshd} 9 : ${SSHD_CMD:=/bin/sshd}
10 : ${SSHD_ARGS:=} 10 : ${SSHD_ARGS:=}
11 : ${SSHD_PID:=/var/run/sshd.pid} 11 : ${SSHD_PID:=/var/run/sshd.pid}
12 12
13 sshd_start() 13 sshd_start()
14 { 14 {
15 if [ ! -f /etc/ssh/ssh_host_rsa_key ]; then 15 if [ ! -f /etc/ssh/ssh_host_rsa_key ]; then
16 /usr/bin/ssh-keygen -q -t rsa -b 2048 -N "" -f /etc/ssh/ssh_host_rsa_key 16 /bin/ssh-keygen -q -t rsa -b 2048 -N "" -f /etc/ssh/ssh_host_rsa_key
17 fi 17 fi
18 if [ ! -f /etc/ssh/ssh_host_dsa_key ]; then 18 if [ ! -f /etc/ssh/ssh_host_dsa_key ]; then
19 /usr/bin/ssh-keygen -q -t dsa -N "" -f /etc/ssh/ssh_host_dsa_key 19 /bin/ssh-keygen -q -t dsa -N "" -f /etc/ssh/ssh_host_dsa_key
20 fi 20 fi
21 if [ ! -f /etc/ssh/ssh_host_ecdsa_key ]; then 21 if [ ! -f /etc/ssh/ssh_host_ecdsa_key ]; then
22 /usr/bin/ssh-keygen -q -t ecdsa -b 521 -N "" -f /etc/ssh/ssh_host_ecdsa_key 22 /bin/ssh-keygen -q -t ecdsa -b 521 -N "" -f /etc/ssh/ssh_host_ecdsa_key
23 fi 23 fi
24 if [ ! -f /etc/ssh/ssh_host_ed25519_key ]; then 24 if [ ! -f /etc/ssh/ssh_host_ed25519_key ]; then
25 /usr/bin/ssh-keygen -q -t ed25519 -N "" -f /etc/ssh/ssh_host_ed25519_key 25 /bin/ssh-keygen -q -t ed25519 -N "" -f /etc/ssh/ssh_host_ed25519_key
26 fi 26 fi
27 27
28 echo "Starting sshd: $SSHD_CMD $SSHD_ARGS" 28 echo "Starting sshd: $SSHD_CMD $SSHD_ARGS"
29 $SSHD_CMD $SSHD_ARGS -p $SSHD_PID 29 $SSHD_CMD $SSHD_ARGS -p $SSHD_PID
30 } 30 }
39 } 39 }
40 40
41 sshd_stop() 41 sshd_stop()
42 { 42 {
43 if [ -s $SSHD_PID ]; then 43 if [ -s $SSHD_PID ]; then
44 echo "Stopping sshd..." 44 echo "Stopping sshd."
45 kill -QUIT $SSHD_PID 45 kill -QUIT $SSHD_PID
46 fi 46 fi
47 } 47 }
48 48
49 sshd_restart() 49 sshd_restart()