Last active
July 9, 2021 07:16
-
-
Save robertoschwald/b01a2001bb5bb15348a9bfe7ef543027 to your computer and use it in GitHub Desktop.
Install and configure ClamAV on CentOS7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# install and configure clamav/freshclam on CentOS7. | |
# See https://gist.github.com/robertoschwald/b01a2001bb5bb15348a9bfe7ef543027 | |
if ! [ $(id -u) = 0 ]; then | |
echo "Must run as root." | |
exit 1 | |
fi | |
yum clean all | |
yum install epel-release -y | |
yum install clamav clamav-scanner-systemd clamav-update -y | |
ln -s /etc/clamd.d/scan.conf /etc/clamd.conf | |
sed -i '/^Example/d' /etc/clamd.d/scan.conf | |
sed -i 's/^# LocalSocket/LocalSocket/' /etc/clamd.d/scan.conf | |
# As I use clamd on ci agents to locally scan artifacts using Jenkins ClamAV plugin, | |
# and I have Docker running, I cannot use the default Port 3310, as it is used by Docker. | |
# So use a free one and label selinux correctly. | |
semanage port -a -t clamd_port_t -p tcp 4310 | |
cat <<EOF >>/etc/clamd.d/scan.conf | |
TCPSocket 4310 | |
TCPAddr 127.0.0.1 | |
EOF | |
setsebool -P antivirus_can_scan_system 1 | |
systemctl enable clamd@scan | |
systemctl start clamd@scan | |
sed -i '/^Example/d' /etc/freshclam.conf | |
sed -i 's/^FRESHCLAM_DELAY/#FRESHCLAM_DELAY/' /etc/clamd.d/scan.conf | |
freshclam |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment