Bug 1610735 - Clamd logrotate example HUP's wrong process name
Summary: Clamd logrotate example HUP's wrong process name
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora EPEL
Classification: Fedora
Component: clamav
Version: epel7
Hardware: All
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Robert Scheck
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-08-01 10:54 UTC by John Horne
Modified: 2018-10-30 17:19 UTC (History)
12 users (show)

Fixed In Version: clamav-0.100.2-2.el7 clamav-0.100.2-2.fc29
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-10-16 10:29:49 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description John Horne 2018-08-01 10:54:59 UTC
Description of problem:
Installing clamd and configuring the service using the examples provided, the '/usr/share/doc/clamd/clamd.logrotate' file tries to HUP the 'clamd.<SERVICE>' process. Following the examples, the SERVICE name is 'scan'. However, the process 'clamd.scan' does not exist, the process is '/usr/sbin/clamd' with the '-c' option pointing to the '/etc/clamd.d/scan.conf' config file. (As seen in the '/usr/lib/systemd/system/clamd@.service' file.)

Version-Release number of selected component (if applicable):
clamd-0.100.1-1.fc28.x86_64

How reproducible:
Every time when using supplied instructions/files.

Steps to Reproduce:
1. Follow the instructions for setting up a clamd systemd service using the config file 'scan.conf' in '/etc/clamd.d', and the files in '/usr/share/doc/clamd'. Include the LogFile config option so that we can see the HUP result, and set the LogFileMaxSize option to zero.

2. As root run the command found in the '/etc/logrotate.d/clamd' file (or '/etc/logrotate.d/clamd.logrotate' if you copied the file exactly):
killall -HUP clamd.scan

3. Check the log file to see if the HUP worked.

Actual results:
Stderr for the killall command shows 'clamd.scan: no process found'
The log file shows nothing about the HUP.

Expected results:
The killall command should not show any errors (no output at all).
The log file should show (for example):
Wed Aug  1 10:51:01 2018 -> SIGHUP caught: re-opening log file.

Additional info:

The 'clamd.logrotate' example file should just use the command 'killall -HUP clamd' - without the SERVICE name. However, perhaps what would be better would be to use something like 'pkill -u <USER> -HUP clamd'. This would then only HUP the clamd process of the USER username.

This problem has possibly not been noticed because the logfile option is disabled by default. Also the logrotate file redirects all killall output to /dev/null, and runs ':' if there is an error from killall. This basically does nothing, so the user sees no postrotate error. At worst someone may notice that the log file is not being rotated.

My only concern here is that if more than one 'SERVICE' is created - using differing config options presumably - then the killall/pkill command would HUP them all, perhaps more than once if the logrotate included a postrotate section for each log file. Perhaps the 'pkill' command could be changed to specify:
pkill -u <USER> -HUP -f '/usr/sbin/clamd -c /etc/clamd.d/<SERVICE>.conf'

Comment 1 Sergio Basto 2018-09-24 01:46:10 UTC
Hello , sorry for delay , thinking about this ticket and `systemctl restart clamd` usually  don't have log file lof is wrote on journalctl and /var/log/messages .

second I don't need change /usr/lib/systemd/system/clamd\@scan.service or setup clamd.scan , just edit  /etc/clamd.d/scan.conf 

but if you want set LogFile /var/log/clamd.scan 


and `killall -HUP clamd`  should work or yes `pkill -u <USER> -HUP -f '/usr/sbin/clamd -c /etc/clamd.d/<SERVICE>.conf' `

Ok I modified the clamd.logrotate file as suggested [1] 



[1]
https://src.fedoraproject.org/rpms/clamav/c/8a56d4c9abdf9c924a9fc931ba5a8da485296eec?branch=master

Comment 2 Fedora Update System 2018-10-04 18:23:30 UTC
clamav-0.100.2-2.fc29 has been submitted as an update to Fedora 29. https://bodhi.fedoraproject.org/updates/FEDORA-2018-847fe2ed61

Comment 3 Fedora Update System 2018-10-05 18:23:00 UTC
clamav-0.100.2-2.fc29 has been pushed to the Fedora 29 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-847fe2ed61

Comment 4 Fedora Update System 2018-10-07 03:00:10 UTC
clamav-0.100.2-2.el7 has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2018-b6e8b488d2

Comment 5 Fedora Update System 2018-10-07 22:58:56 UTC
clamav-0.100.2-2.el7 has been pushed to the Fedora EPEL 7 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2018-b6e8b488d2

Comment 6 Fedora Update System 2018-10-16 10:29:49 UTC
clamav-0.100.2-2.el7 has been pushed to the Fedora EPEL 7 stable repository. If problems still persist, please make note of it in this bug report.

Comment 7 Fedora Update System 2018-10-30 17:19:44 UTC
clamav-0.100.2-2.fc29 has been pushed to the Fedora 29 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.