aboutsummaryrefslogtreecommitdiffstats
path: root/config/havp
diff options
context:
space:
mode:
Diffstat (limited to 'config/havp')
-rw-r--r--config/havp/antivirus.php54
-rw-r--r--config/havp/havp.inc27
-rw-r--r--config/havp/havp.xml4
3 files changed, 52 insertions, 33 deletions
diff --git a/config/havp/antivirus.php b/config/havp/antivirus.php
index 79ff31e7..fa03301e 100644
--- a/config/havp/antivirus.php
+++ b/config/havp/antivirus.php
@@ -42,27 +42,40 @@ define('PATH_CLAMDB', '/var/db/clamav');
define('PATH_HAVPLOG', '/var/log/havp/access.log');
define('PATH_AVSTATUS', '/var/tmp/havp.status');
-function get_avdb_info($filename)
+function get_avdb_info()
{
- $stl = "style='padding-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 4px; border-left: 1px solid #999999;'";
- $r = '';
+ $r = '';
$path = PATH_CLAMDB . "/{$filename}";
- if (file_exists($path)) {
- $handle = '';
- if ($handle = fopen($path, "r")) {
- $fsize = sprintf("%.2f M", filesize($path)/1024/1024);
+ $fl = get_dir(PATH_CLAMDB . "/");
+
+ array_shift($fl);
+ array_shift($fl);
+
+ foreach ($fl as $fname) {
+ $path = PATH_CLAMDB . "/{$fname}";
+ $ext = end(explode(".", $fname));
+
+ if ( $ext == "cvd" || $ext == "cld") {
+ $stl = "style='padding-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 4px; border-left: 1px solid #999999;'";
+ if (file_exists($path)) {
+ $handle = '';
+ if ($handle = fopen($path, "r")) {
+ $fsize = sprintf("%.2f M", filesize($path)/1024/1024);
- $s = fread($handle, 1024);
- $s = explode(':', $s);
-
- # datetime
- $dt = explode(" ", $s[1]);
- $s[1] = strftime("%d.%m.%Y", strtotime("{$dt[0]} {$dt[1]} {$dt[2]}"));
- if ($s[0] == 'ClamAV-VDB')
- $r .= "<tr class='listr'><td $stl>{$filename}</td><td $stl>{$s[1]}</td><td $stl align='right'>$fsize</td><td $stl align='right'>{$s[2]}</td><td $stl align='right'>{$s[3]}</td><td $stl>{$s[7]}</td></tr>";
+ $s = fread($handle, 1024);
+ $s = explode(':', $s);
+
+ # datetime
+ $dt = explode(" ", $s[1]);
+ $s[1] = strftime("%d.%m.%Y", strtotime("{$dt[0]} {$dt[1]} {$dt[2]}"));
+ if ($s[0] == 'ClamAV-VDB')
+ $r .= "<tr class='listr'><td $stl>{$fname}</td><td $stl>{$s[1]}</td><td $stl align='right'>$fsize</td><td $stl align='right'>{$s[2]}</td><td $stl align='right'>{$s[3]}</td><td $stl>{$s[7]}</td></tr>";
+ }
+ fclose($handle);
+ }
}
- fclose($handle);
}
+
return $r;
}
@@ -114,7 +127,7 @@ function avupdate_status()
$s = "Not found.";
if (HVDEF_UPD_STATUS_FILE && file_exists(HVDEF_UPD_STATUS_FILE))
$s = file_get_contents(HVDEF_UPD_STATUS_FILE);
- return $s;
+ return str_replace( "\n", "<br>", $s );
}
# ------------------------------------------------------------------------------
@@ -258,12 +271,7 @@ if (pfsense_version_A() == '1') {
<td colspan="2">
<table width="100%" border="0" cellspacing="0" cellpadding="1" ><tbody>
<tr align="center"><td class="listhdrr">Database</td><td class="listhdrr">Date</td><td class="listhdrr">Size</td><td class="listhdrr">Ver.</td><td class="listhdrr">Signatures</td><td class="listhdrr">Builder</td></tr>
- <?php echo get_avdb_info("daily.cld"); ?>
- <?php echo get_avdb_info("daily.cvd"); ?>
- <?php echo get_avdb_info("main.cld"); ?>
- <?php echo get_avdb_info("main.cvd"); ?>
- <?php echo get_avdb_info("safebrowsing.cld"); ?>
- <?php echo get_avdb_info("safebrowsing.cvd"); ?>
+ <?php echo get_avdb_info(); ?>
</tbody></table>
</td>
</tr>
diff --git a/config/havp/havp.inc b/config/havp/havp.inc
index 072d90b4..02ff7c6d 100644
--- a/config/havp/havp.inc
+++ b/config/havp/havp.inc
@@ -120,7 +120,8 @@ define('HVDEF_AVUPD_SCRIPT', HVDEF_SCRIPT_DIR . '/havp_avupdate');
# status
define('HVDEF_HAVP_STATUS_FILE', '/tmp/havp.status');
define('HVDEF_CLAM_STATUS_FILE', '/tmp/clam.status');
-define('HVDEF_UPD_STATUS_FILE', '/tmp/havpupd.status');
+define('HVDEF_UPD_STATUS_FILE', '/tmp/havp.update.status');
+define('HVDEF_FRESHCLAM_STATUS_FILE', '/tmp/havp.freshclam.status');
# cron
define('HVDEF_CLAM_UPD_CRONNAME', 'havp_clam_update');
@@ -254,6 +255,11 @@ function havp_validate_settings($post, $input_errors)
else $input_errors[] = "File or path not exists '{$post[F_SCANFILEPATH]}'.";
}
else {
+ # ifaces
+ if (!isset($post[F_PROXYINTERFACE]) || empty($post[F_PROXYINTERFACE])) {
+ $post[F_PROXYINTERFACE] = "lan";
+ }
+
# port validate
$prxport = trim($post[F_PROXYPORT]);
if (!empty($prxport) && !is_port($prxport))
@@ -262,8 +268,8 @@ function havp_validate_settings($post, $input_errors)
# parent proxy validate
$parent = trim($post[F_PARENT]);
- # max download size validate
- $maxval = trim($post[F_MAXDOWNLOADSIZE]);
+ # max download size validate
+ $maxval = trim($post[F_MAXDOWNLOADSIZE]);
if (!empty($maxval) && !is_numericint($maxval)) # is_port - validate value
$input_errors[] = 'You must enter a valid numeric value in \'Max download size\' field.';
@@ -339,7 +345,7 @@ function havp_resync()
havp_reconfigure_cron();
# configure system filter
- filter_configure();
+ if (pfsense_version_() == '1') filter_configure();
}
# ------------------------------------------------------------------------------
@@ -429,7 +435,7 @@ function havp_check_system()
} else {
# delete script if exists
if (file_exists(HVDEF_FILTER_RESYNC_SCRIPT))
- mwexec("rm -rf " . HVDEF_FILTER_RESYNC_SCRIPT);
+ mwexec("rm -f " . HVDEF_FILTER_RESYNC_SCRIPT);
}
# mount RAMDisk
@@ -907,8 +913,8 @@ function havp_config_freshclam()
$conf[] = "Checks $chks";
$conf[] = "# notification";
- $conf[] = "OnUpdateExecute date \"+%d-%m-%Y %H:%M:%S Antivirus update success\" > " . HVDEF_UPD_STATUS_FILE;
- $conf[] = "OnErrorExecute date \"+%d-%m-%Y %H:%M:%S Antivirus update error\" > " . HVDEF_UPD_STATUS_FILE;
+ $conf[] = "OnUpdateExecute date \"+%d-%m-%Y %H:%M:%S Antivirus update success\" > " . HVDEF_FRESHCLAM_STATUS_FILE;
+ $conf[] = "OnErrorExecute date \"+%d-%m-%Y %H:%M:%S Antivirus update error\" > " . HVDEF_FRESHCLAM_STATUS_FILE;
$conf[] = "Debug " . (HV_DEBUG === 'true' ? "yes" : "no");
@@ -1241,6 +1247,7 @@ function havp_filter_update_3()
mwexec("pfctl -f $rules_file");
}
}
+
# ------------------------------------------------------------------------------
function havp_update_AV()
{
@@ -1256,14 +1263,18 @@ function havp_update_AV()
function havp_AVupdate_script()
{
$f = HVDEF_UPD_STATUS_FILE;
+$u = HVDEF_FRESHCLAM_STATUS_FILE;
return <<<EOD
#!/bin/sh
-date +"%d.%m.%Y %H:%M:%S Antivirus update started." > $f
+date +"%d.%m.%Y %H:%M:%S Antivirus update started." > $f
+date +"%d.%m.%Y %H:%M:%S Antivirus database already is updated." > $u
/usr/local/bin/freshclam
wait
+cat $u >> $f
/usr/local/bin/sigtool --unpack-current daily.cvd
/usr/local/bin/sigtool --unpack-current main.cvd
wait
+date +"%d.%m.%Y %H:%M:%S Antivirus update end." >> $f
EOD;
}
diff --git a/config/havp/havp.xml b/config/havp/havp.xml
index 30d61ee0..c7841956 100644
--- a/config/havp/havp.xml
+++ b/config/havp/havp.xml
@@ -89,7 +89,7 @@
<type>interfaces_selection</type>
<required/>
<multiple/>
- <value>lan</value>
+ <default_value>lan</default_value>
</field>
<field>
<fielddescr>Proxy port</fielddescr>
@@ -100,7 +100,7 @@
<type>input</type>
<size>10</size>
<required/>
- <value>3125</value>
+ <default_value>3125</default_value>
</field>
<field>
<fielddescr>Parent proxy</fielddescr>