summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@codethink.co.uk>2012-05-08 13:49:04 +0100
committerTiago Gomes <tiago.gomes@codethink.co.uk>2015-02-11 09:38:40 +0000
commit37a2376f3abdf54bde718f0e85a6e6e4c6a770b0 (patch)
tree0fd6e3ee553f0ad2d23a790a04a4e10574cc02a0
parent28453d58058a4d60c3ebe7d7f0c31a510cbf6158 (diff)
downloadopenssh-git-37a2376f3abdf54bde718f0e85a6e6e4c6a770b0.tar.gz
openssh: add systemd service files
It may be more sensible to add these to openssh's build system rather than substituting and installing them manually, but it requires less alteration of upstream sources. The unit file also doesn't make use of socket activation, so boot times will be suboptimal. Conflicts: openssh.morph
-rw-r--r--opensshd.service.in11
-rwxr-xr-xsshd-keygen.in24
2 files changed, 35 insertions, 0 deletions
diff --git a/opensshd.service.in b/opensshd.service.in
new file mode 100644
index 00000000..2b369bb1
--- /dev/null
+++ b/opensshd.service.in
@@ -0,0 +1,11 @@
+[Unit]
+Description=OpenSSH server daemon
+After=network.target
+
+[Service]
+ExecStartPre=@prefix@/sbin/sshd-keygen
+ExecStart=@prefix@/sbin/sshd -D
+ExecReload=/bin/kill -HUP $MAINPID
+
+[Install]
+WantedBy=multi-user.target
diff --git a/sshd-keygen.in b/sshd-keygen.in
new file mode 100755
index 00000000..cbcbc925
--- /dev/null
+++ b/sshd-keygen.in
@@ -0,0 +1,24 @@
+#!@STARTUP_SCRIPT_SHELL@
+
+prefix=@prefix@
+sysconfdir=@sysconfdir@
+
+SSH_KEYGEN=$prefix/bin/ssh-keygen
+HOST_KEY_RSA1=$sysconfdir/ssh_host_key
+HOST_KEY_DSA=$sysconfdir/ssh_host_dsa_key
+HOST_KEY_RSA=$sysconfdir/ssh_host_rsa_key
+@COMMENT_OUT_ECC@HOST_KEY_ECDSA=$sysconfdir/ssh_host_ecdsa_key
+
+
+if [ ! -f $HOST_KEY_RSA1 ]; then
+ ${SSH_KEYGEN} -t rsa1 -f ${HOST_KEY_RSA1} -N ""
+fi
+if [ ! -f $HOST_KEY_DSA ]; then
+ ${SSH_KEYGEN} -t dsa -f ${HOST_KEY_DSA} -N ""
+fi
+if [ ! -f $HOST_KEY_RSA ]; then
+ ${SSH_KEYGEN} -t rsa -f ${HOST_KEY_RSA} -N ""
+fi
+@COMMENT_OUT_ECC@if [ ! -f $HOST_KEY_ECDSA ]; then
+@COMMENT_OUT_ECC@ ${SSH_KEYGEN} -t ecdsa -f ${HOST_KEY_ECDSA} -N ""
+@COMMENT_OUT_ECC@fi