Document internal __sshd_runtime_directory variable and use it in the service files

This commit is contained in:
Jakub Jelen 2022-09-26 16:43:15 +02:00
parent 1ae6284951
commit 1cf57fe318
4 changed files with 12 additions and 6 deletions

View file

@ -1,7 +1,9 @@
[Unit] [Unit]
Description=OpenBSD Secure Shell server Description=OpenBSD Secure Shell server
Documentation=man:sshd(8) man:sshd_config(5)
[Service] [Service]
Type=notify
ExecStartPre={{ sshd_binary }} -t ExecStartPre={{ sshd_binary }} -t
ExecStart={{ sshd_binary }} -D -f {{ sshd_config_file }} ExecStart={{ sshd_binary }} -D -f {{ sshd_config_file }}
ExecReload={{ sshd_binary }} -t ExecReload={{ sshd_binary }} -t
@ -9,9 +11,8 @@ ExecReload=/bin/kill -HUP $MAINPID
KillMode=process KillMode=process
Restart=on-failure Restart=on-failure
RestartPreventExitStatus=255 RestartPreventExitStatus=255
Type=notify RuntimeDirectory={{ __sshd_runtime_directory }}
RuntimeDirectory={{ sshd_binary | basename }} RuntimeDirectoryMode={{ __sshd_runtime_directory_mode }}
RuntimeDirectoryMode=0755
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

View file

@ -1,7 +1,8 @@
[Unit] [Unit]
Description=OpenBSD Secure Shell server socket Description=OpenBSD Secure Shell server socket
Documentation=man:sshd(8) man:sshd_config(5)
Before={{ sshd_service }}.service Before={{ sshd_service }}.service
Conflicts={{sshd_service }}.service Conflicts={{ sshd_service }}.service
[Socket] [Socket]
ListenStream=22 ListenStream=22

View file

@ -1,9 +1,10 @@
[Unit] [Unit]
Description=OpenBSD Secure Shell server per-connection daemon Description=OpenBSD Secure Shell server per-connection daemon
Documentation=man:sshd(8) man:sshd_config(5)
After=auditd.service After=auditd.service
[Service] [Service]
ExecStart=-{{ sshd_binary }} -i -f {{ sshd_config_file }} ExecStart=-{{ sshd_binary }} -i -f {{ sshd_config_file }}
StandardInput=socket StandardInput=socket
RuntimeDirectory={{ sshd_binary }} RuntimeDirectory={{ __sshd_runtime_directory }}
RuntimeDirectoryMode=0755 RuntimeDirectoryMode={{ __sshd_runtime_directory_mode }}

View file

@ -31,6 +31,9 @@ __sshd_os_supported: no
__sshd_sysconfig_supports_crypto_policy: false __sshd_sysconfig_supports_crypto_policy: false
__sshd_sysconfig_supports_use_strong_rng: false __sshd_sysconfig_supports_use_strong_rng: false
# The runtime directory is used by systemd to provide termoporary directory for the service
# This is used as a RuntimeDirectory= option in the service file and it needs to exist
# before running sshd for example in the validate mode.
__sshd_runtime_directory: ~ __sshd_runtime_directory: ~
__sshd_runtime_directory_mode: "0755" __sshd_runtime_directory_mode: "0755"