diff --git a/defaults/main.yml b/defaults/main.yml index 704dca3..81a9919 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -70,3 +70,7 @@ __sshd_defaults: {} __sshd_os_supported: no __sshd_sysconfig_supports_crypto_policy: false __sshd_sysconfig_supports_use_strong_rng: false + + +__sshd_runtime_directory: false +__sshd_runtime_directory_mode: "0755" diff --git a/tasks/install.yml b/tasks/install.yml index 45bbf8c..f357ee7 100644 --- a/tasks/install.yml +++ b/tasks/install.yml @@ -84,6 +84,16 @@ changed_when: False when: sshd_test_hostkey.path is defined + - name: Make sure sshd runtime directory is present + file: + path: "{{ __sshd_runtime_directory }}" + state: directory + owner: root + group: root + mode: "{{ __sshd_runtime_directory_mode }}" + when: + - __sshd_runtime_directory | d(false) | bool + - name: Create the configuration file template: src: sshd_config.j2 diff --git a/vars/Debian.yml b/vars/Debian.yml index a95c39b..4aed470 100644 --- a/vars/Debian.yml +++ b/vars/Debian.yml @@ -34,3 +34,4 @@ __sshd_defaults: Subsystem: "sftp {{ sshd_sftp_server }}" UsePAM: yes __sshd_os_supported: yes +__sshd_runtime_directory: /run/sshd diff --git a/vars/Debian_10.yml b/vars/Debian_10.yml index cca5691..17c00a7 100644 --- a/vars/Debian_10.yml +++ b/vars/Debian_10.yml @@ -32,3 +32,4 @@ __sshd_defaults: Subsystem: "sftp {{ sshd_sftp_server }}" UsePAM: yes __sshd_os_supported: yes +__sshd_runtime_directory: /run/sshd diff --git a/vars/Debian_8.yml b/vars/Debian_8.yml index f559c00..c5cace0 100644 --- a/vars/Debian_8.yml +++ b/vars/Debian_8.yml @@ -36,3 +36,4 @@ __sshd_defaults: Subsystem: "sftp {{ sshd_sftp_server }}" UsePAM: yes __sshd_os_supported: yes +__sshd_runtime_directory: /run/sshd diff --git a/vars/Debian_9.yml b/vars/Debian_9.yml index 10745d2..dc31e01 100644 --- a/vars/Debian_9.yml +++ b/vars/Debian_9.yml @@ -32,3 +32,4 @@ __sshd_defaults: Subsystem: "sftp {{ sshd_sftp_server }}" UsePAM: yes __sshd_os_supported: yes +__sshd_runtime_directory: /run/sshd diff --git a/vars/Ubuntu_18.yml b/vars/Ubuntu_18.yml index da8a005..46a500a 100644 --- a/vars/Ubuntu_18.yml +++ b/vars/Ubuntu_18.yml @@ -13,3 +13,4 @@ __sshd_defaults: AcceptEnv: LANG LC_* Subsystem: "sftp {{ sshd_sftp_server }}" __sshd_os_supported: yes +__sshd_runtime_directory: /run/sshd diff --git a/vars/Ubuntu_20.yml b/vars/Ubuntu_20.yml index a60fba4..57a6057 100644 --- a/vars/Ubuntu_20.yml +++ b/vars/Ubuntu_20.yml @@ -12,3 +12,4 @@ __sshd_defaults: AcceptEnv: LANG LC_* Subsystem: "sftp /usr/lib/openssh/sftp-server" __sshd_os_supported: yes +__sshd_runtime_directory: /run/sshd