Skip to content

Commit

Permalink
feat(CLAMAV): grant full disk access
Browse files Browse the repository at this point in the history
  • Loading branch information
niall-byrne committed Jul 9, 2023
1 parent 802e8a6 commit e24cac8
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions profile/tasks/post_install/variant.common/clamav.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
- name: Check Whether Clamav Requires Permission To Run With Full Disk Access
register: variant_common_fdautil_list_clamav
become: true
ansible.builtin.command: /usr/local/bin/fdautil list
changed_when: false

- name: Grant Clamav Permission To Run With Full Disk Access
become: true
ansible.builtin.command: /usr/local/bin/fdautil set daemon net.clamav.clamd {{ brew_prefix }}/sbin/clamd --foreground -c {{ clamav_clamd_config_file }}
changed_when: true
when: "'net.clamav.clamd' not in variant_common_fdautil_list_clamav.stdout"
notify:
- "Restart Clamd"

- name: Patch Service File Line 1
become: true
ansible.builtin.lineinfile:
path: "/Library/LaunchDaemons/net.clamav.clamd.plist"
insertbefore: '^\s+<string>{{ brew_prefix }}/sbin/clamd</string>'
line: " <string>exec</string>"
state: present
notify:
- "Restart Clamd"

- name: Patch Service File Line 2
become: true
ansible.builtin.lineinfile:
path: "/Library/LaunchDaemons/net.clamav.clamd.plist"
insertbefore: '^\s+<string>exec</string>'
line: " <string>/usr/local/bin/fdautil</string>"
state: present
notify:
- "Restart Clamd"

0 comments on commit e24cac8

Please sign in to comment.