svn commit: r363553 - stable/12/libexec/rc/rc.d
Mateusz Piotrowski
0mp at FreeBSD.org
Sun Jul 26 10:01:28 UTC 2020
Author: 0mp (doc,ports committer)
Date: Sun Jul 26 10:01:27 2020
New Revision: 363553
URL: https://svnweb.freebsd.org/changeset/base/363553
Log:
MFC 359973:
sshd: Warn about missing ssh-keygen only when necessary
The sshd service is using ssh-keygen to generate missing SSH keys.
If ssh-keygen is missing, it prints the following message:
> /etc/rc.d/sshd: WARNING: /usr/bin/ssh-keygen does not exist.
It makes sense when the key is not generated yet and
cannot be created because ssh-keygen is missing.
The problem is that even if the key is present on the host,
the sshd service would still warn about missing ssh-keygen
(even though it does not need it).
Reviewed by: emaste
Approved by: emaste (src)
Differential Revision: https://reviews.freebsd.org/D23911
Modified:
stable/12/libexec/rc/rc.d/sshd
Directory Properties:
stable/12/ (props changed)
Modified: stable/12/libexec/rc/rc.d/sshd
==============================================================================
--- stable/12/libexec/rc/rc.d/sshd Sun Jul 26 09:58:52 2020 (r363552)
+++ stable/12/libexec/rc/rc.d/sshd Sun Jul 26 10:01:27 2020 (r363553)
@@ -45,18 +45,19 @@ sshd_keygen_alg()
;;
esac
+ if [ -f "${keyfile}" ] ; then
+ info "$ALG host key exists."
+ return 0
+ fi
+
if [ ! -x /usr/bin/ssh-keygen ] ; then
warn "/usr/bin/ssh-keygen does not exist."
return 1
fi
- if [ -f "${keyfile}" ] ; then
- info "$ALG host key exists."
- else
- echo "Generating $ALG host key."
- /usr/bin/ssh-keygen -q -t $alg -f "$keyfile" -N ""
- /usr/bin/ssh-keygen -l -f "$keyfile.pub"
- fi
+ echo "Generating $ALG host key."
+ /usr/bin/ssh-keygen -q -t $alg -f "$keyfile" -N ""
+ /usr/bin/ssh-keygen -l -f "$keyfile.pub"
}
sshd_keygen()
More information about the svn-src-stable
mailing list