Last active
June 26, 2024 21:32
-
-
Save holly/e3ef09ae9551d425eb77 to your computer and use it in GitHub Desktop.
clamav-milter VirusAction script
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 | |
# setting clamav-milter config file | |
# VirusAction /path/to/virus-alert.sh | |
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin | |
SERVER=$HOSTNAME | |
VIRUS_ADMIN=${VIRUS_ADMIN:=virus-admin@$HOSTNAME} | |
VIRUS_ALERT=${VIRUS_ALERT:=postmaster@$HOSTNAME} | |
SUBJECT="[virus-alert] $SERVER: an infected e-mail has been detected." | |
#### Should sanitize the input strings #### | |
VIRUS=$1 # Name of the detected virus (Obviously) | |
FILE=$2 # FILE/ID of the message (on the server) | |
SENDER=$3 # SENDER's e-mail | |
RECIPIENT=$4 # RECIPIENT's e-mail (Only the first one will be passed) | |
SUBJECT=$5 # The subject of the message | |
MSGID=$6 # MESSAGE-ID Of the given message (From Message-ID Header) | |
DATE=$7 # MSG RECV DATE TIME | |
cat -v << EOF | /usr/sbin/sendmail -t -i | |
From: $VIRUS_ADMIN | |
To: $VIRUS_ALERT | |
Subject: $SUBJECT | |
Signature : $VIRUS | |
Date : $DATE | |
Subject : $SUBJECT | |
Sender : $SENDER | |
Recipient : $RECIPIENT | |
File : $FILE | |
Message is currently quarantined. Further action is required. | |
EOF |
Thanx for script!
Danke Dir 👍 Funktioniert bis heute noch wunderbar.
Schön wäre es noch die IP Adresse des Absenders aufzuführen für den Administrator.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
SUBJECT is overwritten by parameters.