-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add a default docker-compose.yml file with the default volume mounts,…
… adjust volume dir structure
- Loading branch information
Showing
12 changed files
with
79 additions
and
51 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,34 @@ | ||
#!/bin/bash | ||
echo -n "Updating antivirus configuration ..." | ||
printf "Updating antivirus configuration ...\n" | ||
sed -i -e "s/{ALERT}/0/g" /usr/local/maldetect/conf.maldet | ||
sed -i -e "s/{EMAIL}//g" /usr/local/maldetect/conf.maldet | ||
if [[ $# -eq 1 && $1 = *[!\ ]* ]] ; then | ||
email=$1 | ||
/usr/local/install_alerts.sh $email | ||
fi | ||
echo -n "Done" | ||
printf "Done\n" | ||
|
||
PATHS=(/data/scan /data/quarantine /data/queue /data/ok /data/nok) | ||
PATHS=(/data/av/scan /data/av/quarantine /data/av/queue /data/av/ok /data/av/nok) | ||
for i in ${PATHS[@]}; do | ||
mkdir -p ${i} | ||
done | ||
|
||
echo -n "Fetching latest ClamAV virus definitions" | ||
printf "Fetching latest ClamAV virus definitions\n" | ||
freshclam | ||
|
||
echo -n "Fetching latest Maldet malware signatures" | ||
printf "Fetching latest Maldet malware signatures\n" | ||
maldet -u -d | ||
|
||
# inotify watches the queue and launches the AV scanner when new files are written, keeps the docker container running as well! | ||
# | ||
# -m /data/queue monitor /data/queue forever | ||
# -m /data/av/queue monitor /data/av/queue forever | ||
# -r watched directory recursively | ||
# -q quiet (only print events) | ||
# -t 0 never timeout | ||
# -e moved_to,close_write only fire if a file is moved to or written into the watched directory | ||
# | ||
echo -n "Waiting for changes to /data/queue ..." | ||
inotifywait -m -r -q -t 0 -e moved_to,close_write /data/queue | | ||
printf "Waiting for changes to /data/av/queue ...\n" | ||
inotifywait -m -r -q -t 0 -e moved_to,close_write /data/av/queue | | ||
while read -r path action file; do | ||
scanner | ||
done |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
#!/bin/bash | ||
now=`date +'%Y-%m-%d %T'` | ||
echo -n "[${now}]" | ||
printf "[${now}]\n" | ||
|
||
# scan with ClamAV first (faster) | ||
clamscan -rio --enable-stats --move /data/quarantine /data/scan | ||
clamscan -rio --enable-stats --move /data/av/quarantine /data/av/scan | ||
|
||
# scan with maldet second, if file still in /data/scan | ||
files=$(shopt -s nullglob dotglob; echo /data/scan/*) | ||
# scan with maldet second, if file still in /data/av/scan | ||
files=$(shopt -s nullglob dotglob; echo /data/av/scan/*) | ||
if (( ${#files} )) | ||
then | ||
maldet -a /data/scan/ | ||
maldet -a /data/av/scan/ | ||
fi | ||
|
||
# maldet quarantines into /usr/local/maldetect/quarantine, move to /data/quarantine | ||
# maldet quarantines into /usr/local/maldetect/quarantine, move to /data/av/quarantine | ||
files=$(shopt -s nullglob dotglob; echo /usr/local/maldetect/quarantine/*) | ||
if (( ${#files} )) | ||
then | ||
for file in "/usr/local/maldetect/quarantine"/* ; do | ||
filename=`basename $file` | ||
echo -n " --> Moving maldet quarantined file to /data/quarantine/${filename}" | ||
mv -f $file "/data/quarantine/${filename}" | ||
printf " --> Moving maldet quarantined file to /data/av/quarantine/${filename}\n" | ||
mv -f $file "/data/av/quarantine/${filename}" | ||
done | ||
fi |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
#!/bin/bash | ||
files=$(shopt -s nullglob dotglob; echo /data/queue/*) | ||
files=$(shopt -s nullglob dotglob; echo /data/av/queue/*) | ||
if (( ${#files} )) | ||
then | ||
echo -n "Found files to process\n" | ||
for file in "/data/queue"/* ; do | ||
printf "Found files to process\n" | ||
for file in "/data/av/queue"/* ; do | ||
filename=`basename $file` | ||
mv -f $file "/data/scan/${filename}" | ||
echo -n "Processing /data/scan/${filename}" | ||
scanfile > /data/scan/info 2>&1 | ||
if [ -e "/data/scan/${filename}" ] | ||
mv -f $file "/data/av/scan/${filename}" | ||
printf "Processing /data/av/scan/${filename}\n" | ||
scanfile > /data/av/scan/info 2>&1 | ||
if [ -e "/data/av/scan/${filename}" ] | ||
then | ||
echo -n " --> File ok" | ||
mv -f "/data/scan/${filename}" "/data/ok/${filename}" | ||
echo -n " --> File moved to /data/ok/${filename}" | ||
printf " --> File ok\n" | ||
mv -f "/data/av/scan/${filename}" "/data/av/ok/${filename}" | ||
printf " --> File moved to /data/av/ok/${filename}\n" | ||
rm /data/scan/info | ||
elif [ -e "/data/quarantine/${filename}" ] | ||
elif [ -e "/data/av/quarantine/${filename}" ] | ||
then | ||
echo -n " --> File quarantined / nok" | ||
mv -f "/data/scan/info" "/data/nok/${filename}" | ||
echo -n " --> Scan report moved to /data/nok/${filename}" | ||
printf " --> File quarantined / nok\n" | ||
mv -f "/data/av/scan/info" "/data/av/nok/${filename}" | ||
printf " --> Scan report moved to /data/av/nok/${filename}\n" | ||
fi | ||
done | ||
echo -n "Done with processing" | ||
printf "Done with processing\n" | ||
fi |
Empty file.
Empty file.
Empty file.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
version: '2' | ||
|
||
services: | ||
|
||
docker-av: | ||
image: rordi/docker-antivirus | ||
container_name: docker-av | ||
# uncomment and set the email address to receive email alerts when viruses are detected | ||
#command: | ||
# - /usr/local/install_alerts.sh email@example.net | ||
volumes: | ||
- ./data/queue:/data/av/queue | ||
- ./data/ok:/data/av/ok | ||
- ./data/nok:/data/av/nok | ||
networks: | ||
- avnetwork | ||
|
||
networks: | ||
avnetwork: |