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

Nextcloud Snap Cannot connect to “/var/run/clamav/clamd.ctl”: Permission denied (code 13) #31

Open
Postyfix opened this issue Jan 7, 2024 · 1 comment

Comments

@Postyfix
Copy link

Postyfix commented Jan 7, 2024

Hallo liebe Community,

ich habe auf einem Ubuntu 22.04 per SNAP-Installation die Nextcloud installiert.
Jedoch bekomme ich ClamAV nicht korrekt zum laufen.

Fehler:
Cannot connect to “/var/run/clamav/clamd.ctl”: Permission denied (code 13)
stream_socket_client(): Unable to connect to unix:///var/run/clamav/clamd.ctl (Permission denied) at /var/snap/nextcloud/39212/nextcloud/extra-apps/files_antivirus/lib/Scanner/ExternalClam.php#38

Meine /etc/clamav/clamd.conf:
LocalSocket /var/run/clamav/clamd.ctl
FixStaleSocket true
LocalSocketGroup clamav
LocalSocketMode 666
User clamav

systemctl status clamav-daemon:
clamav-daemon.service - Clam AntiVirus userspace daemon
Loaded: loaded (/lib/systemd/system/clamav-daemon.service; enabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/clamav-daemon.service.d
└─extend.conf
Active: active (running) since Fri 2024-01-05 12:44:57 CET; 4min 40s ago
Docs: man:clamd(8)
man:clamd.conf(5)
https://docs.clamav.net/
Process: 1017 ExecStartPre=/bin/mkdir -p /run/clamav (code=exited, status=0/SUCCESS)
Process: 1049 ExecStartPre=/bin/chown clamav /run/clamav (code=exited, status=0/SUCCESS)
Main PID: 1051 (clamd)
Tasks: 2 (limit: 4558)
Memory: 1.6G
CPU: 19.715s
CGroup: /system.slice/clamav-daemon.service
└─1051 /usr/sbin/clamd --foreground=true

Jan 05 12:45:22 owncloud clamd[1051]: Portable Executable support enabled.
Jan 05 12:45:22 owncloud clamd[1051]: ELF support enabled.
Jan 05 12:45:22 owncloud clamd[1051]: Mail files support enabled.
Jan 05 12:45:22 owncloud clamd[1051]: OLE2 support enabled.
Jan 05 12:45:22 owncloud clamd[1051]: PDF support enabled.
Jan 05 12:45:22 owncloud clamd[1051]: SWF support enabled.
Jan 05 12:45:22 owncloud clamd[1051]: HTML support enabled.
Jan 05 12:45:22 owncloud clamd[1051]: XMLDOCS support enabled.
Jan 05 12:45:22 owncloud clamd[1051]: HWP3 support enabled.
Jan 05 12:45:22 owncloud clamd[1051]: Self checking every 300 seconds.

Nextcloud Antiviruseinstellungen sind auf:
Modus: ClamAV-Daemon-Socket
Socket: /var/run/clamav/clamd.ctl

ll /var/run/clamav/clamd.ctl
srw-rw-rw- 1 clamav clamav 0 Jan 5 12:45 /var/run/clamav/clamd.ctl=

Auch diese Anleitung bringt den gleichen Fehler.
Add /{,var/}snap/nextcloud/[0-9]/clamd.ctl w, to /etc/apparmor.d/usr.sbin.clamd like below.
32 /{,var/}run/clamav/clamd.ctl w,
33 /{,var/}snap/nextcloud/[0-9]/clamd.ctl w,
34 /{,var/}run/clamav/clamd.pid w,

then apply it to apparmor:
sudo apparmor_parser -r /etc/apparmor.d/usr.sbin.clamd

edit /etc/clamav/clamd.conf and change it to this (LocalSocket, LocalSocketGroup, User):

4 LocalSocket /var/snap/nextcloud/current/clamd.ctl
5 FixStaleSocket true
6 #LocalSocketGroup clamav
7 LocalSocketGroup root
8 LocalSocketMode 666
9 # TemporaryDirectory is not set to its default /tmp here to make overriding
10 # the default with environment variables TMPDIR/TMP/TEMP possible
11 #User clamav
12 User root
13 ScanMail tr

restart clamav:
sudo systemctl restart clamav-daemon

sudo mv /var/run/clamav/clamd.ctl /var/snap/nextcloud/current/

Change LocalSocket option of /etc/clamav/clamd.conf and restart clamav-daemon:
LocalSocket /var/snap/nextcloud/current/clamd.ctl
sudo snap restart nextcloud

@Postyfix
Copy link
Author

Postyfix commented Jan 9, 2024

Hat keiner eine Lösung bzw einen Lösungsansatz? Schade ….

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

No branches or pull requests

1 participant