Explicitly create clamav socket directory

While most our supported distributions does create LocalSocket on their
own, it's not always the case and shouldn't be trusted that much.

Change-Id: I56851f56aa85108a4898ef99c48ac77c898ccb69
Closes-Bug: #1944564
This commit is contained in:
Dmitriy Rabotyagov 2021-10-20 15:27:21 +03:00
parent 9b3ea39df4
commit 9d6a927d8c
3 changed files with 31 additions and 1 deletions

View File

@ -159,7 +159,7 @@
lineinfile:
dest: /etc/clamd.d/scan.conf
regexp: "^(#)?LocalSocket (.*)$"
line: 'LocalSocket \2'
line: "LocalSocket {{ clamav_service_details['socket_path'] }}"
backrefs: yes
when:
- clamav_install_check.stat.exists
@ -171,6 +171,22 @@
- misc
- V-72213
- name: Ensure ClamAV socket directory exists
file:
path: "{{ clamav_service_details['socket_path'] | dirname }}"
user: "{{ clamav_service_details['user'] }}"
group: "{{ clamav_service_details['group'] }}"
mode: "{{ clamav_service_details['mode'] }}"
when:
- clamav_install_check.stat.exists
- security_enable_virus_scanner | bool
- ansible_facts['os_family'] | lower == 'redhat'
notify:
- restart clamav
tags:
- misc
- V-72213
- name: Allow automatic freshclam updates
lineinfile:
dest: /etc/sysconfig/freshclam

View File

@ -40,6 +40,13 @@ ssh_service: sshd
chrony_service: chronyd
clamav_service: 'clamd@scan'
# Clamav paparms
clamav_service_details:
user: clamscan
group: virusgroup
socket_path: /run/clamd.scan/clamd.sock
mode: 0710
# Commands
grub_update_cmd: "/usr/sbin/grub2-mkconfig -o {{ grub_config_file_boot }}"
ssh_keysign_path: /usr/libexec/openssh

View File

@ -40,6 +40,13 @@ ssh_service: sshd
chrony_service: chronyd
clamav_service: 'clamd@scan'
# Clamav paparms
clamav_service_details:
user: clamscan
group: virusgroup
socket_path: /run/clamd.scan/clamd.sock
mode: 0710
# Commands
grub_update_cmd: "/usr/sbin/grub2-mkconfig -o {{ grub_config_file_boot }}"
ssh_keysign_path: /usr/libexec/openssh