mirror of
https://github.com/opnsense/plugins.git
synced 2026-05-28 04:34:15 -04:00
security/clamav: merge version 1.1 from master
This commit is contained in:
parent
7d90f10f64
commit
ed11592ce7
7 changed files with 94 additions and 2 deletions
|
|
@ -1,5 +1,5 @@
|
|||
PLUGIN_NAME= clamav
|
||||
PLUGIN_VERSION= 1.0
|
||||
PLUGIN_VERSION= 1.1
|
||||
PLUGIN_COMMENT= Antivirus engine for detecting malicious threats
|
||||
PLUGIN_DEPENDS= clamav
|
||||
PLUGIN_MAINTAINER= m.muenz@gmail.com
|
||||
|
|
|
|||
|
|
@ -163,4 +163,37 @@ class ServiceController extends ApiControllerBase
|
|||
return array("status" => "failed");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get ClamAV and signature versions
|
||||
*/
|
||||
public function versionAction()
|
||||
{
|
||||
$infos = array(
|
||||
"clamav" => array("search" => "Version: "),
|
||||
"main" => array("search" => "main.cvd: "),
|
||||
"daily" => array("search" => "daily.cld: "),
|
||||
"bytecode" => array("search" => "bytecode.cld: "),
|
||||
"signatures" => array("search" => "Total number of signatures: ")
|
||||
);
|
||||
$backend = new Backend();
|
||||
$result = array();
|
||||
$response = $backend->configdRun("clamav version");
|
||||
if ($response != null) {
|
||||
foreach (explode("\n", $response) as $str) {
|
||||
foreach ($infos as $key => $info) {
|
||||
if (strpos($str, $info["search"]) !== false) {
|
||||
$version = substr($str, strlen($info["search"]));
|
||||
if (isset($version)) {
|
||||
$result[$key] = $version;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return array("version" => $result);
|
||||
}
|
||||
else {
|
||||
return array();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ class GeneralController extends \OPNsense\Base\IndexController
|
|||
{
|
||||
$this->view->title = gettext("ClamAV Settings");
|
||||
$this->view->generalForm = $this->getForm("general");
|
||||
$this->view->versionForm = $this->getForm("version");
|
||||
$this->view->pick('OPNsense/ClamAV/general');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,27 @@
|
|||
<form>
|
||||
<field>
|
||||
<id>version.clamav</id>
|
||||
<label>ClamAV engine version</label>
|
||||
<type>info</type>
|
||||
</field>
|
||||
<field>
|
||||
<id>version.main</id>
|
||||
<label>main.cvd</label>
|
||||
<type>info</type>
|
||||
</field>
|
||||
<field>
|
||||
<id>version.daily</id>
|
||||
<label>daily.cld</label>
|
||||
<type>info</type>
|
||||
</field>
|
||||
<field>
|
||||
<id>version.bytecode</id>
|
||||
<label>bytecode.cld</label>
|
||||
<type>info</type>
|
||||
</field>
|
||||
<field>
|
||||
<id>version.signatures</id>
|
||||
<label>Total number of signatures</label>
|
||||
<type>info</type>
|
||||
</field>
|
||||
</form>
|
||||
|
|
@ -29,9 +29,14 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
<div class="alert alert-warning" role="alert" id="dl_sig_alert" style="display:none;min-height:65px;">
|
||||
<button class="btn btn-primary pull-right" id="dl_sig" type="button">{{ lang._('Download signatures') }} <i id="dl_sig_progress"></i></button>
|
||||
<div style="margin-top: 8px;">{{ lang._('No signature database found, please download before use. The download will take several minutes and this message will disappear when it has been completed. If you have memory file system enabled where /var is mounted into RAM you have to download this file with every reboot.')}}</div>
|
||||
<div style="margin-top: 8px;">{{ lang._('No signature database found, please download before use. The download will take several minutes and this message will disappear when it has been completed.') }}</div>
|
||||
</div>
|
||||
|
||||
<ul class="nav nav-tabs" data-tabs="tabs" id="maintabs">
|
||||
<li class="active"><a data-toggle="tab" href="#general">{{ lang._('General') }}</a></li>
|
||||
<li><a data-toggle="tab" href="#versions">{{ lang._('Versions') }}</a></li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content content-box tab-content">
|
||||
<div id="general" class="tab-pane fade in active">
|
||||
<div class="content-box" style="padding-bottom: 1.5em;">
|
||||
|
|
@ -42,6 +47,11 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="versions" class="tab-pane fade in">
|
||||
<div class="content-box" style="padding-bottom: 1.5em;">
|
||||
{{ partial("layout_partials/base_form",['fields':versionForm,'id':'frm_version'])}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
|
@ -64,6 +74,12 @@ $( document ).ready(function() {
|
|||
$('.selectpicker').selectpicker('refresh');
|
||||
});
|
||||
|
||||
var version_get_map = {'frm_version':"/api/clamav/service/version"};
|
||||
mapDataToFormUI(version_get_map).done(function(data){
|
||||
formatTokenizersUI();
|
||||
$('.selectpicker').selectpicker('refresh');
|
||||
});
|
||||
|
||||
ajaxCall(url="/api/clamav/service/status", sendData={}, callback=function(data,status) {
|
||||
updateServiceStatusUI(data['status']);
|
||||
});
|
||||
|
|
@ -98,5 +114,13 @@ $( document ).ready(function() {
|
|||
setTimeout(timeoutCheck, 2500);
|
||||
});
|
||||
});
|
||||
|
||||
// update history on tab state and implement navigation
|
||||
if(window.location.hash != "") {
|
||||
$('a[href="' + window.location.hash + '"]').click()
|
||||
}
|
||||
$('.nav-tabs a').on('shown.bs.tab', function (e) {
|
||||
history.pushState(null, null, e.target.hash);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -33,3 +33,9 @@ command:/usr/local/opnsense/scripts/OPNsense/ClamAV/freshclam.sh
|
|||
parameters:%s
|
||||
type:script_output
|
||||
message:Check or install signatures
|
||||
|
||||
[version]
|
||||
command:/usr/local/bin/clamconf | grep "Version:\|main.cvd: version\|.cld: version\|Total number of signatures:"
|
||||
parameters:
|
||||
type:script_output
|
||||
message:Get ClamAV and signature versions
|
||||
|
|
|
|||
|
|
@ -4,3 +4,4 @@ clamav_clamd_enable="YES"
|
|||
{% else %}
|
||||
clamav_clamd_enable="NO"
|
||||
{% endif %}
|
||||
clamav_clamd_var_mfs="/var/db/clamav"
|
||||
|
|
|
|||
Loading…
Reference in a new issue