Skip to content

Commit

Permalink
Remove SELinux
Browse files Browse the repository at this point in the history
I think it would be best to decouple SELinux labels from this role. It's not an essential functionality and it should be managed separately with a "hardening" role, for example https://github.com/dev-sec/ansible-collection-hardening. This role is well-maintained and has a good track record.
  • Loading branch information
vladgh committed Jul 16, 2023
1 parent a089576 commit 7e86e97
Show file tree
Hide file tree
Showing 8 changed files with 6 additions and 41 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
An Ansible collection for setting up Samba as a file server. It is tested on Ubuntu, Debian, CentOS and Arch Linux. Specifically, the responsibilities of this collection are to:

- Install the necessary packages
- Configure SELinux settings (when SELinux is active)
- Create share directories
- Manage Samba users and passwords
- Manage access to shares
Expand Down Expand Up @@ -213,7 +212,7 @@ A complete overview of share options follows below. Only `name` is required, the
| `path` | `/{{samba_shares_root}}/{{name}}` | The path to the share directory. |
| `public` | `no` | Controls read access for guest users |
| `read_only` | - | If this parameter is yes, then users of a service may not create or modify files in the service's directory. |
| `setype` | `samba_share_t` | The SELinux type of the share directory |
| `setype` | - | The SELinux type of the share directory |
| `user` | - | The user files in the share will be added to. (force user) |
| `valid_users` | - | Controls read access for registered users. Use the syntax of the corresponding Samba setting. |
| `vfs_objects` | - | See the Samba documentation for details. |
Expand Down Expand Up @@ -269,7 +268,7 @@ The [test playbook](molecule/default/converge.yml) has some examples.

## Dependencies

- [Ansible Posix](https://docs.ansible.com/ansible/latest/collections/ansible/posix/)
N/A

## Testing

Expand Down
3 changes: 1 addition & 2 deletions galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ tags:
- samba
- system
- networking
dependencies:
ansible.posix: "*"
dependencies: {}
repository: https://github.com/vladgh/ansible-collection-vladgh-samba
documentation: https://github.com/vladgh/ansible-collection-vladgh-samba
homepage: https://github.com/vladgh/ansible-collection-vladgh-samba
Expand Down
1 change: 0 additions & 1 deletion molecule/default/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
public: 'yes'
write_list: +users
group: users
setype: public_content_t
browseable: 'yes'
- name: guestshare
comment: 'Share accessible for guests'
Expand Down
4 changes: 2 additions & 2 deletions roles/server/meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ galaxy_info:
- bullseye
- name: Fedora
versions:
- '37'
- '38'
- '37'
- name: EL
versions:
- '8'
- '9'
- '8'
- name: ArchLinux
versions:
- all
Expand Down
18 changes: 1 addition & 17 deletions roles/server/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,6 @@
changed_when: false
tags: samba

- name: Install SELinux package
ansible.builtin.package:
name: "{{ samba_selinux_packages }}"
state: present
when: ansible_selinux is defined and ansible_selinux.status == 'enabled'
tags: samba

- name: Make sure SELinux boolean settings are correct
ansible.posix.seboolean:
name: "{{ item }}"
state: true
persistent: true
loop: "{{ samba_selinux_booleans }}"
when: ansible_selinux is defined and ansible_selinux.status == 'enabled'
tags: samba

- name: Create Samba shares root directory
ansible.builtin.file:
state: directory
Expand All @@ -67,7 +51,7 @@
owner: "{{ item.owner | default('root') }}"
group: "{{ item.group | default('users') }}"
mode: "{{ item.directory_mode | default('0775') }}"
setype: "{{ item.setype | default('samba_share_t') }}"
setype: "{{ item.setype | default(omit) }}"
loop: "{{ samba_shares }}"
when: samba_shares is defined and samba_shares | length > 0
tags: samba
Expand Down
4 changes: 0 additions & 4 deletions roles/server/vars/os_Archlinux.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
---

samba_packages:
- samba
- smbclient

samba_vfs_packages: []

samba_selinux_packages: []
samba_selinux_booleans: []

samba_configuration_dir: /etc/samba
samba_configuration: "{{ samba_configuration_dir }}/smb.conf"
samba_username_map_file: "{{ samba_configuration_dir }}/smbusers"
Expand Down
4 changes: 0 additions & 4 deletions roles/server/vars/os_Debian.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
---

samba_packages:
- samba
- smbclient

samba_vfs_packages:
- samba-vfs-modules

samba_selinux_packages: []
samba_selinux_booleans: []

samba_configuration_dir: /etc/samba
samba_configuration: "{{ samba_configuration_dir }}/smb.conf"
samba_username_map_file: "{{ samba_configuration_dir }}/smbusers"
Expand Down
8 changes: 0 additions & 8 deletions roles/server/vars/os_RedHat.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
---

samba_packages:
- samba
- samba-client

samba_vfs_packages: []

samba_selinux_packages:
- python3-libsemanage

samba_selinux_booleans:
- samba_enable_home_dirs
- samba_export_all_rw

samba_configuration_dir: /etc/samba
samba_configuration: "{{ samba_configuration_dir }}/smb.conf"
samba_username_map_file: "{{ samba_configuration_dir }}/smbusers"
Expand Down

0 comments on commit 7e86e97

Please sign in to comment.