Skip to content

Instantly share code, notes, and snippets.

@gdugas
Created May 12, 2014 10:19
Show Gist options
  • Select an option

  • Save gdugas/704cfe4d8e2c9875cc65 to your computer and use it in GitHub Desktop.

Select an option

Save gdugas/704cfe4d8e2c9875cc65 to your computer and use it in GitHub Desktop.
modsecurity clamav + findbot scanner
# modsecurity scanner
echo "SecRule FILES_TMPNAMES "@inspectFile /opt/modsecurity_clamdscan.sh" phase:2,t:none,log,deny" >> /etc/modsecurity/modsecurity.conf
# clamav scan script
cat >> /opt/modsecurity_clamdscan.sh << EOF
#! /bin/bash
if [ ! $1 ]; then
echo "No file to scan"
exit 1
fi
RES=`clamdscan --no-summary $1`
if [[ $RES == *OK ]]; then
echo 1
elif [[ $RES == *FOUND ]]; then
echo 0 $RES
fi
echo ""
EOF
chmod +x /opt/modsecurity_clamdscan.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment