Modification : vm_{host,hosted,remote} -> {host,local,remote}/ .
[lhc/ateliers.git] / etc / sv / sshd / local.sh
diff --git a/etc/sv/sshd/local.sh b/etc/sv/sshd/local.sh
new file mode 100644 (file)
index 0000000..d3d6933
--- /dev/null
@@ -0,0 +1,21 @@
+"$tool"/local/apt-get-install openssh-server
+"$tool"/local/insserv-remove      ssh
+ssh-keygen -F "$vm_fqdn" -f "$tool"/etc/openssh/known_hosts |
+( while IFS= read -r line
+ do case $line in (*" RSA") return 0; break;; esac
+ done; return 1 ) ||
+sudo ssh-keygen -t rsa -b 4096 -N '' -f /etc/ssh/ssh_host_rsa_key
+sudo rm -f \
+ /etc/ssh/ssh_host_dsa_key \
+ /etc/ssh/ssh_host_dsa_key.pub \
+ /etc/ssh/ssh_host_ecdsa_key \
+ /etc/ssh/ssh_host_ecdsa_key.pub
+ # NOTE: clefs générées par Debian
+m4 \
+ --define=VM_IPV4=$vm_ipv4 \
+ <"$tool"/etc/ssh/sshd_config.m4 |
+sudo install -m 640 -o root -g root /dev/stdin \
+ /etc/ssh/sshd_config
+sudo install -m 644 -o root -g root \
+ "$tool"/etc/ssh/ssh_config \
+        /etc/ssh/ssh_config