Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 831762 | Differences between
and this patch

Collapse All | Expand All

(-)/usr/portage/net-misc/openssh/files/sshd-r2.initd (-2 / +17 lines)
Lines 1-5 Link Here
1
#!/sbin/openrc-run
1
#!/sbin/openrc-run
2
# Copyright 1999-2021 Gentoo Authors
2
# Copyright 1999-2022 Gentoo Authors
3
# Distributed under the terms of the GNU General Public License v2
3
# Distributed under the terms of the GNU General Public License v2
4
4
5
extra_commands="checkconfig"
5
extra_commands="checkconfig"
Lines 10-15 extra_started_commands="reload" Link Here
10
: ${SSHD_PIDFILE:=${RC_PREFIX%/}/run/${SVCNAME}.pid}
10
: ${SSHD_PIDFILE:=${RC_PREFIX%/}/run/${SVCNAME}.pid}
11
: ${SSHD_BINARY:=${RC_PREFIX%/}/usr/sbin/sshd}
11
: ${SSHD_BINARY:=${RC_PREFIX%/}/usr/sbin/sshd}
12
: ${SSHD_KEYGEN_BINARY:=${RC_PREFIX%/}/usr/bin/ssh-keygen}
12
: ${SSHD_KEYGEN_BINARY:=${RC_PREFIX%/}/usr/bin/ssh-keygen}
13
: ${SSHD_HOSTKEY_TYPES=""}
13
14
14
command="${SSHD_BINARY}"
15
command="${SSHD_BINARY}"
15
pidfile="${SSHD_PIDFILE}"
16
pidfile="${SSHD_PIDFILE}"
Lines 49-62 depend() { Link Here
49
checkconfig() {
50
checkconfig() {
50
	checkpath --mode 0755 --directory "${RC_PREFIX%/}/var/empty"
51
	checkpath --mode 0755 --directory "${RC_PREFIX%/}/var/empty"
51
52
53
	# Check for sshd_config.
52
	if [ ! -e "${SSHD_CONFIG}" ] ; then
54
	if [ ! -e "${SSHD_CONFIG}" ] ; then
53
		eerror "You need an ${SSHD_CONFIG} file to run sshd"
55
		eerror "You need an ${SSHD_CONFIG} file to run sshd"
54
		eerror "There is a sample file in /usr/share/doc/openssh"
56
		eerror "There is a sample file in /usr/share/doc/openssh"
55
		return 1
57
		return 1
56
	fi
58
	fi
57
59
58
	${SSHD_KEYGEN_BINARY} -A || return 2
60
	# HostKey generation.
61
	if [ -z "${SSHD_HOSTKEY_TYPES}" ] ; then
62
		${SSHD_KEYGEN_BINARY} -A || return 2
63
	else
64
		local hkey_type
65
		for hkey_type in ${SSHD_HOSTKEY_TYPES}; do
66
			local hkey_file="${SSHD_CONFDIR}/ssh_host_${hkey_type}_key"
67
			[ -f "${hkey_file}" ] && continue
68
69
			${SSHD_KEYGEN_BINARY} -t "${hkey_type}" \
70
				-f "${hkey_file}" -N '' || return 2
71
		done
72
	fi
59
73
74
	# Check sshd config file syntax
60
	"${command}" -t ${command_args} || return 3
75
	"${command}" -t ${command_args} || return 3
61
}
76
}
62
77

Return to bug 831762