Skip to content

Commit 1a829ff

Browse files
committed
[Fix] clamav_linksigs: unconditional 644 on partner scanner sig deployment
[Fix] chmod 644 on deployed sigs was split across two ownership branches, making it look conditional on dir ownership. Hoist to a single unconditional pass immediately after cp — signatures in partner scanner paths must always be world-readable for the scanner daemon. chown remains conditional for non-root ClamAV dirs.
1 parent c31435f commit 1a829ff

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

files/internals/lmd_clamav.sh

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,13 @@ clamav_linksigs() {
102102
command rm -f "$cpath"/rfxn.{hdb,ndb,yara,hsb} 2>/dev/null
103103
command rm -f "$cpath"/lmd.user.* 2>/dev/null
104104
command cp -f "$_staging"/* "$cpath"/ 2>/dev/null
105-
# Match ownership/perms to ClamAV data dir so clamd can read sigs
105+
# Signatures deployed to partner scanner paths must be 644 —
106+
# scanner daemons run as non-root and need read access
107+
for _sf in "$cpath"/rfxn.* "$cpath"/lmd.user.*; do
108+
[ -f "$_sf" ] || continue
109+
command chmod 644 "$_sf" 2>/dev/null # enforce world-readable for scanner daemon
110+
done
111+
# Match ownership to ClamAV data dir when it runs as non-root
106112
local _cpath_owner _cpath_group
107113
if [ "$os_freebsd" == "1" ]; then
108114
_cpath_owner=$(stat -f '%Su' "$cpath" 2>/dev/null)
@@ -115,13 +121,6 @@ clamav_linksigs() {
115121
for _sf in "$cpath"/rfxn.* "$cpath"/lmd.user.*; do
116122
[ -f "$_sf" ] || continue
117123
command chown "${_cpath_owner}:${_cpath_group}" "$_sf" 2>/dev/null
118-
command chmod 644 "$_sf" 2>/dev/null
119-
done
120-
else
121-
# Root-owned dir: just ensure world-readable for any clamd user
122-
for _sf in "$cpath"/rfxn.* "$cpath"/lmd.user.*; do
123-
[ -f "$_sf" ] || continue
124-
command chmod 644 "$_sf" 2>/dev/null
125124
done
126125
fi
127126
command rm -rf "$_staging"

0 commit comments

Comments
 (0)