Install and Configure ClamAV on CentOS 7 Including the usage of Freshclam To get ClamAV on CentOS installed, we have to use the EPEL repository (Extra Packages for Enterprise Linux). Fortunately, the Fedora project provides this with an easy installation. Unfortunately the default configuration is not properly working. In this post we collect some of the issues and required changes. Let’s start with installing the EPEL support. Yum install epel-release Next step is installing all ClamAV components. ![]() It provides a high performance mutli-threaded scanning daemon, command line utilities for on demand file scanning, and an intelligent tool for automatic signature updates. In this post, i will show how to install Clam Antivirus on CentOS 6.3. ![]() Yum install clamav-server clamav-data clamav-update clamav-filesystem clamav clamav-scanner-systemd clamav-devel clamav-lib clamav-server-systemd The output should be similar to. Installing ClamAV with help of EPEL repository Configure SELinux for ClamAV If you are using ClamAV on CentOS, together with SELinux, we should configure it a little bit. This way ClamAV can access all files on disk, and update its data definition files. Enable antivirus_can_scan_system: setsebool -P antivirus_can_scan_system 1 If you don’t perform this step, Freshclam will log something like: During database load: LibClamAV Warning: RWX mapping denied: Can't allocate RWX Memory: Permission denied Configuration of Clam daemon Copy a the clamd.conf template, in case you don’t have a configuration file yet. Cp /usr/share/clamav/template/clamd.conf /etc/clamd.d/clamd.conf sed -i ‘/^Example/d’ /etc/clamd.d/clamd.conf Change /etc/clamd.d/clamd.conf file and define if you want to run the scanner as root, or a specific user. Check your /etc/passwd file for the related Clam user. Change the following two options: User clamscan LocalSocket /var/run/clamd./clamd.sock Enable Freshclam Freshclam helps with keeping the database of ClamAV up-to-date. First delete the related “Example” line from /etc/freshclam.conf. Cp /etc/freshclam.conf /etc/freshclam.conf.bak sed -i ‘/^Example/d’ /etc/freshclam.conf Check the other options in the file, and change it to your preferred settings. Missing systemd service file We didn’t get a systemd service file, so creating a quick file here. The process should be forking itself and start freshclam in daemon mode. In this case we configure it to check 4 times a day for new files. Create a new file /usr/lib/systemd/system/clam-freshclam.service # Run the freshclam as daemon [Unit] Description = freshclam scanner After = network.target [Service] Type = forking ExecStart = /usr/bin/freshclam -d -c 4 Restart = on-failure PrivateTmp = true [Install] WantedBy=multi-user.target Now enable and start the service.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
March 2019
Categories |