diff --git a/vscan_bins.sh b/vscan_bins.sh index 8ec2349..163569b 100755 --- a/vscan_bins.sh +++ b/vscan_bins.sh @@ -27,12 +27,14 @@ fi /usr/bin/sudo /usr/bin/chown clamav:clamav /var/log/clamav/results.log /usr/bin/sudo /usr/bin/chmod 640 /var/log/exescans.log +if [ ! -f /etc/rsyslog.d/exescans.conf ]; then echo "Configuring rsyslog for exescans..." cat << EOF | sudo tee /etc/rsyslog.d/exescans.conf # Send exescans logs (facility local0) to a dedicated file local0.* /var/log/exescans.log EOF - +fi +if [ ! -f /etc/logrotate.d/exescans ]; then /usr/bin/echo "Setting up log rotation..." cat << EOF | sudo tee /etc/logrotate.d/exescans /var/log/exescans.log { @@ -46,6 +48,8 @@ cat << EOF | sudo tee /etc/logrotate.d/exescans su root root } EOF +fi +if [ ! -f /etc/logrotate.d/exeguard ]; then cat << EOF | sudo tee /etc/logrotate.d/exeguard /var/log/exeguard.log { weekly @@ -58,6 +62,8 @@ cat << EOF | sudo tee /etc/logrotate.d/exeguard su root root } EOF +fi +if [ ! -f /etc/logrotate.d/clamresults ]; then cat << EOF | sudo tee /etc/logrotate.d/clamresults /var/log/clamav/results.log { weekly @@ -69,12 +75,14 @@ cat << EOF | sudo tee /etc/logrotate.d/clamresults create 640 clamav adm } EOF - echo "Restarting rsyslog..." sudo systemctl restart rsyslog - +fi +/usr/bin/echo "Updating freshclam..." +/usr/bin/sudo /usr/bin/freshclam +#/usr/bin/sudo /usr/bin/apt update && /usr/bin/sudo /usr/bin/apt upgrade clamav clamav-daemon /usr/bin/echo "Running clamScan...this will take some time!" -/usr/bin/sudo /usr/bin/clamscan -v --move=/var/lib/clamav/quarantine --file-list=my_bins_apps.txt 2>/dev/null --log=/var/log/clamav/results.log +/usr/bin/sudo /usr/bin/clamscan -v --move=/var/lib/clamav/quarantine --file-list=my_bins_apps.txt --log=/var/log/clamav/results.log 2>/dev/null case $? in 0) /usr/bin/logger -t exescans -p local0.info "System Bin clamscan Complete - All Okay..."