From d25cb8b0c9dd79e735b204957d711569e33f3866 Mon Sep 17 00:00:00 2001 From: Brice Messeca Date: Fri, 19 Jun 2020 17:42:48 +0200 Subject: [PATCH 1/3] fix sftp_start_directory to be compatible with sftp_directories list of dict --- tasks/main.yml | 2 +- tests/test.yml | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index d77bb5e..0864b6a 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -48,7 +48,7 @@ AllowTCPForwarding no PermitTunnel no X11Forwarding no - ForceCommand internal-sftp {{ sftp_enable_logging | ternary('-l VERBOSE', '') }} {{ (sftp_start_directory in sftp_directories) | ternary('-d /' + sftp_start_directory, '') }} + ForceCommand internal-sftp {{ sftp_enable_logging | ternary('-l VERBOSE', '') }} {{ (sftp_start_directory in sftp_directories or sftp_start_directory in sftp_directories | map(attribute='name') | list) | ternary('-d /' + sftp_start_directory, '') }} PasswordAuthentication {{ sftp_allow_passwords | ternary('yes', 'no') }} notify: SFTP-Server | Restart sshd diff --git a/tests/test.yml b/tests/test.yml index 3f774f4..0de6204 100644 --- a/tests/test.yml +++ b/tests/test.yml @@ -5,7 +5,9 @@ sftp_directories: - test1 - test2 - sftp_start_directory: test1 + - name: test5 + mode: 770 + sftp_start_directory: test5 sftp_users: - name: user1 password: "" From 6102b79b400dd1823770e2b8c1d1610d5c52e840 Mon Sep 17 00:00:00 2001 From: Brice Messeca Date: Tue, 23 Jun 2020 18:57:12 +0200 Subject: [PATCH 2/3] fix sftp_directory mix usage (list and dict) --- tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/main.yml b/tasks/main.yml index 0864b6a..1324644 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -48,7 +48,7 @@ AllowTCPForwarding no PermitTunnel no X11Forwarding no - ForceCommand internal-sftp {{ sftp_enable_logging | ternary('-l VERBOSE', '') }} {{ (sftp_start_directory in sftp_directories or sftp_start_directory in sftp_directories | map(attribute='name') | list) | ternary('-d /' + sftp_start_directory, '') }} + ForceCommand internal-sftp {{ sftp_enable_logging | ternary('-l VERBOSE', '') }} {{ (sftp_start_directory in sftp_directories or sftp_start_directory in sftp_directories | map(attribute='name', default="") | list) | ternary('-d /' + sftp_start_directory, '') }} PasswordAuthentication {{ sftp_allow_passwords | ternary('yes', 'no') }} notify: SFTP-Server | Restart sshd From 60edecdb1ace90d0fdcb43835fc50426b190dd82 Mon Sep 17 00:00:00 2001 From: Brice Messeca Date: Thu, 25 Jun 2020 15:20:27 +0200 Subject: [PATCH 3/3] fix sftp_directory mix usage (list and dict) --- tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/main.yml b/tasks/main.yml index 1324644..da49af1 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -48,7 +48,7 @@ AllowTCPForwarding no PermitTunnel no X11Forwarding no - ForceCommand internal-sftp {{ sftp_enable_logging | ternary('-l VERBOSE', '') }} {{ (sftp_start_directory in sftp_directories or sftp_start_directory in sftp_directories | map(attribute='name', default="") | list) | ternary('-d /' + sftp_start_directory, '') }} + ForceCommand internal-sftp {{ sftp_enable_logging | ternary('-l VERBOSE', '') }} {{ (sftp_start_directory in sftp_directories or sftp_start_directory in sftp_directories | selectattr("name", "defined") | map(attribute='name') | list) | ternary('-d /' + sftp_start_directory, '') }} PasswordAuthentication {{ sftp_allow_passwords | ternary('yes', 'no') }} notify: SFTP-Server | Restart sshd