Compare commits

...

7 Commits

9 changed files with 416 additions and 114 deletions
+8
View File
@@ -463,6 +463,7 @@ samba_shares:
group_write_list: verwaltung
file_create_mask: '0660'
dir_create_mask: '2770'
vfs_object_virusfilter: true
vfs_object_recycle: true
recycle_path: '@Recycle.Bin'
user:
@@ -482,6 +483,7 @@ samba_shares:
group_write_list: ab
file_create_mask: '0660'
dir_create_mask: '2770'
vfs_object_virusfilter: true
vfs_object_recycle: true
recycle_path: '@Recycle.Bin'
user:
@@ -504,6 +506,7 @@ samba_shares:
group_write_list: scans
file_create_mask: '0660'
dir_create_mask: '2770'
vfs_object_virusfilter: true
vfs_object_recycle: true
recycle_path: '@Recycle.Bin'
user:
@@ -576,6 +579,7 @@ samba_shares:
group_write_list: scans
file_create_mask: '0660'
dir_create_mask: '2770'
vfs_object_virusfilter: true
vfs_object_recycle: true
recycle_path: '@Recycle.Bin'
user:
@@ -586,6 +590,7 @@ samba_shares:
group_write_list: scans
file_create_mask: '0660'
dir_create_mask: '2770'
vfs_object_virusfilter: true
vfs_object_recycle: true
recycle_path: '@Recycle.Bin'
user:
@@ -596,6 +601,7 @@ samba_shares:
group_write_list: scans
file_create_mask: '0660'
dir_create_mask: '2770'
vfs_object_virusfilter: true
vfs_object_recycle: true
recycle_path: '@Recycle.Bin'
user:
@@ -606,6 +612,7 @@ samba_shares:
group_write_list: intern
file_create_mask: '0660'
dir_create_mask: '2770'
vfs_object_virusfilter: true
vfs_object_recycle: false
recycle_path: '@Recycle.Bin'
user:
@@ -622,6 +629,7 @@ samba_shares:
group_write_list: intern
file_create_mask: '0660'
dir_create_mask: '2770'
vfs_object_virusfilter: true
vfs_object_recycle: false
recycle_path: '@Recycle.Bin'
user:
+9
View File
@@ -1747,6 +1747,12 @@ apt_install_client_samba:
- samba-client
- samba-common
apt_install_server_samba_virusfilter:
- clamav
- clamav-daemon
- clamav-freshclam
- samba-vfs-modules
# samba_workgroup
#
@@ -1770,6 +1776,9 @@ samba_server_min_protocol: {}
#
samba_allow_insecure_wide_links: !!str no
# include vfs object 'virusfilter' to (private) homes shares
samba_homes_virusfilter: false
samba_groups: []
# samba_user:
+10
View File
@@ -486,6 +486,7 @@ samba_shares:
group_write_list: team
file_create_mask: '0660'
dir_create_mask: '2770'
vfs_object_virusfilter: true
vfs_object_recycle: true
recycle_path: '@Recycle.Bin'
@@ -495,6 +496,7 @@ samba_shares:
group_write_list: esf-bleibnet
file_create_mask: '0660'
dir_create_mask: '2770'
vfs_object_virusfilter: true
vfs_object_recycle: true
recycle_path: '@Recycle.Bin'
@@ -504,6 +506,7 @@ samba_shares:
group_write_list: amif
file_create_mask: '0660'
dir_create_mask: '2770'
vfs_object_virusfilter: true
vfs_object_recycle: true
recycle_path: '@Recycle.Bin'
@@ -513,6 +516,7 @@ samba_shares:
group_write_list: quali
file_create_mask: '0660'
dir_create_mask: '2770'
vfs_object_virusfilter: true
vfs_object_recycle: true
recycle_path: '@Recycle.Bin'
@@ -522,6 +526,7 @@ samba_shares:
group_write_list: aktion-mensch
file_create_mask: '0660'
dir_create_mask: '2770'
vfs_object_virusfilter: true
vfs_object_recycle: true
recycle_path: '@Recycle.Bin'
@@ -531,6 +536,7 @@ samba_shares:
group_write_list: foerderung
file_create_mask: '0660'
dir_create_mask: '2770'
vfs_object_virusfilter: true
vfs_object_recycle: true
recycle_path: '@Recycle.Bin'
@@ -540,6 +546,7 @@ samba_shares:
group_write_list: buchhaltung
file_create_mask: '0660'
dir_create_mask: '2770'
vfs_object_virusfilter: true
vfs_object_recycle: true
recycle_path: '@Recycle.Bin'
@@ -549,6 +556,7 @@ samba_shares:
group_write_list: verwaltung
file_create_mask: '0660'
dir_create_mask: '2770'
vfs_object_virusfilter: true
vfs_object_recycle: true
recycle_path: '@Recycle.Bin'
@@ -558,6 +566,7 @@ samba_shares:
group_write_list: infrastruktur
file_create_mask: '0660'
dir_create_mask: '2770'
vfs_object_virusfilter: true
vfs_object_recycle: true
recycle_path: '@Recycle.Bin'
@@ -568,6 +577,7 @@ samba_shares:
file_create_mask: '0660'
dir_create_mask: '2770'
#wide_links: !!str yes
vfs_object_virusfilter: true
vfs_object_recycle: true
recycle_path: '@Recycle.Bin'
+23
View File
@@ -1001,6 +1001,7 @@ samba_shares:
group_write_list: all-users
file_create_mask: '0660'
dir_create_mask: '2770'
vfs_object_virusfilter: true
vfs_object_recycle: true
recycle_path: '@Recycle.Bin'
@@ -1010,6 +1011,7 @@ samba_shares:
group_write_list: mbr-admins
file_create_mask: '0660'
dir_create_mask: '2770'
vfs_object_virusfilter: true
- name: Kamera
path: /data/shares/Kamera
@@ -1024,6 +1026,7 @@ samba_shares:
group_write_list: buero-scan
file_create_mask: '0660'
dir_create_mask: '2770'
vfs_object_virusfilter: true
vfs_object_recycle: true
#recycle_path: '@Recycle.Bin'
@@ -1033,6 +1036,7 @@ samba_shares:
group_write_list: technik
file_create_mask: '0660'
dir_create_mask: '2770'
vfs_object_virusfilter: true
vfs_object_recycle: true
recycle_path: '@Recycle.Bin'
@@ -1042,6 +1046,7 @@ samba_shares:
group_write_list: ag-antisem
file_create_mask: '0660'
dir_create_mask: '2770'
vfs_object_virusfilter: true
vfs_object_recycle: true
recycle_path: '@Recycle.Bin'
@@ -1055,6 +1060,7 @@ samba_shares:
group_write_list: vdk
file_create_mask: '0660'
dir_create_mask: '2770'
vfs_object_virusfilter: true
vfs_object_recycle: true
recycle_path: '@Recycle.Bin'
@@ -1064,6 +1070,7 @@ samba_shares:
group_write_list: vdk
file_create_mask: '0660'
dir_create_mask: '2770'
vfs_object_virusfilter: true
vfs_object_recycle: true
recycle_path: '@Recycle.Bin'
@@ -1073,6 +1080,7 @@ samba_shares:
group_write_list: vdk
file_create_mask: '0660'
dir_create_mask: '2770'
vfs_object_virusfilter: true
vfs_object_recycle: true
recycle_path: '@Recycle.Bin'
@@ -1095,6 +1103,7 @@ samba_shares:
group_write_list: bgn-finanzen-personal
file_create_mask: '0660'
dir_create_mask: '2770'
vfs_object_virusfilter: true
vfs_object_recycle: true
recycle_path: '@Recycle.Bin'
@@ -1104,6 +1113,7 @@ samba_shares:
group_write_list: bgn
file_create_mask: '0660'
dir_create_mask: '2770'
vfs_object_virusfilter: true
vfs_object_recycle: true
recycle_path: '@Recycle.Bin'
@@ -1117,6 +1127,7 @@ samba_shares:
group_write_list: bmb
file_create_mask: '0660'
dir_create_mask: '2770'
vfs_object_virusfilter: true
vfs_object_recycle: true
recycle_path: '@Recycle.Bin'
@@ -1130,6 +1141,7 @@ samba_shares:
group_write_list: mbr-finanzen-personal
file_create_mask: '0660'
dir_create_mask: '2770'
vfs_object_virusfilter: true
vfs_object_recycle: true
recycle_path: '@Recycle.Bin'
@@ -1139,6 +1151,7 @@ samba_shares:
group_write_list: mbr-buero
file_create_mask: '0660'
dir_create_mask: '2770'
vfs_object_virusfilter: true
vfs_object_recycle: true
recycle_path: '@Recycle.Bin'
@@ -1148,6 +1161,7 @@ samba_shares:
group_write_list: mbr-buero
file_create_mask: '0660'
dir_create_mask: '2770'
vfs_object_virusfilter: true
vfs_object_recycle: true
recycle_path: '@Recycle.Bin'
@@ -1157,6 +1171,7 @@ samba_shares:
group_write_list: mbr-buero
file_create_mask: '0660'
dir_create_mask: '2770'
vfs_object_virusfilter: true
vfs_object_recycle: true
recycle_path: '@Recycle.Bin'
@@ -1170,6 +1185,7 @@ samba_shares:
group_write_list: rias-berlin
file_create_mask: '0660'
dir_create_mask: '2770'
vfs_object_virusfilter: true
vfs_object_recycle: true
recycle_path: '@Recycle.Bin'
@@ -1179,6 +1195,7 @@ samba_shares:
group_write_list: rias-berlin-finanzen-personal
file_create_mask: '0660'
dir_create_mask: '2770'
vfs_object_virusfilter: true
vfs_object_recycle: true
recycle_path: '@Recycle.Bin'
@@ -1188,6 +1205,7 @@ samba_shares:
group_write_list: rias-bund
file_create_mask: '0660'
dir_create_mask: '2770'
vfs_object_virusfilter: true
vfs_object_recycle: true
recycle_path: '@Recycle.Bin'
@@ -1197,6 +1215,7 @@ samba_shares:
group_write_list: rias-bund-finanzen-personal
file_create_mask: '0660'
dir_create_mask: '2770'
vfs_object_virusfilter: true
vfs_object_recycle: true
recycle_path: '@Recycle.Bin'
@@ -1210,6 +1229,7 @@ samba_shares:
group_write_list: regishut
file_create_mask: '0660'
dir_create_mask: '2770'
vfs_object_virusfilter: true
vfs_object_recycle: true
recycle_path: '@Recycle.Bin'
@@ -1219,6 +1239,7 @@ samba_shares:
group_write_list: regishut-personal-finanzen
file_create_mask: '0660'
dir_create_mask: '2770'
vfs_object_virusfilter: true
vfs_object_recycle: true
recycle_path: '@Recycle.Bin'
@@ -1232,6 +1253,7 @@ samba_shares:
group_write_list: direx
file_create_mask: '0660'
dir_create_mask: '2770'
vfs_object_virusfilter: true
vfs_object_recycle: true
recycle_path: '@Recycle.Bin'
@@ -1241,6 +1263,7 @@ samba_shares:
group_write_list: direx-personal-finanzen
file_create_mask: '0660'
dir_create_mask: '2770'
vfs_object_virusfilter: true
vfs_object_recycle: true
recycle_path: '@Recycle.Bin'
+3 -47
View File
@@ -480,33 +480,9 @@ samba_shares:
group_write_list: buero
file_create_mask: '0660'
dir_create_mask: '2770'
vfs_object_virusfilter: true
vfs_object_recycle: true
recycle_path: '@Recycle.Bin'
user:
- anahit
- andrea
- bueropraktikum
- chema
- chris
- isadora
- jessica
- konstantin
- lara
- lena
- linda
- margit
- matija
- musa
- praktikant1
- praktikant2
- praktikant3
- praktikant4
- praktikant5
- praktikant6
- saravic
- sysadm
- simone
- yang
- name: Verwaltung
path: /data/samba/verwaltung
@@ -514,26 +490,9 @@ samba_shares:
group_write_list: intern
file_create_mask: '0660'
dir_create_mask: '2770'
vfs_object_virusfilter: true
vfs_object_recycle: true
recycle_path: '@Recycle.Bin'
user:
- anahit
- andrea
- bueropraktikum
- chema
- chris
- isadora
- jessica
- konstantin
- lara
- linda
- margit
- matija
- musa
- saravic
- sysadm
- simone
- yang
- name: Multimedia
path: /data/samba/no-backup-share/multimedia
@@ -541,12 +500,9 @@ samba_shares:
group_write_list: no-backup
file_create_mask: '0660'
dir_create_mask: '2770'
vfs_object_virusfilter: true
vfs_object_recycle: true
recycle_path: '@Recycle.Bin'
user:
- chris
- margit
- musa
# ==========
+8
View File
@@ -109,3 +109,11 @@
service:
name: nfs-kernel-server
state: restarted
- name: Reload AppArmor profile clamd
command: apparmor_parser -r /etc/apparmor.d/usr.sbin.clamd
- name: Restart clamav-daemon
service:
name: clamav-daemon
state: restarted
+230 -37
View File
@@ -1,33 +1,234 @@
---
# ---
# Samba Server
# ---
- name: (samba-install.yml) Ensure samba packages server (buster) are installed.
package:
pkg: '{{ apt_install_server_samba }}'
pkg: "{{ apt_install_server_samba }}"
state: present
when:
- "groups['samba_server']|string is search(inventory_hostname)"
- inventory_hostname in groups['samba_server']
tags:
- samba-server
- name: (samba-install.yml) Ensure quarantine directory exists
file:
path: /data/samba/QUARANTINE
owner: root
group: root
mode: "0750"
state: directory
when:
- inventory_hostname in groups['samba_server']
- samba_shares | selectattr('vfs_object_virusfilter', 'defined') |
selectattr('vfs_object_virusfilter', 'equalto', true) | list | length > 0
tags:
- samba-server
- samba-virusfilter
- name: (samba-install.yml) Ensure samba share directories exists
file:
path: "{{ item.path }}"
owner: "root"
group: "{{ item.group_write_list }}"
mode: '2770'
mode: "{{ item.dir_create_mask | default('2770', true) }}"
state: directory
recurse: no
with_items: "{{ samba_shares }}"
loop_control:
label: '{{ item.name }}'
label: "{{ item.name }}"
when:
- "groups['samba_server']|string is search(inventory_hostname)"
- inventory_hostname in groups['samba_server']
tags:
- samba-shares
# ---
# Virusfilter (ClamAV) - only when at least one share has vfs_object_virusfilter: true
# ---
- name: (samba-install.yml) Ensure virusfilter (ClamAV) packages are installed
package:
pkg: "{{ apt_install_server_samba_virusfilter }}"
state: present
when:
- inventory_hostname in groups['samba_server']
- samba_shares | selectattr('vfs_object_virusfilter', 'defined') |
selectattr('vfs_object_virusfilter', 'equalto', true) | list | length > 0
tags:
- samba-server
- samba-virusfilter
- name: (samba-config-server.yml) Check if ClamAV virus databases are present
find:
paths: /var/lib/clamav
patterns:
- "*.cvd"
- "*.cld"
register: clamav_db_files
when:
- inventory_hostname in groups['samba_server']
- samba_shares | selectattr('vfs_object_virusfilter', 'defined') | selectattr('vfs_object_virusfilter', 'equalto', true) | list | length > 0
tags:
- samba-server
- samba-virusfilter
- name: (samba-config-server.yml) Stop clamav-freshclam service before initial database download
service:
name: clamav-freshclam
state: stopped
failed_when: false
when:
- inventory_hostname in groups['samba_server']
- samba_shares | selectattr('vfs_object_virusfilter', 'defined') | selectattr('vfs_object_virusfilter', 'equalto', true) | list | length > 0
- clamav_db_files.files | length == 0
tags:
- samba-server
- samba-virusfilter
- name: (samba-config-server.yml) Ensure clamav-daemon service is started before database update
service:
name: clamav-daemon
state: started
enabled: yes
failed_when: false
when:
- inventory_hostname in groups['samba_server']
- samba_shares | selectattr('vfs_object_virusfilter', 'defined') | selectattr('vfs_object_virusfilter', 'equalto', true) | list | length > 0
tags:
- samba-server
- samba-virusfilter
- name: (samba-config-server.yml) Download initial ClamAV virus databases via freshclam
command: freshclam
when:
- inventory_hostname in groups['samba_server']
- samba_shares | selectattr('vfs_object_virusfilter', 'defined') | selectattr('vfs_object_virusfilter', 'equalto', true) | list | length > 0
- clamav_db_files.files | length == 0
tags:
- samba-server
- samba-virusfilter
- name: (samba-config-server.yml) Ensure clamav-daemon service is enabled and started
service:
name: clamav-daemon
state: started
enabled: yes
when:
- inventory_hostname in groups['samba_server']
- samba_shares | selectattr('vfs_object_virusfilter', 'defined') | selectattr('vfs_object_virusfilter', 'equalto', true) | list | length > 0
tags:
- samba-server
- samba-virusfilter
- name: (samba-config-server.yml) Ensure clamav-freshclam service is enabled and started
service:
name: clamav-freshclam
state: started
enabled: yes
when:
- inventory_hostname in groups['samba_server']
- samba_shares | selectattr('vfs_object_virusfilter', 'defined') | selectattr('vfs_object_virusfilter', 'equalto', true) | list | length > 0
tags:
- samba-server
- samba-virusfilter
- name: (samba-install.yml) Ensure clamav user is member of all NIS groups
user:
name: clamav
groups: "{{ item.name }}"
append: yes
loop: "{{ nis_groups }}"
loop_control:
label: "{{ item.name }}"
when:
- inventory_hostname in groups['samba_server']
- samba_shares | selectattr('vfs_object_virusfilter', 'defined') |
selectattr('vfs_object_virusfilter', 'equalto', true) | list | length > 0
- nis_groups | length > 0
tags:
- samba-server
- samba-virusfilter
- name: (samba-config-server.yml) Ensure clamav user is member of all NIS user groups (homes virusfilter)
user:
name: clamav
groups: "{{ item.name }}"
append: yes
loop: "{{ nis_user }}"
loop_control:
label: "{{ item.name }}"
when:
- inventory_hostname in groups['samba_server']
- samba_homes_virusfilter | default(false) | bool
- nis_user | length > 0
tags:
- samba-server
- samba-virusfilter
- name: (samba-config-server.yml) Get home directories of samba users (NIS users) via getent (homes virusfilter)
ansible.builtin.getent:
database: passwd
key: "{{ item.name }}"
loop: "{{ nis_user }}"
loop_control:
label: "{{ item.name }}"
register: samba_user_getent
when:
- inventory_hostname in groups['samba_server']
- samba_homes_virusfilter | default(false) | bool
- nis_user | length > 0
tags:
- samba-server
- samba-virusfilter
- name: (samba-config-server.yml) Ensure home directories are group-traversable for clamd (homes virusfilter)
file:
path: "{{ item.ansible_facts.getent_passwd[item.item.name][4] }}"
mode: "0750"
state: directory
loop: "{{ samba_user_getent.results | default([]) }}"
loop_control:
label: "{{ item.item.name }}"
when:
- inventory_hostname in groups['samba_server']
- samba_homes_virusfilter | default(false) | bool
- item.ansible_facts is defined
tags:
- samba-server
- samba-virusfilter
- name: (samba-config-server.yml) Configure AppArmor local profile for clamd (data paths)
template:
src: etc/apparmor.d/local/usr.sbin.clamd.j2
dest: /etc/apparmor.d/local/usr.sbin.clamd
owner: root
group: root
mode: "0644"
notify: Reload AppArmor profile clamd
when:
- inventory_hostname in groups['samba_server']
- samba_shares | selectattr('vfs_object_virusfilter', 'defined') |
selectattr('vfs_object_virusfilter', 'equalto', true) | list | length > 0
tags:
- samba-server
- samba-virusfilter
- name: (samba-config-server.yml) Ensure AllowAllMatchScan is enabled in clamd.conf
lineinfile:
path: /etc/clamav/clamd.conf
regexp: "^#?\\s*AllowAllMatchScan\\s"
line: "AllowAllMatchScan true"
state: present
notify: Restart clamav-daemon
when:
- inventory_hostname in groups['samba_server']
- samba_shares | selectattr('vfs_object_virusfilter', 'defined') |
selectattr('vfs_object_virusfilter', 'equalto', true) | list | length > 0
tags:
- samba-server
- samba-virusfilter
# ---
# /etc/samba/smb.conf
@@ -38,51 +239,48 @@
path: /etc/samba/smb.conf.ORIG
register: smb_conf_exists
when:
- "groups['samba_server']|string is search(inventory_hostname)"
- inventory_hostname in groups['samba_server']
tags:
- samba-server
- name: (samba-install.yml) Backup existing file /etc/samba/smb.conf
command: cp -a /etc/samba/smb.conf /etc/samba/smb.conf.ORIG
when:
- "groups['samba_server']|string is search(inventory_hostname)"
- inventory_hostname in groups['samba_server']
- smb_conf_exists.stat.exists == False
tags:
- samba-server
- name: (samba-install.yml) /etc/samba/smb.conf
template:
dest: /etc/samba/smb.conf
src: etc/samba/smb.conf.j2
owner: root
group: root
mode: 0644
mode: 644
when:
- "groups['samba_server']|string is search(inventory_hostname)"
- inventory_hostname in groups['samba_server']
notify:
- Restart smbd
- Restart nmbd
tags:
- samba-server
- name: (samba-install.yml) Ensure file /etc/samba/users.map exists
copy:
src: "{{ role_path + '/files/etc/samba/users.map' }}"
dest: /etc/samba/users.map
owner: root
group: root
mode: 0644
mode: 644
when:
- "groups['samba_server']|string is search(inventory_hostname)"
- inventory_hostname in groups['samba_server']
notify:
- Restart smbd
- Restart nmbd
tags:
- samba-server
# ---
# Cronjob for cleaning up samba trash dirs
# ---
@@ -92,34 +290,34 @@
path: /root/bin/samba/clean_samba_trash.sh
register: clean_samba_trash_exists
when:
- "groups['samba_server']|string is search(inventory_hostname)"
- inventory_hostname in groups['samba_server']
tags:
- samba-server
- samba-cron
- name: (samba-install.yml) Adjust configuration for script 'clean_samba_trash.sh'
template:
template:
dest: /root/bin/samba/conf/clean_samba_trash.conf
src: root/bin/samba/conf/clean_samba_trash.conf.j2
when:
- "groups['samba_server']|string is search(inventory_hostname)"
- inventory_hostname in groups['samba_server']
- clean_samba_trash_exists.stat.exists|bool
tags:
- samba-server
- samba-cron
- name: (samba-config-server.yml) Check if cleaning up trash dirs is configured
ansible.builtin.lineinfile:
path: /root/bin/samba/conf/clean_samba_trash.conf
regexp: '^trash_dirs=*'
regexp: "^trash_dirs=*"
state: absent
check_mode: true
changed_when: false
register: clean_samba_trash_dirs
when:
when:
- inventory_hostname in groups['samba_server']
tags: [samba-server, samba-cron]
tags: [ samba-server, samba-cron ]
- name: (samba-config-server.yml) Creates a cron job for cleaning up samba trash dirs
ansible.builtin.cron:
name: "{{ samba_cronjob_trash_dirs.name }}"
@@ -134,8 +332,7 @@
- inventory_hostname in groups['samba_server']
- clean_samba_trash_exists.stat.exists | bool
- (clean_samba_trash_dirs.found | int) > 0
tags: [samba-server, samba-cron]
tags: [ samba-server, samba-cron ]
# ---
# Cronjob for setting permissions on samba shares
@@ -147,8 +344,7 @@
register: set_permissions_on_samba_shares_exists
when:
- inventory_hostname in groups['samba_server']
tags: [samba-server, samba-cron]
tags: [ samba-server, samba-cron ]
- name: (samba-config-server.yml) Adjust configuration for script 'set_permissions_samba_shares.sh'
ansible.builtin.template:
@@ -157,9 +353,8 @@
when:
- inventory_hostname in groups['samba_server']
- set_permissions_on_samba_shares_exists.stat.exists | bool
tags: [samba-server, samba-cron]
tags: [ samba-server, samba-cron ]
- name: (samba-config-server.yml) Creates a cron job for setting permissions to samba dirs
ansible.builtin.cron:
name: "{{ samba_cronjob_permissions.name }}"
@@ -172,9 +367,8 @@
job: "{{ samba_cronjob_permissions.job }}"
when:
- inventory_hostname in groups['samba_server']
- (clean_samba_trash_dirs.found | int) > 0 # << int -> bool
tags: [samba-server, samba-cron]
- (clean_samba_trash_dirs.found | int) > 0 # << int -> bool
tags: [ samba-server, samba-cron ]
# ---
# Samba clients
@@ -184,9 +378,8 @@
package:
pkg: "{{ apt_install_client_samba }}"
state: present
when:
- "groups['nis_client']|string is search(inventory_hostname)"
when:
- inventory_hostname in groups['nis_client']
- ansible_distribution == "Ubuntu"
tags:
- samba-client
@@ -0,0 +1,11 @@
# {{ ansible_managed }}
# see: roles/common/tasks/samba-config-server.yml
/data/** r,
/data/samba/QUARANTINE/** rw,
{% if samba_homes_virusfilter | default(false) | bool %}
{{ nis_base_home }}/** r,
{% if nis_base_home != '/home' %}
/home/** r,
{% endif %}
{% endif %}
+114 -30
View File
@@ -6,7 +6,7 @@
#
# This is the main Samba configuration file. You should read the
# smb.conf(5) manual page in order to understand the options listed
# here. Samba has a huge number of configurable options most of which
# here. Samba has a huge number of configurable options most of which
# are not shown in this example
#
# Some options that are often worth tuning have been included as
@@ -18,8 +18,8 @@
# enough to be mentioned here
#
# NOTE: Whenever you modify this file you should run the command
# "testparm" to check that you have not made any basic syntactic
# errors.
# "testparm" to check that you have not made any basic syntactic
# errors.
#======================= Global Settings =======================
@@ -31,11 +31,11 @@
; workgroup = WORKGROUP
workgroup = {{ samba_workgroup|default('WORKGROUP') }}
# Option 'netbios name' added to debian's default smb.conf
# Option 'netbios name' added to debian's default smb.conf
#
# This sets the NetBIOS name by which a Samba server is known. By default it
# is the same as the first component of the host's DNS name. If a machine is
# a browse server or logon server this name (or the first component of the
# a browse server or logon server this name (or the first component of the
# hosts DNS name) will be the name that these services are advertised under.
#
# Note that the maximum length for a NetBIOS name is 15 characters.
@@ -46,9 +46,9 @@
{% if samba_server_min_protocol is defined and samba_server_min_protocol|length > 0 %}
# This setting controls the minimum protocol version that the server will allow
# the client to use. Normally this option should not be set as the automatic
# negotiation phase in the SMB protocol takes care of choosing the appropriate
# This setting controls the minimum protocol version that the server will allow
# the client to use. Normally this option should not be set as the automatic
# negotiation phase in the SMB protocol takes care of choosing the appropriate
# protocol unless you have legacy clients which are SMB1 capable only.
#
# See Related command: server max protocol for a full list of available protocols.
@@ -69,7 +69,7 @@
; interfaces = 127.0.0.0/8 eth0
interfaces = {{ samba_server_ip }}/{{ samba_server_cidr_prefix }} 127.0.0.1/8
# Option 'hosts deny' and 'hosts allow' added to debian's default smb.conf
# Option 'hosts deny' and 'hosts allow' added to debian's default smb.conf
hosts deny = 0.0.0.0/0
hosts allow = 192.168.0.0/16 10.0.0.0/8 127.0.0.0/8
@@ -80,8 +80,8 @@
# option cannot handle dynamic or non-broadcast interfaces correctly.
#
# Notice:
# If bind interfaces only is set and the network address 127.0.0.1 is not added to the
# interfaces parameter list smbpasswd(8) may not work as expected due to the reasons
# If bind interfaces only is set and the network address 127.0.0.1 is not added to the
# interfaces parameter list smbpasswd(8) may not work as expected due to the reasons
# covered below.
#
# Default: bind interfaces only = no
@@ -92,7 +92,7 @@
# This tells Samba to use a separate log file for each machine
# that connects
; log file = /var/log/samba/log.%m
log file = /var/log/samba/log.%m
log file = /var/log/samba/%I.log
# Cap the size of the individual log files (in KiB).
@@ -103,13 +103,13 @@
# Append syslog@1 if you want important messages to be sent to syslog too.
logging = file
# Option 'log level' added to debian's default smb.conf
# Option 'log level' added to debian's default smb.conf
#
# The value of the parameter (a astring) allows the debug level (logging level) to be
# The value of the parameter (a astring) allows the debug level (logging level) to be
# specified in the smb.conf file.
#
# This parameter has been extended since the 2.2.x series, now it allows one to specify
# the debug level for multiple debug classes. This is to give greater flexibility in
# This parameter has been extended since the 2.2.x series, now it allows one to specify
# the debug level for multiple debug classes. This is to give greater flexibility in
# the configuration of the system.
#
# See manpage for implemented debug classes
@@ -125,7 +125,7 @@
####### Authentication #######
# Option 'ntlm auth' added to debian's default smb.conf
# Option 'ntlm auth' added to debian's default smb.conf
#
# This parameter determines whether or not smbd(8) will attempt to authenticate
# users using the NTLM encrypted password response for this local passdb (SAM
@@ -167,7 +167,7 @@
# Server role. Defines in which mode Samba will operate. Possible
# values are "standalone server", "member server", "classic primary
# domain controller", "classic backup domain controller", "active
# directory domain controller".
# directory domain controller".
#
# Most people will want "standalone server" or "member server".
# Running as "active directory domain controller" will require first
@@ -197,7 +197,7 @@
# to anonymous connections
map to guest = bad user
# Option 'username map' added to debian's default smb.conf
# Option 'username map' added to debian's default smb.conf
#
username map = /etc/samba/users.map
@@ -206,7 +206,7 @@
#
# The following settings only takes effect if 'server role = primary
# classic domain controller', 'server role = backup domain controller'
# or 'domain logons' is set
# or 'domain logons' is set
#
# It specifies the location of the user's
@@ -235,13 +235,13 @@
# password; please adapt to your needs
; add user script = /usr/sbin/adduser --quiet --disabled-password --gecos "" %u
# This allows machine accounts to be created on the domain controller via the
# SAMR RPC pipe.
# This allows machine accounts to be created on the domain controller via the
# SAMR RPC pipe.
# The following assumes a "machines" group exists on the system
; add machine script = /usr/sbin/useradd -g machines -c "%u machine account" -d /var/lib/samba -s /bin/false %u
# This allows Unix groups to be created on the domain controller via the SAMR
# RPC pipe.
# RPC pipe.
; add group script = /usr/sbin/addgroup --force-badname %g
############ Misc ############
@@ -305,6 +305,14 @@
# next parameter to 'no' if you want to be able to write to them.
read only = no
{% if samba_homes_virusfilter | default(false) | bool %}
# Virusfilter aktiv: Gruppe benötigt Leserecht, damit clamd (als Gruppenmitglied)
# Dateien und Verzeichnisse direkt öffnen kann (SCAN-Kommando an clamd).
create mask = 0640
force create mode = 0040
directory mask = 0750
force directory mode = 0050
{% else %}
# File creation mask is set to 0700 for security reasons. If you want to
# create files with group=rw permissions, set next parameter to 0775.
create mask = 0700
@@ -312,6 +320,7 @@
# Directory creation mask is set to 0700 for security reasons. If you want to
# create dirs. with group=rw permissions, set next parameter to 0775.
directory mask = 0700
{% endif %}
# By default, \\server\username shares can be connected to by anyone
# with access to the samba server.
@@ -319,6 +328,35 @@
# to \\server\username
# This might need tweaking when using external authentication schemes
valid users = %S
{% if samba_homes_virusfilter | default(false) | bool %}
# --- Virusfilter-Einstellungen [homes] ---
vfs objects = virusfilter
virusfilter:scanner = clamav
virusfilter:socket path = /var/run/clamav/clamd.ctl
virusfilter:infected file action = delete
virusfilter:cache entry limit = 1000
virusfilter:cache time limit = 60
virusfilter:max file size = 26214400
virusfilter:min file size = 10
virusfilter:scan on open = yes
virusfilter:scan on close = yes
# Fehlercode bei infizierter Datei (beim Öffnen)
virusfilter:infected file errno on open = EACCES
# Fehlercode beim Schließen
virusfilter:infected file errno on close = EACCES
virusfilter:connect timeout = 30000
virusfilter:io timeout = 60000
{% endif %}
# Un-comment the following and create the netlogon directory for Domain Logons
# (you need to configure Samba to act as a domain controller too.)
@@ -412,10 +450,19 @@
#
wide links = yes
{% endif %}
{%- set vfs_objects_parts = [] %}
{% if item.vfs_object_recycle is defined and item.vfs_object_recycle|bool and item.recycle_path is defined and item.recycle_path|length > 0 %}
{%- set _ = vfs_objects_parts.append('recycle') %}
{% endif %}
{% if item.vfs_object_virusfilter is defined and item.vfs_object_virusfilter|bool %}
{%- set _ = vfs_objects_parts.append('virusfilter') %}
{% endif %}
{% if vfs_objects_parts | length > 0 %}
vfs objects = {{ vfs_objects_parts | join(' ') }}
{% endif %}
{% if item.vfs_object_recycle is defined and item.vfs_object_recycle|bool %}
{% if item.recycle_path is defined and item.recycle_path|length > 0 %}
vfs objects = recycle
recycle:keeptree = yes
# touch access time from this file
# note: this is not the modified time, which is
@@ -438,8 +485,8 @@
recycle:excludedir = /tmp,/temp,/cache,.Trash
recycle:repository = {{ item.recycle_path | default('@Recycle.Bin') }}
# - This is a list of files and directories that are neither visible nor accessible.
# - Each entry in the list must be separated by a '/', which allows spaces to be
# - This is a list of files and directories that are neither visible nor accessible.
# - Each entry in the list must be separated by a '/', which allows spaces to be
# - included in the entry. '*' and '?' can be used to specify multiple files or
# - directories as in DOS wildcards.
# -
@@ -449,11 +496,48 @@
veto files = /{{ item.recycle_path | default('@Recycle.Bin') }}/.DS_Store/
{% endif %}
delete veto files = yes
{% else %}
{% endif %}
{% else %}
{% endif %}
{% if item.vfs_object_virusfilter is defined and item.vfs_object_virusfilter|bool %}
# --- Virusfilter-Einstellungen ---
# Scanner auswählen
virusfilter:scanner = clamav
# Socket-Pfad (Debian-Standard)
virusfilter:socket path = /var/run/clamav/clamd.ctl
# Verhalten bei Fund
virusfilter:infected file action = quarantine
virusfilter:quarantine directory = /data/samba/QUARANTINE
# Performance-Tuning: Ergebnis-Cache
#virusfilter:cache entry limit = 500
#virusfilter:cache time limit = 30
# Cache großzügig einstellen
virusfilter:cache entry limit = 1000
virusfilter:cache time limit = 60
# Dateigröße: Was wird gescannt?
#virusfilter:max file size = 52428800 # 50 MB max
virusfilter:max file size = 26214400 # 25 MB max
virusfilter:min file size = 10 # unter 10 Byte ignorieren
# Scan-Zeitpunkt: nur beim Öffnen, nicht beim Schließen
virusfilter:scan on open = yes
virusfilter:scan on close = yes
# Fehlercode bei infizierter Datei (beim Öffnen)
virusfilter:infected file errno on open = EACCES
# Fehlercode beim Schließen
virusfilter:infected file errno on close = EACCES
# Timeouts (Millisekunden)
virusfilter:connect timeout = 30000
virusfilter:io timeout = 60000
{% endif %}
{% endfor %}