Mercurial > vanilla
view network/openssh/sshd @ 669:97da3728a2f8
core/bash-completion: fix CMake config directory
author | David Demelier <markand@malikania.fr> |
---|---|
date | Wed, 31 Jul 2019 21:05:00 +0200 |
parents | 657ee4987f4d |
children | 3dfef64b81c1 |
line wrap: on
line source
#!/bin/sh # # /etc/rc.d/sshd -- run control script for sshd # # Copyright (c) 2019 David Demelier <markand@malikania.fr> # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # if [ -f /etc/rc.conf ]; then . /etc/rc.conf fi : ${SSHD_CMD:=/bin/sshd} : ${SSHD_ARGS:=} : ${SSHD_PID:=/var/run/sshd.pid} sshd_start() { if [ ! -f /etc/ssh/ssh_host_rsa_key ]; then /bin/ssh-keygen -q -t rsa -b 2048 -N "" -f /etc/ssh/ssh_host_rsa_key fi if [ ! -f /etc/ssh/ssh_host_dsa_key ]; then /bin/ssh-keygen -q -t dsa -N "" -f /etc/ssh/ssh_host_dsa_key fi if [ ! -f /etc/ssh/ssh_host_ecdsa_key ]; then /bin/ssh-keygen -q -t ecdsa -b 521 -N "" -f /etc/ssh/ssh_host_ecdsa_key fi if [ ! -f /etc/ssh/ssh_host_ed25519_key ]; then /bin/ssh-keygen -q -t ed25519 -N "" -f /etc/ssh/ssh_host_ed25519_key fi echo "Starting sshd: $SSHD_CMD $SSHD_ARGS" $SSHD_CMD $SSHD_ARGS -p $SSHD_PID } sshd_status() { if [ -s $SSHD_PID ]; then echo "sshd is running with pid: `cat $SSHD_PID`" else echo "sshd is not running" fi } sshd_stop() { if [ -s $SSHD_PID ]; then echo "Stopping sshd." kill -QUIT $SSHD_PID fi } sshd_restart() { sshd_stop sleep 3 sshd_start } case $1 in start) sshd_start ;; status) sshd_status ;; stop) sshd_stop ;; restart) sshd_restart ;; *) echo "usage: $(basename $0) restart|start|status|stop" ;; esac