diff options
-rw-r--r-- | packages/p3scan.inc | 61 | ||||
-rw-r--r-- | packages/p3scan.mail | 15 | ||||
-rw-r--r-- | packages/p3scan.xml | 25 |
3 files changed, 101 insertions, 0 deletions
diff --git a/packages/p3scan.inc b/packages/p3scan.inc new file mode 100644 index 00000000..4f9a025b --- /dev/null +++ b/packages/p3scan.inc @@ -0,0 +1,61 @@ +<?php +require_once('globals.inc'); +require_once('config.inc'); +require_once('util.inc'); +require_once('service-utils.inc'); +require_once('filter.inc'); + +define('VIRUSDIR', '/var/tmp/p3scan'); + +function p3scan_install_command() { + global $g; + + $pidfile = "{$g['varrun_path']}/p3scan.pid"; + $rcfile = array(); + $rcfile['file'] = 'p3scan.sh'; + $rcfile['start'] = "p3scan -f /usr/local/etc/p3scan.conf -l $pidfile"; + $rcfile['stop'] = "kill `cat $pidfile`\nrm $pidfile"; + write_rcfile($rcfile); + + make_dirs(VIRUSDIR); + chown(VIRUSDIR, 'proxy'); + chmod(VIRUSDIR, 0700); + make_dirs(VIRUSDIR . '/children'); + chown(VIRUSDIR, 'proxy'); + chmod(VIRUSDIR, 0700); + + p3scan_resync(); +} + +function p3scan_resync() { + global $g, $config; + + $virusdir = VIRUSDIR; + $conf = <<<EOD +ip = 127.0.0.1 +user = proxy +justdelete +virusregexp = .*: (.*) FOUND +virusdir = $virusdir +spamcheck = /usr/local/bin/spamc +template = /usr/local/etc/p3scan.mail +scannertype = basic + +EOD; + + if ($config['installedpackages']['sassassin']['config'][0]['enable'] == 'on') + $conf .= "checkspam\n"; + + $virusen = $config['installedpackages']['clamav']['config'][0]['scan_pop3']; + if ($virusen == 'on') + $scanner = '/usr/local/bin/clamdscan --no-summary'; + else + $scanner = 'echo'; + $conf .= "scanner = $scanner\n"; + + file_put_contents('/usr/local/etc/p3scan.conf', $conf); + + restart_service('p3scan'); + filter_configure(); +} +?> diff --git a/packages/p3scan.mail b/packages/p3scan.mail new file mode 100644 index 00000000..920e5c8c --- /dev/null +++ b/packages/p3scan.mail @@ -0,0 +1,15 @@ +To: %MAILTO% +Date: %MAILDATE% +Subject: *** VIRUS *** %SUBJECT% +Content-Transfer-Encoding: 8bit +Content-Type: text/plain; charset="iso8859-1" +MIME-Version: 1.0 + +Your message was scanned by the pfSense virus scanner for POP3, running on %HOSTNAME%.%DOMAINNAME%, and a virus was found. This email has been sent to you instead of the original infected email. The infected message has been deleted. + +The virus contained in the original message was %VIRUSNAME%. The sender of the email was %MAILFROM%. + +%FILESTATUS% + +Contact the system administrator for further details. This is an automated message, please do not reply to it. +. diff --git a/packages/p3scan.xml b/packages/p3scan.xml new file mode 100644 index 00000000..dd892229 --- /dev/null +++ b/packages/p3scan.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="utf-8"?> +<packagegui> + <include_file>p3scan.inc</include_file> + <additional_files_needed> + <item>http://www.pfsense.org/packages/config/p3scan.inc</item> + </additional_files_needed> + <additional_files_needed> + <item>http://www.pfsense.org/packages/All/p3scan</item> + <prefix>/usr/local/bin/</prefix> + <chmod>0755</chmod> + </additional_files_needed> + <additional_files_needed> + <item>http://www.pfsense.org/packages/config/p3scan.mail</item> + <prefix>/usr/local/etc/</prefix> + </additional_files_needed> + <custom_php_install_command> + p3scan_install_command(); + </custom_php_install_command> + <service> + <name>p3scan</name> + <description>POP3 virus/spam scanner.</description> + <rcfile>p3scan.sh</rcfile> + <executable>p3scan</executable> + </service> +</packagegui> |