aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorFernando Lemos <fernandotcl@pfsense.org>2006-06-02 13:32:53 +0000
committerFernando Lemos <fernandotcl@pfsense.org>2006-06-02 13:32:53 +0000
commitf2d35e26a6f9ba2cbce67a1d3692fe4e881f4491 (patch)
tree2cf9de788e8d23aa1d0873b4dc1eb58a9fd43d90 /packages
parent3bab026c6325477268934434d6c2d0dc9610f3ee (diff)
downloadpfsense-packages-f2d35e26a6f9ba2cbce67a1d3692fe4e881f4491.tar.gz
pfsense-packages-f2d35e26a6f9ba2cbce67a1d3692fe4e881f4491.tar.bz2
pfsense-packages-f2d35e26a6f9ba2cbce67a1d3692fe4e881f4491.zip
The same notes for p3scan apply to this package. Note that the Squid, p3scan and clamsmtp packages will require changes to filter.inc to work (some time later I'll move that stuff to /usr/local/pkg/pf, and so we won't need to change filter.inc in the future).
Diffstat (limited to 'packages')
-rw-r--r--packages/clamsmtp.inc54
-rw-r--r--packages/clamsmtp.xml21
2 files changed, 75 insertions, 0 deletions
diff --git a/packages/clamsmtp.inc b/packages/clamsmtp.inc
new file mode 100644
index 00000000..08d9e23b
--- /dev/null
+++ b/packages/clamsmtp.inc
@@ -0,0 +1,54 @@
+<?php
+require_once('globals.inc');
+require_once('config.inc');
+require_once('service-utils.inc');
+require_once('filter.inc');
+
+function clamsmtp_install_command() {
+ global $g;
+
+ $clamav_rundir = "{$g['varrun_path']}/clamav";
+ $pidfile = "$clamav_rundir/clamsmtpd.pid";
+ $rcfile = array();
+ $rcfile['file'] = 'clamsmtp.sh';
+ $rcfile['start'] = "mkdir -p $clamav_rundir\n\tchown proxy:proxy $clamav_rundir\n\tclamsmtpd";
+ $rcfile['stop'] = "kill `cat $pidfile`";
+ write_rcfile($rcfile);
+
+ clamsmtp_resync();
+}
+
+function clamsmtp_validate_input($post, $input_errors) {
+ if (!is_ipaddr(trim($post['smtp_server'])))
+ $input_errors[] = 'The field \'SMTP server\' must contain a valid IP address.';
+ $port = trim($post['smtp_port']);
+ if (!is_numeric($port) || ($port < 0) || ($port > 65535))
+ $input_errors[] = 'The field \'SMTP server\' must contain a port ranging from 0 to 65535';
+}
+
+function clamsmtp_resync() {
+ global $g, $config;
+
+ $avconf = $config['installedpackages']['clamav']['config'][0];
+ if ($avconf['scan_smtp'] == 'on')
+ $outaddress = "{$avconf['smtp_server']}:{$avconf['smtp_port']}";
+ else
+ $outaddress = '127.0.0.1:25';
+ $clamav_rundir = "{$g['varrun_path']}/clamav";
+ $clamsocket = "$clamav_rundir/clamd.socket";
+ $pidfile = "$clamav_rundir/clamsmtpd.pid";
+ $conf = <<<EOD
+Listen: 127.0.0.1:10025
+OutAddress: $outaddress
+ClamAddress: $clamsocket
+User: proxy
+PidFile: $pidfile
+
+EOD;
+
+ file_put_contents('/usr/local/etc/clamsmtpd.conf', $conf);
+
+ restart_service('clamsmtp');
+ filter_configure();
+}
+?>
diff --git a/packages/clamsmtp.xml b/packages/clamsmtp.xml
new file mode 100644
index 00000000..6e1391f7
--- /dev/null
+++ b/packages/clamsmtp.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packagegui>
+ <include_file>clamsmtp.inc</include_file>
+ <additional_files_needed>
+ <item>http://www.pfsense.org/packages/config/clamsmtp.inc</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <item>http://www.pfsense.org/packages/All/clamsmtpd</item>
+ <prefix>/usr/local/bin/</prefix>
+ <chmod>0755</chmod>
+ </additional_files_needed>
+ <custom_php_install_command>
+ clamsmtp_install_command();
+ </custom_php_install_command>
+ <service>
+ <name>clamsmtp</name>
+ <description>SMTP virus scanner.</description>
+ <rcfile>clamsmtp.sh</rcfile>
+ <executable>clamsmtpd</executable>
+ </service>
+</packagegui>