summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>2000-02-28 19:21:05 +0000
committerjkh <jkh@FreeBSD.org>2000-02-28 19:21:05 +0000
commite15679d81e80bf769a7866ccf03b346abd429e61 (patch)
tree94473f614b2e2195da6f1f78bded01e35fdcf47e
parent5dffca5013c0de6e26b8856753725a833d02a04a (diff)
downloadFreeBSD-src-e15679d81e80bf769a7866ccf03b346abd429e61.zip
FreeBSD-src-e15679d81e80bf769a7866ccf03b346abd429e61.tar.gz
Generate new sshd host key when necessary. I'm tired of
waiting for someone to commit this. :)
-rw-r--r--etc/network.subr8
-rw-r--r--etc/rc.d/netoptions8
-rw-r--r--etc/rc.d/network18
-rw-r--r--etc/rc.d/network28
-rw-r--r--etc/rc.d/network38
-rw-r--r--etc/rc.d/routing8
-rw-r--r--etc/rc.network8
7 files changed, 49 insertions, 7 deletions
diff --git a/etc/network.subr b/etc/network.subr
index 3b0771c..a4992f1 100644
--- a/etc/network.subr
+++ b/etc/network.subr
@@ -605,7 +605,13 @@ network_pass3() {
case ${sshd_enable} in
[Yy][Ee][Ss])
- echo -n ' sshd';
+ if [ ! -f /etc/ssh/ssh_host_key ]; then
+ echo creating ssh host key
+ /usr/bin/ssh-keygen -N "" -f /etc/ssh/ssh_host_key
+ echo now starting sshd
+ else
+ echo -n ' sshd';
+ fi
${sshd_program:-/usr/sbin/sshd} ${sshd_flags}
;;
esac
diff --git a/etc/rc.d/netoptions b/etc/rc.d/netoptions
index 3b0771c..a4992f1 100644
--- a/etc/rc.d/netoptions
+++ b/etc/rc.d/netoptions
@@ -605,7 +605,13 @@ network_pass3() {
case ${sshd_enable} in
[Yy][Ee][Ss])
- echo -n ' sshd';
+ if [ ! -f /etc/ssh/ssh_host_key ]; then
+ echo creating ssh host key
+ /usr/bin/ssh-keygen -N "" -f /etc/ssh/ssh_host_key
+ echo now starting sshd
+ else
+ echo -n ' sshd';
+ fi
${sshd_program:-/usr/sbin/sshd} ${sshd_flags}
;;
esac
diff --git a/etc/rc.d/network1 b/etc/rc.d/network1
index 3b0771c..a4992f1 100644
--- a/etc/rc.d/network1
+++ b/etc/rc.d/network1
@@ -605,7 +605,13 @@ network_pass3() {
case ${sshd_enable} in
[Yy][Ee][Ss])
- echo -n ' sshd';
+ if [ ! -f /etc/ssh/ssh_host_key ]; then
+ echo creating ssh host key
+ /usr/bin/ssh-keygen -N "" -f /etc/ssh/ssh_host_key
+ echo now starting sshd
+ else
+ echo -n ' sshd';
+ fi
${sshd_program:-/usr/sbin/sshd} ${sshd_flags}
;;
esac
diff --git a/etc/rc.d/network2 b/etc/rc.d/network2
index 3b0771c..a4992f1 100644
--- a/etc/rc.d/network2
+++ b/etc/rc.d/network2
@@ -605,7 +605,13 @@ network_pass3() {
case ${sshd_enable} in
[Yy][Ee][Ss])
- echo -n ' sshd';
+ if [ ! -f /etc/ssh/ssh_host_key ]; then
+ echo creating ssh host key
+ /usr/bin/ssh-keygen -N "" -f /etc/ssh/ssh_host_key
+ echo now starting sshd
+ else
+ echo -n ' sshd';
+ fi
${sshd_program:-/usr/sbin/sshd} ${sshd_flags}
;;
esac
diff --git a/etc/rc.d/network3 b/etc/rc.d/network3
index 3b0771c..a4992f1 100644
--- a/etc/rc.d/network3
+++ b/etc/rc.d/network3
@@ -605,7 +605,13 @@ network_pass3() {
case ${sshd_enable} in
[Yy][Ee][Ss])
- echo -n ' sshd';
+ if [ ! -f /etc/ssh/ssh_host_key ]; then
+ echo creating ssh host key
+ /usr/bin/ssh-keygen -N "" -f /etc/ssh/ssh_host_key
+ echo now starting sshd
+ else
+ echo -n ' sshd';
+ fi
${sshd_program:-/usr/sbin/sshd} ${sshd_flags}
;;
esac
diff --git a/etc/rc.d/routing b/etc/rc.d/routing
index 3b0771c..a4992f1 100644
--- a/etc/rc.d/routing
+++ b/etc/rc.d/routing
@@ -605,7 +605,13 @@ network_pass3() {
case ${sshd_enable} in
[Yy][Ee][Ss])
- echo -n ' sshd';
+ if [ ! -f /etc/ssh/ssh_host_key ]; then
+ echo creating ssh host key
+ /usr/bin/ssh-keygen -N "" -f /etc/ssh/ssh_host_key
+ echo now starting sshd
+ else
+ echo -n ' sshd';
+ fi
${sshd_program:-/usr/sbin/sshd} ${sshd_flags}
;;
esac
diff --git a/etc/rc.network b/etc/rc.network
index 3b0771c..a4992f1 100644
--- a/etc/rc.network
+++ b/etc/rc.network
@@ -605,7 +605,13 @@ network_pass3() {
case ${sshd_enable} in
[Yy][Ee][Ss])
- echo -n ' sshd';
+ if [ ! -f /etc/ssh/ssh_host_key ]; then
+ echo creating ssh host key
+ /usr/bin/ssh-keygen -N "" -f /etc/ssh/ssh_host_key
+ echo now starting sshd
+ else
+ echo -n ' sshd';
+ fi
${sshd_program:-/usr/sbin/sshd} ${sshd_flags}
;;
esac
OpenPOWER on IntegriCloud