aboutsummaryrefslogtreecommitdiffstats
path: root/config/archive/clamsmtp.inc
diff options
context:
space:
mode:
authorChris Buechler <cmb@pfsense.org>2011-01-23 01:18:32 -0500
committerChris Buechler <cmb@pfsense.org>2011-01-23 01:18:32 -0500
commitf3ea1f4ba66fe80a435b8224a8eb15e3c732e04b (patch)
tree964bf133a45b1454ace903dfc51d16ec5064f7e9 /config/archive/clamsmtp.inc
parent0c725caaa2a1089c47ea0b50ecb8f30e23bf3ccc (diff)
downloadpfsense-packages-f3ea1f4ba66fe80a435b8224a8eb15e3c732e04b.tar.gz
pfsense-packages-f3ea1f4ba66fe80a435b8224a8eb15e3c732e04b.tar.bz2
pfsense-packages-f3ea1f4ba66fe80a435b8224a8eb15e3c732e04b.zip
move dead packages into archive to clean this up a bit. I know there are some I missed if someone else would like to review
Diffstat (limited to 'config/archive/clamsmtp.inc')
-rw-r--r--config/archive/clamsmtp.inc57
1 files changed, 57 insertions, 0 deletions
diff --git a/config/archive/clamsmtp.inc b/config/archive/clamsmtp.inc
new file mode 100644
index 00000000..f23a35c1
--- /dev/null
+++ b/config/archive/clamsmtp.inc
@@ -0,0 +1,57 @@
+<?php
+require_once('globals.inc');
+require_once('config.inc');
+require_once('service-utils.inc');
+
+if(!function_exists("filter_configure"))
+ 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();
+}
+
+?> \ No newline at end of file