~ubuntu-branches/ubuntu/intrepid/clamsmtp/intrepid

« back to all changes in this revision

Viewing changes to scripts/virus_action.sh

  • Committer: Bazaar Package Importer
  • Author(s): Chad Walstrom
  • Date: 2004-12-13 12:28:16 UTC
  • Revision ID: james.westby@ubuntu.com-20041213122816-4joiogeyuzgoysl3
Tags: upstream-1.2
ImportĀ upstreamĀ versionĀ 1.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
 
 
3
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
4
#   WARNING WARNING WARNING WARNING WARNING WARNING WARNING 
 
5
#
 
6
#  By using variables passed in from clamsmtpd in file 
 
7
#  manipulation commands without escaping their contents 
 
8
#  you are opening yourself up to REMOTE COMPROMISE. You 
 
9
#  have been warned. Do NOT do the following unless you 
 
10
#  want to be screwed big time:
 
11
#
 
12
#  mv $EMAIL "$SENDER.eml"
 
13
#
 
14
#  An attacker can use the above command to compromise your
 
15
#  computer. The only variable that is guaranteed safe in
 
16
#  this regard is $EMAIL. 
 
17
 
18
#  The following script does not escape its variables 
 
19
#  because it only uses them in safe ways. 
 
20
 
21
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
22
 
 
23
# A sample script for virus actions. When testing make sure
 
24
# everything can run as the clamav (or relevant) user.
 
25
 
 
26
file="/path/to/virus.log"
 
27
dir="/path/to/quarantine/"
 
28
 
 
29
exec 1>>$file
 
30
exec 2>>$file
 
31
 
 
32
 
 
33
# Add some fun log lines to the log file
 
34
 
 
35
echo "-------------------------------------------------------"
 
36
echo Sender  $SENDER
 
37
echo Recipients  $RECIPIENTS
 
38
echo Virus  $VIRUS
 
39
echo "-------------------------------------------------------"
 
40
 
 
41
 
 
42
# Move the virus file to another directory
 
43
# This only works if Quarantine is enabled
 
44
 
 
45
if [ -n "$EMAIL" ]; then
 
46
        mv "$EMAIL" "$dir"
 
47
fi
 
48