apparmor="DENIED" for freshclam (CLAMAV)

Bug #1313282 reported by Matthijs van Wageningen
24
This bug affects 4 people
Affects Status Importance Assigned to Milestone
clamav (Ubuntu)
Fix Released
High
Tyler Hicks
Trusty
Fix Released
High
Scott Kitterman
Utopic
Fix Released
High
Tyler Hicks

Bug Description

[Impact]

Freshclam is not able to notify clamd about new databases because AppArmor
prevents it from connecting to the clamd socket. Clamd will still detect the
database update and force reload, but freshclam should be able to notify clamd.

AppArmor fixed a bug (LP: #1208988) in its path-based UNIX domain socket
mediation in Saucy. AppArmor now requires both read and write permissions for
those socket paths but freshclam's profile only grants write permission.

I recently upgraded my Ubuntu server to 14.04 LTS and notice some error
messages regarding Apparmor and Freshclam. So far I know I didn't had these
error message with the previous version (13.10).

Syslog reports:
kernel: [ 113.304926] type=1400 audit(1398085083.946:37): apparmor="DENIED" operation="connect" profile="/usr/bin/freshclam" name="/run/clamav/clamd.ctl" pid=2372 comm="freshclam" requested_mask="r" denied_mask="r" fsuid=110 ouid=110

Freshclam log reports:
WARNING: Clamd was NOT notified: Can't connect to clamd through /var/run/clamav/clamd.ctl

[Test Case]

* Make sure that /etc/clamav/freshclam.conf contains this line:

    NotifyClamd /etc/clamav/clamd.conf

* Manually remove the main database file

    $ sudo rm /var/lib/clamav/main.cvd

* Run freshclam

    $ sudo freshclam

* Verify the following:

    1) It was successful and printed "Clamd successfully notified about the
       update."
    2) There were no warnings about clamd not being notified (see Impact)
    3) There were no AppArmor denials in the system logs (see Impact)

[Regression Potential]

There is essentially no regression potential since we're only loosening up the
freshclam AppArmor profile by adding read permission on the clamd socket.

Changed in clamav (Ubuntu):
importance: Undecided → Medium
Revision history for this message
Scott Kitterman (kitterman) wrote :

It's not intentional. Thanks for the report.

Changed in clamav (Ubuntu):
status: New → Triaged
Changed in clamav (Ubuntu):
assignee: nobody → Tyler Hicks (tyhicks)
importance: Medium → High
Revision history for this message
Tyler Hicks (tyhicks) wrote :

Here's a debdiff that updates the freshclam AppArmor profile to grant both read and write permissions for the clamd socket file. Both permissions are now required by AppArmor when applications connect() to UNIX domain sockets.

Changed in clamav (Ubuntu Trusty):
status: New → Fix Committed
status: Fix Committed → In Progress
Changed in clamav (Ubuntu Utopic):
status: Triaged → Fix Committed
Changed in clamav (Ubuntu Trusty):
importance: Undecided → High
assignee: nobody → Scott Kitterman (kitterman)
milestone: none → ubuntu-14.04.1
Tyler Hicks (tyhicks)
description: updated
description: updated
Revision history for this message
Brian Murray (brian-murray) wrote : Please test proposed package

Hello Matthijs, or anyone else affected,

Accepted clamav into trusty-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/clamav/0.98.1+dfsg-4ubuntu1.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in clamav (Ubuntu Trusty):
status: In Progress → Fix Committed
tags: added: verification-needed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package clamav - 0.98.1+dfsg-5ubuntu2

---------------
clamav (0.98.1+dfsg-5ubuntu2) utopic; urgency=medium

  [ Tyler Hicks ]
  * debian/usr.bin.freshclam: Grant freshclam permission to read and write the
    clamd socket. AppArmor requires both permissions when applications connect
    to path-based UNIX domain sockets. (LP: #1313282)

  [ Scott Kitterman ]
  * Add electric-fence back to build-deps now that it is approved for main
    inclusion (LP: #1311984)
 -- Tyler Hicks <email address hidden> Mon, 28 Apr 2014 16:10:10 -0500

Changed in clamav (Ubuntu Utopic):
status: Fix Committed → Fix Released
Revision history for this message
Matthijs van Wageningen (matthys70) wrote :

The changes to the freshclam AppArmor profile does do the trick.

Now freshclam reports (as it should be);
Clamd successfully notified about the update.

Thanks for the quick fix,
Matthijs

tags: added: verification-done
removed: verification-needed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package clamav - 0.98.1+dfsg-4ubuntu1.1

---------------
clamav (0.98.1+dfsg-4ubuntu1.1) trusty-proposed; urgency=medium

  [ Tyler Hicks ]
  * debian/usr.bin.freshclam: Grant freshclam permission to read and write the
    clamd socket. AppArmor requires both permissions when applications connect
    to path-based UNIX domain sockets. (LP: #1313282)
 -- Scott Kitterman <email address hidden> Mon, 28 Apr 2014 17:29:57 -0400

Changed in clamav (Ubuntu Trusty):
status: Fix Committed → Fix Released
Revision history for this message
Scott Kitterman (kitterman) wrote : Update Released

The verification of the Stable Release Update for clamav has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regresssions.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.