From 46cfb3e4f6802687cb9d86d1d768f057ce5c89e6 Mon Sep 17 00:00:00 2001 From: jvolkenant Date: Mon, 22 Aug 2016 11:42:17 -0700 Subject: [PATCH] added install for sqlite, fixed email notify script Added sqlite to clamsmtpd installscript. Switched to using sendmail instead of mail command since there are different commands for different mail(bsd/heirloom) installs. --- setup/clamsmtpd.sh | 15 +++++++-------- tools/email_virus_notify.sh | 21 +++++++++++---------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/setup/clamsmtpd.sh b/setup/clamsmtpd.sh index 87da96fe..a3d27987 100755 --- a/setup/clamsmtpd.sh +++ b/setup/clamsmtpd.sh @@ -9,7 +9,7 @@ echo "Installing clamsmtpd (ClamAV e-mail virus scanning)..." # Install clamav-daemon & clamsmtpd with additional scanning formats -apt_install clamav-daemon clamav clamsmtp unzip p7zip zip arj bzip2 cabextract cpio file gzip lhasa nomarch pax rar unrar unzip zip zoo +apt_install sqlite clamav-daemon clamav clamsmtp unzip p7zip zip arj bzip2 cabextract cpio file gzip lhasa nomarch pax rar unrar unzip zip zoo # Config /etc/clamsmtpd.conf @@ -20,10 +20,10 @@ apt_install clamav-daemon clamav clamsmtp unzip p7zip zip arj bzip2 cabextract c # Adds script to notify destination user only (since sender may be spoofed) that mail was dropped due to virus detection) tools/editconf.py /etc/clamsmtpd.conf -s \ - OutAddress:=127.0.0.1:10028 \ - Listen:=127.0.0.1:10027 \ - Header:="X-AV-Checked: ClamAV" \ - VirusAction:="/usr/local/lib/clamsmtpd/email_virus_notify.sh" + OutAddress:=127.0.0.1:10028 \ + Listen:=127.0.0.1:10027 \ + Header:="X-AV-Checked: ClamAV" \ + VirusAction:="/usr/local/lib/clamsmtpd/email_virus_notify.sh" # Configure postfix main.cf @@ -34,9 +34,9 @@ content_filter=scan:127.0.0.1:10027 #\ # Configure postfix master.cf tools/editconf.py /etc/postfix/master.cf -s -w \ - "scan unix - - n - 16 smtp + "scan=unix - - n - 16 smtp -o smtp_send_xforward_command=yes" \ - "127.0.0.1:10028 inet n - n - 16 smtpd + "127.0.0.1:10028=inet n - n - 16 smtpd -o content_filter= -o receive_override_options=no_unknown_recipient_checks,no_header_body_checks -o smtpd_helo_restrictions= @@ -66,4 +66,3 @@ restart_service postfix restart_service clamsmtp restart_service clamav-daemon restart_service clamav-freshclam - diff --git a/tools/email_virus_notify.sh b/tools/email_virus_notify.sh index b4c14665..2f41bf9f 100755 --- a/tools/email_virus_notify.sh +++ b/tools/email_virus_notify.sh @@ -22,24 +22,25 @@ for j in $dest_email; do if [[ "$i" == "$j" ]] then { +echo "Subject: Email Virus Scan Notification" +echo "" echo "Hello $i," echo "" echo "This is the email system of $PRIMARY_HOSTNAME." -echo "" -echo "The email from $SENDER to you was infected with a virus ($VIRUS)." -echo "The email was blocked and this notification was sent instead." -echo "" -echo "If you encounter further problems please contact your System Administrator." -echo "" -echo "Regards," +echo "" +echo "The email from $SENDER to you was infected with a virus ($VIRUS)." +echo "The email was blocked and this notification was sent instead." +echo "" +echo "If you encounter further problems please contact your System Administrator." +echo "" +echo "Regards," echo "The email server at $PRIMARY_HOSTNAME" #sending email to recipient that is hosted on this system -} | mail -a "From: postmaster@$PRIMARY_HOSTNAME" -s "Email Virus Scan Notificaton" "$i" +} | sendmail -f "postmaster@$PRIMARY_HOSTNAME" "$i" #continue with next recipient fi -done - done +done