Skip to content

Commit

Permalink
Merge pull request #25 from flatrocks/nologin_shell_default
Browse files Browse the repository at this point in the history
Extracted user 'nologin' shell path as variable
  • Loading branch information
Johan Meiring authored Dec 9, 2017
2 parents 014f569 + 1b9a2cf commit 833e3e0
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ The following role variables are relevant:
* `authorized`: An optional list of files placed in `files/` which contain valid public keys for the SFTP user.
* `sftp_directories`: A list of directories that need to be individually created for an SFTP user. Defaults to a blank list (i.e. "[]").
* `append`: Boolean to add `sftp_group_name` to the user groups (if any) instead of setting it (default to `False`).
* `sftp_nologin_shell`: The "nologin" user shell. (defaults to /sbin/nologin.)

Notes:
* The `sftp_nologin_shell` setting defines the shell assigned to sftp_users when the sftp user's shell is set to False. (The nologin shell ensures the user may only use SFTP and have no other login permissions.) This value may vary depending on the operating system version.


## Example Playbook
Expand Down
1 change: 1 addition & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ sftp_directories: []
sftp_allow_passwords: False
sftp_enable_selinux_support: False
sftp_enable_logging: False
sftp_nologin_shell: /sbin/nologin
2 changes: 1 addition & 1 deletion tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
append: "{{ item.append | default(False) }}"
home: "{{ sftp_home_partition }}/{{ item.name }}"
# `None` means default value -> default is to have a shell
shell: "{{ None if (item.shell | default(True)) else '/sbin/nologin' }}"
shell: "{{ None if (item.shell | default(True)) else sftp_nologin_shell }}"
state: present
with_items: "{{ sftp_users }}"

Expand Down
1 change: 1 addition & 0 deletions tests/Dockerfile.centos-6.ansible-2.2.2.0
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ RUN yum install -y openssh-server epel-release libffi-devel gcc
# Install Ansible
RUN yum install -y python-pip python-devel openssl-devel
#software-properties-common git python-dev libffi-dev libssl-dev
RUN pip install --upgrade pip
RUN pip install -U setuptools
RUN pip install 'ansible==2.2.2.0'

Expand Down
1 change: 1 addition & 0 deletions tests/Dockerfile.centos-6.ansible-2.3.0.0
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ RUN yum install -y openssh-server epel-release libffi-devel gcc
# Install Ansible
RUN yum install -y python-pip python-devel openssl-devel
#software-properties-common git python-dev libffi-dev libssl-dev
RUN pip install --upgrade pip
RUN pip install -U setuptools
RUN pip install 'ansible==2.3.0.0'

Expand Down

0 comments on commit 833e3e0

Please sign in to comment.