diff options
author | Fernando Lemos <fernandotcl@pfsense.org> | 2006-06-02 13:17:46 +0000 |
---|---|---|
committer | Fernando Lemos <fernandotcl@pfsense.org> | 2006-06-02 13:17:46 +0000 |
commit | 3bab026c6325477268934434d6c2d0dc9610f3ee (patch) | |
tree | 6b15b398642db8989160440ff2facdffdcd93132 /packages/p3scan.inc | |
parent | 5368c88c63ddd7d175337c0ca73702d813b1fdf8 (diff) | |
download | pfsense-packages-3bab026c6325477268934434d6c2d0dc9610f3ee.tar.gz pfsense-packages-3bab026c6325477268934434d6c2d0dc9610f3ee.tar.bz2 pfsense-packages-3bab026c6325477268934434d6c2d0dc9610f3ee.zip |
The p3scan package. You can see the changes in the Antivirus interface after you install this.
Diffstat (limited to 'packages/p3scan.inc')
-rw-r--r-- | packages/p3scan.inc | 61 |
1 files changed, 61 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(); +} +?> |