summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Franzmann2022-05-21 14:11:12 +0200
committerFlorian Franzmann2022-05-23 18:01:25 +0200
commit393f3082a311315beb68775841862e9617015ad3 (patch)
tree24ea09499a6f701ad9a8fa733e4dd57726320323
parente7bdd892256c4e204dc4b47838ab4ba7be086180 (diff)
crypto/openssh: add systemd support
-rwxr-xr-xcrypto/openssh/DEPENDS6
-rw-r--r--crypto/openssh/HISTORY3
-rwxr-xr-xcrypto/openssh/INSTALL8
-rw-r--r--crypto/openssh/systemd/sshd.conf1
-rw-r--r--crypto/openssh/systemd/sshd.service14
-rw-r--r--crypto/openssh/systemd/sshdgenkeys.service15
6 files changed, 47 insertions, 0 deletions
diff --git a/crypto/openssh/DEPENDS b/crypto/openssh/DEPENDS
index 77ea40f678..e43ba46070 100755
--- a/crypto/openssh/DEPENDS
+++ b/crypto/openssh/DEPENDS
@@ -30,7 +30,13 @@ if [ "${OPENSSH_LPK}" == "y" ]; then
"--without-ldap" \
"to support sshd checking LDAP for public keys"
fi &&
+
optional_depends "shadow" \
"--with-shadow" \
"--without-shadow" \
"use shadow for password management"
+
+suggest_depends "systemd" \
+ "" \
+ "" \
+ "to install a systemd service"
diff --git a/crypto/openssh/HISTORY b/crypto/openssh/HISTORY
index 190c936dbd..98eddf09ac 100644
--- a/crypto/openssh/HISTORY
+++ b/crypto/openssh/HISTORY
@@ -1,3 +1,6 @@
+2022-05-21 Florian Franzmann <bwlf@bandrate.org>
+ * DEPENDS, INSTALL, systemd: add support for systemd
+
2022-04-08 Treeve Jelbert <treeve@sourcemage.org>
* DETAILS: version 9.0p1
diff --git a/crypto/openssh/INSTALL b/crypto/openssh/INSTALL
new file mode 100755
index 0000000000..35da03738e
--- /dev/null
+++ b/crypto/openssh/INSTALL
@@ -0,0 +1,8 @@
+default_install &&
+
+if spell_installed systemd; then
+ install -m 644 -o root -g root "$SPELL_DIRECTORY/systemd/"*.service "$INSTALL_ROOT/lib/systemd/system/" &&
+ install -m 644 -o root -g root "$SPELL_DIRECTORY/systemd/sshd.conf" "$INSTALL_ROOT/usr/lib/tmpfiles.d/" &&
+
+ systemctl daemon-reload
+fi
diff --git a/crypto/openssh/systemd/sshd.conf b/crypto/openssh/systemd/sshd.conf
new file mode 100644
index 0000000000..ca2a393542
--- /dev/null
+++ b/crypto/openssh/systemd/sshd.conf
@@ -0,0 +1 @@
+d /var/empty 0755 root root
diff --git a/crypto/openssh/systemd/sshd.service b/crypto/openssh/systemd/sshd.service
new file mode 100644
index 0000000000..99b09b680b
--- /dev/null
+++ b/crypto/openssh/systemd/sshd.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=OpenSSH Daemon
+Wants=sshdgenkeys.service
+After=sshdgenkeys.service
+After=network.target
+
+[Service]
+ExecStart=/usr/sbin/sshd -D
+ExecReload=/bin/kill -HUP $MAINPID
+KillMode=process
+Restart=always
+
+[Install]
+WantedBy=multi-user.target
diff --git a/crypto/openssh/systemd/sshdgenkeys.service b/crypto/openssh/systemd/sshdgenkeys.service
new file mode 100644
index 0000000000..cfb9f6aa17
--- /dev/null
+++ b/crypto/openssh/systemd/sshdgenkeys.service
@@ -0,0 +1,15 @@
+[Unit]
+Description=SSH Key Generation
+ConditionPathExists=|!/etc/ssh/ssh_host_dsa_key
+ConditionPathExists=|!/etc/ssh/ssh_host_dsa_key.pub
+ConditionPathExists=|!/etc/ssh/ssh_host_ecdsa_key
+ConditionPathExists=|!/etc/ssh/ssh_host_ecdsa_key.pub
+ConditionPathExists=|!/etc/ssh/ssh_host_ed25519_key
+ConditionPathExists=|!/etc/ssh/ssh_host_ed25519_key.pub
+ConditionPathExists=|!/etc/ssh/ssh_host_rsa_key
+ConditionPathExists=|!/etc/ssh/ssh_host_rsa_key.pub
+
+[Service]
+ExecStart=/usr/bin/ssh-keygen -A
+Type=oneshot
+RemainAfterExit=yes