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
2d5ea554
Commit
2d5ea554
authored
Jun 12, 2015
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(ids) work in progress suricata IDS component (frontend/middleware)
parent
775ffffb
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
86 additions
and
22 deletions
+86
-22
SettingsController.php
...c/app/controllers/OPNsense/IDS/Api/SettingsController.php
+35
-1
IndexController.php
...ense/mvc/app/controllers/OPNsense/IDS/IndexController.php
+2
-0
dialogRule.xml
...nse/mvc/app/controllers/OPNsense/IDS/forms/dialogRule.xml
+27
-0
index.volt
src/opnsense/mvc/app/views/OPNsense/IDS/index.volt
+22
-21
No files found.
src/opnsense/mvc/app/controllers/OPNsense/IDS/Api/SettingsController.php
View file @
2d5ea554
...
@@ -96,7 +96,6 @@ class SettingsController extends ApiControllerBase
...
@@ -96,7 +96,6 @@ class SettingsController extends ApiControllerBase
$searchPhrase
.=
"classtype/"
.
$this
->
request
->
getPost
(
"classtype"
,
"string"
,
''
)
.
' '
;
$searchPhrase
.=
"classtype/"
.
$this
->
request
->
getPost
(
"classtype"
,
"string"
,
''
)
.
' '
;
}
}
// request list of installed rules
// request list of installed rules
$backend
=
new
Backend
();
$backend
=
new
Backend
();
$response
=
$backend
->
configdpRun
(
"ids list installedrules"
,
array
(
$itemsPerPage
,
$response
=
$backend
->
configdpRun
(
"ids list installedrules"
,
array
(
$itemsPerPage
,
...
@@ -138,7 +137,42 @@ class SettingsController extends ApiControllerBase
...
@@ -138,7 +137,42 @@ class SettingsController extends ApiControllerBase
if
(
$data
!=
null
&&
array_key_exists
(
"rows"
,
$data
)
&&
count
(
$data
[
'rows'
])
>
0
)
{
if
(
$data
!=
null
&&
array_key_exists
(
"rows"
,
$data
)
&&
count
(
$data
[
'rows'
])
>
0
)
{
$row
=
$data
[
'rows'
][
0
];
$row
=
$data
[
'rows'
][
0
];
// set current enable status (default + registered offset)
$row
[
'enabled'
]
=
$this
->
getModel
()
->
getRuleStatus
(
$row
[
'sid'
],
$row
[
'enabled'
]);
$row
[
'enabled'
]
=
$this
->
getModel
()
->
getRuleStatus
(
$row
[
'sid'
],
$row
[
'enabled'
]);
if
(
isset
(
$row
[
'reference'
])
&&
$row
[
'reference'
]
!=
''
)
{
// browser friendly reference data
$row
[
'reference_html'
]
=
''
;
foreach
(
explode
(
"
\n
"
,
$row
[
'reference'
])
as
$ref
)
{
$ref
=
trim
(
$ref
);
$item_html
=
'<small><a href="%url%" target="_blank">%ref%</a></small>'
;
if
(
substr
(
$ref
,
0
,
4
)
==
'url,'
)
{
$item_html
=
str_replace
(
"%url%"
,
'http://'
.
substr
(
$ref
,
4
),
$item_html
);
$item_html
=
str_replace
(
"%ref%"
,
substr
(
$ref
,
4
),
$item_html
);
}
elseif
(
substr
(
$ref
,
0
,
7
)
==
"system,"
)
{
$item_html
=
str_replace
(
"%url%"
,
substr
(
$ref
,
7
),
$item_html
);
$item_html
=
str_replace
(
"%ref%"
,
substr
(
$ref
,
7
),
$item_html
);
}
elseif
(
substr
(
$ref
,
0
,
8
)
==
"bugtraq,"
)
{
$item_html
=
str_replace
(
"%url%"
,
"http://www.securityfocus.com/bid/"
.
substr
(
$ref
,
8
),
$item_html
);
$item_html
=
str_replace
(
"%ref%"
,
"bugtraq "
.
substr
(
$ref
,
8
),
$item_html
);
}
elseif
(
substr
(
$ref
,
0
,
4
)
==
"cve,"
)
{
$item_html
=
str_replace
(
"%url%"
,
"http://cve.mitre.org/cgi-bin/cvename.cgi?name="
.
substr
(
$ref
,
4
),
$item_html
);
$item_html
=
str_replace
(
"%ref%"
,
substr
(
$ref
,
4
),
$item_html
);
}
elseif
(
substr
(
$ref
,
0
,
7
)
==
"nessus,"
)
{
$item_html
=
str_replace
(
"%url%"
,
"http://cgi.nessus.org/plugins/dump.php3?id="
.
substr
(
$ref
,
7
),
$item_html
);
$item_html
=
str_replace
(
"%ref%"
,
'nessus '
.
substr
(
$ref
,
7
),
$item_html
);
}
elseif
(
substr
(
$ref
,
0
,
7
)
==
"mcafee,"
)
{
$item_html
=
str_replace
(
"%url%"
,
"http://vil.nai.com/vil/dispVirus.asp?virus_k="
.
substr
(
$ref
,
7
),
$item_html
);
$item_html
=
str_replace
(
"%ref%"
,
'macafee '
.
substr
(
$ref
,
7
),
$item_html
);
}
else
{
continue
;
}
$row
[
'reference_html'
]
.=
$item_html
.
'<br/>'
;
}
}
return
$row
;
return
$row
;
}
else
{
}
else
{
return
array
();
return
array
();
...
...
src/opnsense/mvc/app/controllers/OPNsense/IDS/IndexController.php
View file @
2d5ea554
...
@@ -37,6 +37,8 @@ class IndexController extends \OPNsense\Base\IndexController
...
@@ -37,6 +37,8 @@ class IndexController extends \OPNsense\Base\IndexController
public
function
indexAction
()
public
function
indexAction
()
{
{
$this
->
view
->
title
=
"IDS"
;
$this
->
view
->
title
=
"IDS"
;
// link dialog
$this
->
view
->
formDialogRule
=
$this
->
getForm
(
"dialogRule"
);
// choose template
// choose template
$this
->
view
->
pick
(
'OPNsense/IDS/index'
);
$this
->
view
->
pick
(
'OPNsense/IDS/index'
);
}
}
...
...
src/opnsense/mvc/app/controllers/OPNsense/IDS/forms/dialogRule.xml
0 → 100644
View file @
2d5ea554
<form>
<field>
<id>
sid
</id>
<label>
sid
</label>
<type>
info
</type>
</field>
<field>
<id>
gid
</id>
<label>
gid
</label>
<type>
info
</type>
</field>
<field>
<id>
classtype
</id>
<label>
classtype
</label>
<type>
info
</type>
</field>
<field>
<id>
msg
</id>
<label>
alert message
</label>
<type>
info
</type>
</field>
<field>
<id>
reference_html
</id>
<label>
reference
</label>
<type>
info
</type>
</field>
</form>
\ No newline at end of file
src/opnsense/mvc/app/views/OPNsense/IDS/index.volt
View file @
2d5ea554
...
@@ -39,23 +39,31 @@ POSSIBILITY OF SUCH DAMAGE.
...
@@ -39,23 +39,31 @@ POSSIBILITY OF SUCH DAMAGE.
}
}
$("#grid-installedrules").UIBootgrid(
$("#grid-installedrules").UIBootgrid(
{ 'search':'/api/ids/settings/searchinstalledrules',
{ search:'/api/ids/settings/searchinstalledrules',
'options':{
get:'/api/ids/settings/getRuleInfo/',
'requestHandler':addFilters,
set:'/api/ids/settings/setRuleInfo/',
'formatters':{
options:{
"rowtoggle": function (column, row) {
multiSelect:false,
selection:false,
requestHandler:addFilters,
formatters:{
rowtoggle: function (column, row) {
if (parseInt(row[column.id], 2) == 1) {
if (parseInt(row[column.id], 2) == 1) {
return "<span
class=\"fa fa-check-square-o command-toggle\" data-value=\"1\" data-row-id=\"" + row.sid + "\"></span>";
var toggle = "<span style=\"cursor: pointer;\"
class=\"fa fa-check-square-o command-toggle\" data-value=\"1\" data-row-id=\"" + row.sid + "\"></span>";
} else {
} else {
return "<span
class=\"fa fa-square-o command-toggle\" data-value=\"0\" data-row-id=\"" + row.sid + "\"></span>";
var toggle = "<span style=\"cursor: pointer;\"
class=\"fa fa-square-o command-toggle\" data-value=\"0\" data-row-id=\"" + row.sid + "\"></span>";
}
}
toggle += " <button type=\"button\" class=\"btn btn-xs btn-default command-edit\" data-row-id=\"" + row.sid + "\"><span class=\"fa fa-info-circle\"></span></button> ";
return toggle;
}
}
}
}
},
},
'toggle'
:'/api/ids/settings/toggleRule/'
toggle
:'/api/ids/settings/toggleRule/'
}
}
);
);
// list all known classtypes and add to selection box
// list all known classtypes and add to selection box
ajaxGet(url="/api/ids/settings/listRuleClasstypes",sendData={}, callback=function(data, status) {
ajaxGet(url="/api/ids/settings/listRuleClasstypes",sendData={}, callback=function(data, status) {
if (status == "success") {
if (status == "success") {
...
@@ -77,12 +85,12 @@ POSSIBILITY OF SUCH DAMAGE.
...
@@ -77,12 +85,12 @@ POSSIBILITY OF SUCH DAMAGE.
</script>
</script>
<ul class="nav nav-tabs" data-tabs="tabs" id="maintabs">
<ul class="nav nav-tabs" data-tabs="tabs" id="maintabs">
<li class="active"><a data-toggle="tab" href="#
item1">{{ lang._('Item1
') }}</a></li>
<li class="active"><a data-toggle="tab" href="#
rules">{{ lang._('Rules
') }}</a></li>
<li><a data-toggle="tab" href="#item2">{{ lang._('Item2') }}</a></li>
<li><a data-toggle="tab" href="#item2">{{ lang._('Item2') }}</a></li>
<li><a data-toggle="tab" href="#item3">{{ lang._('Item3') }}</a></li>
<li><a data-toggle="tab" href="#item3">{{ lang._('Item3') }}</a></li>
</ul>
</ul>
<div class="tab-content content-box tab-content">
<div class="tab-content content-box tab-content">
<div id="
item1
" class="tab-pane fade in active">
<div id="
rules
" class="tab-pane fade in active">
<div class="bootgrid-header container-fluid">
<div class="bootgrid-header container-fluid">
<div class="row">
<div class="row">
<div class="col-sm-12 actionBar">
<div class="col-sm-12 actionBar">
...
@@ -93,27 +101,18 @@ POSSIBILITY OF SUCH DAMAGE.
...
@@ -93,27 +101,18 @@ POSSIBILITY OF SUCH DAMAGE.
</div>
</div>
<!-- tab page "installed rules" -->
<!-- tab page "installed rules" -->
<table id="grid-installedrules" class="table table-condensed table-hover table-striped table-responsive">
<table id="grid-installedrules" class="table table-condensed table-hover table-striped table-responsive"
data-editDialog="DialogRule"
>
<thead>
<thead>
<tr>
<tr>
<th data-column-id="sid" data-type="number" data-visible="true" data-identifier="true" >sid</th>
<th data-column-id="sid" data-type="number" data-visible="true" data-identifier="true" >sid</th>
<th data-column-id="source" data-type="string">Source</th>
<th data-column-id="source" data-type="string">Source</th>
<th data-column-id="classtype" data-type="string">ClassType</th>
<th data-column-id="classtype" data-type="string">ClassType</th>
<th data-column-id="msg" data-type="string">Message</th>
<th data-column-id="msg" data-type="string">Message</th>
<th data-column-id="enabled" data-formatter="rowtoggle" data-sortable="false">enabled</th>
<th data-column-id="enabled" data-formatter="rowtoggle" data-sortable="false">enabled
/ info
</th>
</tr>
</tr>
</thead>
</thead>
<tbody>
<tbody>
</tbody>
</tbody>
<tfoot>
<tr>
<td></td>
<td>
<button data-action="add" type="button" class="btn btn-xs btn-default"><span class="fa fa-plus"></span></button>
<button data-action="deleteSelected" type="button" class="btn btn-xs btn-default"><span class="fa fa-trash-o"></span></button>
</td>
</tr>
</tfoot>
</table>
</table>
</div>
</div>
<div id="item2" class="tab-pane fade in">
<div id="item2" class="tab-pane fade in">
...
@@ -127,3 +126,5 @@ POSSIBILITY OF SUCH DAMAGE.
...
@@ -127,3 +126,5 @@ POSSIBILITY OF SUCH DAMAGE.
<button class="btn btn-primary" id="reconfigureAct" type="button"><b>Apply</b><i id="reconfigureAct_progress" class=""></i></button>
<button class="btn btn-primary" id="reconfigureAct" type="button"><b>Apply</b><i id="reconfigureAct_progress" class=""></i></button>
</div>
</div>
</div>
</div>
{{ partial("layout_partials/base_dialog",['fields':formDialogRule,'id':'DialogRule','label':'Rule details','hasSaveBtn':'false','msgzone_width':1])}}
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