diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2006-05-20 21:16:26 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2006-05-20 21:16:26 +0000 |
commit | 6080784f5eb8bcae13436b3651726e91110d482e (patch) | |
tree | 6508110f0780c0396253b81de45349cfa8d44658 /packages/havp.inc | |
parent | d97ba517bb20251fb3f542ca097dbe54c6b74ccd (diff) | |
download | pfsense-packages-6080784f5eb8bcae13436b3651726e91110d482e.tar.gz pfsense-packages-6080784f5eb8bcae13436b3651726e91110d482e.tar.bz2 pfsense-packages-6080784f5eb8bcae13436b3651726e91110d482e.zip |
Adding clamav and havp packages.
Submitted-by: Rajkumar S <raj_AT_linuxense.com>
Diffstat (limited to 'packages/havp.inc')
-rw-r--r-- | packages/havp.inc | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/packages/havp.inc b/packages/havp.inc new file mode 100644 index 00000000..631db0e3 --- /dev/null +++ b/packages/havp.inc @@ -0,0 +1,107 @@ +<?php +function sync_package_havp() { + conf_mount_rw(); + config_lock(); + global $config, $g; + $fd = fopen("/etc/havp.config","w"); + fwrite($fd, "USER havp\n"); + fwrite($fd, "GROUP havp\n"); + fwrite($fd, "ACCESSLOG /var/log/havp/access.log\n"); + fwrite($fd, "ERRORLOG /var/log/havp/error.log\n"); + fwrite($fd, "DISPLAYINITIALMESSAGES false\n"); + fwrite($fd, "ENABLECLAMLIB true\n"); + fwrite($fd, "CLAMDBDIR /var/db/clamav/\n"); + fwrite($fd, "ENABLECLAMD false\n"); + fwrite($fd, "ENABLEFPROT false\n"); + fwrite($fd, "ENABLEAVG false\n"); + fwrite($fd, "ENABLEAVESERVER false\n"); + fwrite($fd, "ENABLESOPHIE false\n"); + fwrite($fd, "ENABLETROPHIE false\n"); + fwrite($fd, "ENABLENOD32 false\n"); + fwrite($fd, "ENABLEAVAST false\n"); + foreach($config['installedpackages']['havp']['config'] as $tmp) { + fwrite($fd,"SERVERNUMBER " . $tmp['servernumber'] . "\n"); + fwrite($fd,"MAXSERVERS " . $tmp['maxservers'] . "\n"); + fwrite($fd,"PORT " . $tmp['port'] . "\n"); + if ($tmp['bind_address'] <> "") + fwrite($fd,"BIND_ADDRESS " . $tmp['bind_address'] . " \n"); + if ($tmp['source_address'] <> "") + fwrite($fd,"SOURCE_ADDRESS " . $tmp['source_address'] . " \n"); + if ($tmp['transparent'] == "on"){ + fwrite($fd,"TRANSPARENT true\n"); + } + else { + fwrite($fd,"TRANSPARENT false\n"); + } + if ($tmp['range'] == "on"){ + fwrite($fd,"RANGE true\n"); + } + else { + fwrite($fd,"RANGE false\n"); + } + } + fclose($fd); + $start = "/usr/local/sbin/havp &\n"; + $stop = "/usr/bin/killall havp\n" . "sleep 2"; + write_rcfile(array( + "file" => "havp.sh", + "start" => $start, + "stop" => $stop + ) + ); + conf_mount_ro(); + config_unlock(); + unlink_if_exists("/usr/local/etc/havp/havp.config"); + mwexec("ln -sf /etc/havp.config /usr/local/etc/havp/havp.config"); + mwexec("/usr/local/etc/rc.d/havp.sh stop"); + mwexec("/usr/local/etc/rc.d/havp.sh start"); +} + +function havp_install_command() { + global $config, $g; + mwexec ("mkdir -p /var/log/havp/"); + mwexec ("mkdir -p /var/tmp/havp/"); + mwexec ("mkdir -p /var/run/havp/"); + mwexec ("chown havp:havp /var/log/havp"); + mwexec ("chown havp:havp /var/tmp/havp"); + mwexec ("chown havp:havp /var/run/havp"); + sync_package_havp(); +} + +function havp_deinstall_command() { + global $config, $g; + conf_mount_rw(); + unlink_if_exists("/usr/local/etc/rc.d/havp.sh"); + unlink_if_exists("/usr/local/etc/havp/havp.config"); + conf_mount_ro(); +} +function sync_package_havp_whitelist() { + global $config; + conf_mount_rw(); + config_lock(); + $fd = fopen("/usr/local/etc/havp/whitelist","w"); + if($config['installedpackages']['havpwhitelist']['config'] != "") + foreach($config['installedpackages']['havpwhitelist']['config'] as $tmp) { + fwrite($fd, $tmp['url'] . "\n"); + } + fclose($fd); + /* signal a reload of all files */ + conf_mount_ro(); + config_unlock(); +} + +function sync_package_havp_blacklist() { + global $config; + conf_mount_rw(); + config_lock(); + $fd = fopen("/usr/local/etc/havp/blacklist","w"); + if($config['installedpackages']['havpblacklist']['config'] != "") + foreach($config['installedpackages']['havpblacklist']['config'] as $tmp) { + fwrite($fd, $tmp['url'] . "\n"); + } + fclose($fd); + /* signal a reload of all files */ + conf_mount_ro(); + config_unlock(); +} +?>
\ No newline at end of file |