Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
5b4185f2
Commit
5b4185f2
authored
Jun 30, 2015
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(ids) implement log file selection
parent
3803c3de
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
73 additions
and
4 deletions
+73
-4
ServiceController.php
...vc/app/controllers/OPNsense/IDS/Api/ServiceController.php
+30
-1
index.volt
src/opnsense/mvc/app/views/OPNsense/IDS/index.volt
+43
-3
No files found.
src/opnsense/mvc/app/controllers/OPNsense/IDS/Api/ServiceController.php
View file @
5b4185f2
...
@@ -178,9 +178,16 @@ class ServiceController extends ApiControllerBase
...
@@ -178,9 +178,16 @@ class ServiceController extends ApiControllerBase
$searchPhrase
=
''
;
$searchPhrase
=
''
;
}
}
if
(
$this
->
request
->
getPost
(
'fileid'
,
'string'
,
''
)
!=
""
)
{
$fileid
=
$this
->
request
->
getPost
(
'fileid'
,
'int'
,
-
1
);
}
else
{
$fileid
=
null
;
}
$backend
=
new
Backend
();
$backend
=
new
Backend
();
$response
=
$backend
->
configdpRun
(
"ids query alerts"
,
array
(
$itemsPerPage
,
$response
=
$backend
->
configdpRun
(
"ids query alerts"
,
array
(
$itemsPerPage
,
(
$currentPage
-
1
)
*
$itemsPerPage
,
$searchPhrase
));
(
$currentPage
-
1
)
*
$itemsPerPage
,
$searchPhrase
,
$fileid
));
$result
=
json_decode
(
$response
,
true
);
$result
=
json_decode
(
$response
,
true
);
if
(
$result
!=
null
)
{
if
(
$result
!=
null
)
{
$result
[
'rowCount'
]
=
count
(
$result
[
'rows'
]);
$result
[
'rowCount'
]
=
count
(
$result
[
'rows'
]);
...
@@ -210,4 +217,26 @@ class ServiceController extends ApiControllerBase
...
@@ -210,4 +217,26 @@ class ServiceController extends ApiControllerBase
return
array
();
return
array
();
}
}
}
}
/**
* list all available logs
* @return array list of alert logs
* @throws \Exception
*/
public
function
getAlertLogsAction
()
{
$backend
=
new
Backend
();
$response
=
$backend
->
configdRun
(
"ids list alertlogs"
);
$result
=
json_decode
(
$response
,
true
);
if
(
$result
!=
null
)
{
$logs
=
array
();
foreach
(
$result
as
$log
)
{
$log
[
'modified'
]
=
date
(
'Y/m/d G:i'
,
$log
[
'modified'
]);
$logs
[]
=
$log
;
}
return
$logs
;
}
else
{
return
array
();
}
}
}
}
src/opnsense/mvc/app/views/OPNsense/IDS/index.volt
View file @
5b4185f2
...
@@ -57,7 +57,28 @@ POSSIBILITY OF SUCH DAMAGE.
...
@@ -57,7 +57,28 @@ POSSIBILITY OF SUCH DAMAGE.
// delay refresh for a bit
// delay refresh for a bit
setTimeout(updateRuleClassTypes, 500);
setTimeout(updateRuleClassTypes, 500);
function addFilters(request) {
// update list of alert logs
ajaxGet(url="/api/ids/service/getAlertLogs",sendData={}, callback=function(data, status) {
if (status == "success") {
$.each(data, function(key, value) {
if (value['sequence'] == undefined) {
$('#alert-logfile').append($("<option></option>").attr("value",'none').text(value['modified']));
} else {
$('#alert-logfile').append($("<option></option>").attr("value",value['sequence']).text(value['modified']));
}
});
$('.selectpicker').selectpicker('refresh');
// link on change event
$('#alert-logfile').on('change', function(){
$('#grid-alerts').bootgrid('reload');
});
}
});
/**
* Add classtype to rule filter
*/
function addRuleFilters(request) {
var selected =$('#ruleclass').find("option:selected").val();
var selected =$('#ruleclass').find("option:selected").val();
if ( selected != "") {
if ( selected != "") {
request['classtype'] = selected;
request['classtype'] = selected;
...
@@ -65,13 +86,24 @@ POSSIBILITY OF SUCH DAMAGE.
...
@@ -65,13 +86,24 @@ POSSIBILITY OF SUCH DAMAGE.
return request;
return request;
}
}
/**
* Add fileid to alert filter
*/
function addAlertQryFilters(request) {
var selected =$('#alert-logfile').find("option:selected").val();
if ( selected != "") {
request['fileid'] = selected;
}
return request;
}
$("#grid-installedrules").UIBootgrid(
$("#grid-installedrules").UIBootgrid(
{ search:'/api/ids/settings/searchinstalledrules',
{ search:'/api/ids/settings/searchinstalledrules',
get:'/api/ids/settings/getRuleInfo/',
get:'/api/ids/settings/getRuleInfo/',
options:{
options:{
multiSelect:false,
multiSelect:false,
selection:false,
selection:false,
requestHandler:addFilters,
requestHandler:add
Rule
Filters,
formatters:{
formatters:{
rowtoggle: function (column, row) {
rowtoggle: function (column, row) {
if (parseInt(row[column.id], 2) == 1) {
if (parseInt(row[column.id], 2) == 1) {
...
@@ -94,6 +126,7 @@ POSSIBILITY OF SUCH DAMAGE.
...
@@ -94,6 +126,7 @@ POSSIBILITY OF SUCH DAMAGE.
options:{
options:{
multiSelect:false,
multiSelect:false,
selection:false,
selection:false,
requestHandler:addAlertQryFilters,
formatters:{
formatters:{
info: function (column, row) {
info: function (column, row) {
return "<button type=\"button\" class=\"btn btn-xs btn-default command-edit\" data-row-id=\"" + row.filepos + "\"><span class=\"fa fa-info-circle\"></span></button> ";
return "<button type=\"button\" class=\"btn btn-xs btn-default command-edit\" data-row-id=\"" + row.filepos + "\"><span class=\"fa fa-info-circle\"></span></button> ";
...
@@ -168,7 +201,14 @@ POSSIBILITY OF SUCH DAMAGE.
...
@@ -168,7 +201,14 @@ POSSIBILITY OF SUCH DAMAGE.
</table>
</table>
</div>
</div>
<div id="alerts" class="tab-pane fade in">
<div id="alerts" class="tab-pane fade in">
<!-- tab page "installed rules" -->
<div class="bootgrid-header container-fluid">
<div class="row">
<div class="col-sm-12 actionBar">
<select id="alert-logfile" class="selectpicker" data-width="200px"></select>
</div>
</div>
</div>
<!-- tab page "alerts" -->
<table id="grid-alerts" class="table table-condensed table-hover table-striped table-responsive" data-editDialog="DialogAlert">
<table id="grid-alerts" class="table table-condensed table-hover table-striped table-responsive" data-editDialog="DialogAlert">
<thead>
<thead>
<tr>
<tr>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment