Skip to content

Commit 065dfc0

Browse files
committed
Create helper scripts for ClamAV
1 parent e9786ef commit 065dfc0

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

clamav/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# ClamAV
2+
3+
Helper scripts for ClamAV.
4+
5+
Install e.g. into `/usr/local/bin` and add to `VirusEvent` in `clamd.conf`.

clamav/clam-virus-event.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/usr/bin/env bash
2+
3+
# {{{
4+
5+
set -uo pipefail
6+
7+
stderr() {
8+
echo -e "${@}" 1>&2
9+
}
10+
11+
fail() {
12+
stderr "${1:-}"
13+
stderr ""
14+
stderr "Exiting …"
15+
exit "${2:-1}"
16+
}
17+
18+
if [[ $# -ne 0 ]]; then
19+
stderr ""
20+
stderr "USAGE:"
21+
stderr " ${0}"
22+
stderr ""
23+
exit 0
24+
fi
25+
26+
missing_dependencies=false
27+
declare -r dependencies=(
28+
sendmail
29+
)
30+
for dep in "${dependencies[@]}"; do
31+
if ! command -v "${dep}" &> /dev/null; then
32+
stderr "❌ ERROR: Missing dependency ${dep}"
33+
missing_dependencies=true
34+
fi
35+
done
36+
if ${missing_dependencies}; then
37+
fail 'Please install the missing dependencies!'
38+
fi
39+
40+
# }}}
41+
42+
echo -e "Subject: Virus found by ClamAV\!\n\nClamAV scanned ${CLAM_VIRUSEVENT_FILENAME} and found virus ${CLAM_VIRUSEVENT_VIRUS}\!" \
43+
| sendmail root

0 commit comments

Comments
 (0)