Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

profiles: email-common: allow clamav plugin for claws-mail #5719

Merged
merged 2 commits into from
May 19, 2023

Conversation

marek22k
Copy link
Contributor

@marek22k marek22k commented Mar 7, 2023

No description provided.

@marek22k marek22k changed the title make clamav plugin works for claws mail WIP: make clamav plugin works for claws mail Mar 7, 2023
@kmk3 kmk3 marked this pull request as draft March 7, 2023 10:47
@kmk3 kmk3 changed the title WIP: make clamav plugin works for claws mail email-common.profile: allow clamav plugin for claws-mail Mar 7, 2023
Copy link
Collaborator

@kmk3 kmk3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For clarity, change the commit message title to the PR title and add
"Fixes #5716" or "Closes #5716" to the commit message body so that the issue is
linked and automatically closed when the PR is merged.

Copy link
Collaborator

@glitsj16 glitsj16 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Improve protection.

whitelist /var/mail
whitelist /var/run/clamav/clamd.ctl
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will start whitelising in /run and break different thinks on a lot systems (DNS, printing, system-bus, hardware-acceleration(?), ...).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Can we mitigate that by including whitelist-run-common.inc? Never used clamav, neither with claws-mail nor anything else for that matter.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marek22k Can you test the above? Besides the other entrees add include whitelist-run-common.inc as well to a email-common.local and try clamav from your claws-mail.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am unsure if that was the case yesterday. I have now tried accessing the socket without modified claws-mail.local:

$firejail --profile=claws-mail file /var/run/clamav/clamd.ctl
Reading profile /etc/firejail/claws-mail.profile
Reading profile /etc/firejail/email-common.profile
Reading profile /etc/firejail/disable-common.inc
Reading profile /etc/firejail/disable-devel.inc
Reading profile /etc/firejail/disable-exec.inc
Reading profile /etc/firejail/disable-interpreters.inc
Reading profile /etc/firejail/disable-programs.inc
Reading profile /etc/firejail/disable-xdg.inc
Reading profile /etc/firejail/whitelist-common.inc
Reading profile /etc/firejail/whitelist-runuser-common.inc
Reading profile /etc/firejail/whitelist-usr-share-common.inc
Reading profile /etc/firejail/whitelist-var-common.inc
Warning: networking feature is disabled in Firejail configuration file
Parent pid 70823, child pid 70826
Warning: An abstract unix socket for session D-BUS might still be available. Use --net or remove unix from --protocol set.
Warning: skipping crypto-policies for private /etc
Warning: skipping gcrypt for private /etc
Warning: skipping gnupg for private /etc
Warning: skipping groups for private /etc
Warning: skipping hosts.conf for private /etc
Warning: skipping pki for private /etc
Private /etc installed in 43.97 ms
Private /usr/etc installed in 0.00 ms
Child process initialized in 217.64 ms
/var/run/clamav/clamd.ctl: socket

Parent is shutting down, bye...

However, when I add include whitelist-run-common.inc, /var/run/clamav/clamd.ctl: cannot open /var/run/clamav/clamd.ctl' (No such file or directory)` appears.

# allow bsfilter
include allow-ruby.inc
noblacklist ${HOME}/.bsfilter

ignore dbus-user filter

# allow claws mail
whitelist /var/lib/clamav
noblacklist /var/lib/clamav

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other problem is that ClamAV also needs access also /etc/clamav/clamd.conf.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bit confused here. If I understand correctly there's no need to whitelist /var/run/clamav (and the consecutive inclusion of whitelist-run-common.inc) after all? If that's the case just drop those options?

The other problem is that ClamAV also needs access also /etc/clamav/clamd.conf.

Easy fix: add clamav to private-etc in email-common.profile:

[...]
private-etc @tls-ca,@x11,clamav,gnupg,hosts.conf,mailname,timezone
[...]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bit confused here.

Yes, I was too. Apparently I made a mistake yesterday or today. I have now edited the PR again.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries, that happens. We've caught it in time so there is value in this review process :)

@marek22k marek22k force-pushed the clawsmail-clamav branch 2 times, most recently from 346a119 to 8b6ee56 Compare March 8, 2023 11:29
Closes netblue30#5716

Signed-off-by: Marek Küthe <m.k@mk16.de>
Copy link
Collaborator

@glitsj16 glitsj16 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@marek22k marek22k marked this pull request as ready for review March 9, 2023 08:41
Copy link
Collaborator

@glitsj16 glitsj16 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kmk3 kmk3 linked an issue Mar 22, 2023 that may be closed by this pull request
5 tasks
@glitsj16
Copy link
Collaborator

glitsj16 commented May 5, 2023

@rusty-snake Do you still have change requests for this?

@rusty-snake rusty-snake dismissed their stale review May 7, 2023 14:33

Stale Review; Fixed

@netblue30 netblue30 merged commit 90aaff8 into netblue30:master May 19, 2023
@netblue30
Copy link
Owner

merged, thanks!

kmk3 pushed a commit that referenced this pull request Jun 14, 2024
Added on commit 2453f0e ("email-common.profile: allow clamav plugin
for claws-mail", 2023-03-07) / PR #5719.
@kmk3 kmk3 changed the title email-common.profile: allow clamav plugin for claws-mail profiles: email-common: allow clamav plugin for claws-mail Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

claws-mail: ClamAV plugin fails with "Permission denied"
5 participants