service.running for clamav does not work

159 views
Skip to first unread message

Max Arnold

unread,
Oct 12, 2013, 7:51:26 AM10/12/13
to salt-...@googlegroups.com
Hi all,

I have the following state (for Ubuntu 12.04):

clamav-freshclam:
pkg:
- installed
service.running:
- enable: True

clamav-daemon:
pkg:
- installed
service.running:
- enable: True

After applying this state I get /usr/bin/freshclam running and /usr/sbin/clamd not.
On the second run of state.sls clamav both daemons are running. Is there any workarounds for this?

Nick Davis

unread,
Oct 12, 2013, 9:17:06 AM10/12/13
to salt-...@googlegroups.com
Try switching the order. Install and run clamav-freshclam AFTER clamav-daemon.



--
You received this message because you are subscribed to the Google Groups "Salt-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Nick Davis

unread,
Oct 12, 2013, 9:21:14 AM10/12/13
to salt-...@googlegroups.com
Here is my working clamav state file: (in salt >= 0.17.x, you can ignore the require statements because it will execute the declarations in the written order).

clamav-daemon:
  pkg.installed:
  service:
    - running
    - enable: True
    - require:
      - pkg: clamav-daemon

clamav-freshclam:
  pkg.installed:
  service:
    - running
    - enable: False
    - require:
      - pkg: clamav-daemon
      - pkg: clamav-freshclam

Nick Davis

unread,
Oct 12, 2013, 9:22:13 AM10/12/13
to salt-...@googlegroups.com
Ooops, enable should be "True" on freshclam service.

Max Arnold

unread,
Oct 12, 2013, 9:55:36 AM10/12/13
to salt-...@googlegroups.com
On Sat, Oct 12, 2013 at 09:22:13AM -0400, Nick Davis wrote:
> Ooops, enable should be "True" on freshclam service.

To make it work I splitted pkg.installed to separate lines:

clamav-daemon:
pkg:
- installed
service:
- running
- enable: True
- require:
- pkg: clamav-daemon

clamav-freshclam:
pkg:
- installed
service:
- running
- enable: True
- require:
- pkg: clamav-daemon
- pkg: clamav-freshclam

Still, no success. It looks like clamav-daemon won't run without antivirus database:

apt-get install clamav-freshclam clamav-daemon && /etc/init.d/clamav-freshclam start && /etc/init.d/clamav-daemon start

* Clamav signatures not found in /var/lib/clamav
* Please retrieve them using freshclam
* Then run '/etc/init.d/clamav-daemon start'

This was not shown in the minion log and no error was reported. I solved it with the following workaround:

clamav-freshclam:
pkg:
- installed
service:
- running
- enable: True

freshclam:
cmd.wait:
- watch:
- pkg: clamav-freshclam

clamav-daemon:
pkg:
- installed
service:
- running
- require:
- cmd: freshclam

Nick Davis

unread,
Oct 12, 2013, 12:29:22 PM10/12/13
to salt-...@googlegroups.com
Glad you figured it out.


Reply all
Reply to author
Forward
0 new messages