Skip to content

Commit

Permalink
Conditionally disable configuring SSHd
Browse files Browse the repository at this point in the history
This is particularly required, if another role is used to configure SSH
on the system.

Closes #4
  • Loading branch information
strebitz committed Sep 18, 2020
1 parent dd3bef6 commit ef74731
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ The following role variables are relevant:
* `skeleton`: An optional home skeleton directory (e.g: /dev/null). Default to system defaults.
* `home`: An optional home directory (e.g: /home/bob). Default to `sftp_home_partition/name`.
* `sftp_nologin_shell`: The "nologin" user shell. (defaults to /sbin/nologin.)
* `sftp_home_skeleton`: An optional home skeleton directory (e.g: /dev/null). Default to system defaults.
* `sftp_configure_sshd`: Boolean indicating if sshd configuration should be altered. Defaults to `true`.

Notes:

Expand Down
1 change: 1 addition & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ sftp_allow_passwords: False
sftp_enable_selinux_support: False
sftp_enable_logging: False
sftp_nologin_shell: /sbin/nologin
sftp_configure_sshd: true
2 changes: 2 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
line: "Subsystem sftp internal-sftp -f AUTH -l VERBOSE"
state: present
notify: SFTP-Server | Restart sshd
when: sftp_configure_sshd

- name: SFTP-Server | Ensure SELinux management package is present
package:
Expand Down Expand Up @@ -51,6 +52,7 @@
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
when: sftp_configure_sshd

- name: SFTP-Server | Create sftp user's group
group:
Expand Down

0 comments on commit ef74731

Please sign in to comment.