Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

security/maltrail: new plugin #1257

Merged
merged 39 commits into from
Mar 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
8deb541
initial commit
mimugmail Mar 10, 2019
97a931f
Update server.volt
mimugmail Mar 10, 2019
33be9ba
Update maltrailserver.conf
mimugmail Mar 10, 2019
9f3bf4a
Update server.volt
mimugmail Mar 10, 2019
5a42052
Rename opnsense-mailtrailsensor to opnsense-maltrailsensor
mimugmail Mar 10, 2019
494e2e0
Rename opnsense-mailtrailserver to opnsense-maltrailserver
mimugmail Mar 10, 2019
629b980
Update opnsense-maltrailserver
mimugmail Mar 10, 2019
f77811b
Update opnsense-maltrailsensor
mimugmail Mar 10, 2019
d566518
Update Makefile
mimugmail Mar 11, 2019
39730c7
Rename maltrailsensor.conf to maltrailsensor
mimugmail Mar 11, 2019
93102d6
Rename maltrailserver.conf to maltrailserver
mimugmail Mar 11, 2019
374df89
Update maltrail.conf
mimugmail Mar 11, 2019
73c757f
fix folder
mimugmail Mar 11, 2019
524cd89
updates
mimugmail Mar 13, 2019
22e23ed
fix rc
mimugmail Mar 13, 2019
9a5d5a7
fix sensor
mimugmail Mar 13, 2019
dc616d0
fix volt
mimugmail Mar 13, 2019
449383c
Update maltrail.conf
mimugmail Mar 14, 2019
0f8274b
add password
mimugmail Mar 14, 2019
5f4e888
Merge branch 'mt' of https://github.com/mimugmail/plugins into mt
mimugmail Mar 14, 2019
3ac6949
fix typo
mimugmail Mar 14, 2019
d70b2fa
Update security/maltrail/src/opnsense/mvc/app/views/OPNsense/Maltrail…
fabianfrz Mar 15, 2019
e2a8e05
Update setup.sh
mimugmail Mar 15, 2019
0847e42
Update general.xml
mimugmail Mar 19, 2019
0ad077d
Allow to listen on all traffic
mimugmail Mar 19, 2019
c0e323a
Update general.xml
mimugmail Mar 19, 2019
70bae86
copyright style
mimugmail Mar 19, 2019
184bd18
Update security/maltrail/src/etc/rc.d/opnsense-maltrailsensor
fichtner Mar 19, 2019
e28e5a8
Update security/maltrail/src/etc/rc.d/opnsense-maltrailserver
fichtner Mar 19, 2019
806f996
Update security/maltrail/src/opnsense/mvc/app/controllers/OPNsense/Ma…
fichtner Mar 19, 2019
82a42f8
fix copyright style
mimugmail Mar 19, 2019
5bb5284
Update general.xml
mimugmail Mar 19, 2019
94ea753
Update opnsense-maltrailsensor
mimugmail Mar 19, 2019
21e16ae
Update opnsense-maltrailserver
mimugmail Mar 19, 2019
783f4b6
Update maltrailsensor
mimugmail Mar 19, 2019
9f805e1
Update maltrailserver
mimugmail Mar 19, 2019
9780cbc
Update opnsense-maltrailsensor
mimugmail Mar 19, 2019
96d2e0c
Update security/maltrail/src/etc/rc.d/opnsense-maltrailserver
fichtner Mar 19, 2019
9954b9c
Update opnsense-maltrailserver
mimugmail Mar 19, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions security/maltrail/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
PLUGIN_NAME= maltrail
PLUGIN_VERSION= 0.1
PLUGIN_COMMENT= Malicious traffic detection system
PLUGIN_DEPENDS= maltrail
PLUGIN_MAINTAINER= m.muenz@gmail.com
PLUGIN_DEVEL= yes

.include "../../Mk/plugins.mk"
8 changes: 8 additions & 0 deletions security/maltrail/pkg-descr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Maltrail is a malicious traffic detection system, utilizing publicly
available (black)lists containing malicious and/or generally suspicious
trails, along with static trails compiled from various AV reports and
custom user defined lists, where trail can be anything from domain name,
URL, IP address or HTTP User-Agent header value. Also, it uses advanced
heuristic mechanisms that can help in discovery of unknown threats.

WWW: https://github.com/stamparm/maltrail
64 changes: 64 additions & 0 deletions security/maltrail/src/etc/inc/plugins.inc.d/maltrail.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?php

/**
* Copyright (C) 2019 Michael Muenz <m.muenz@gmail.com>
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/

function maltrail_services()
{
global $config;

$services = array();

if (isset($config['OPNsense']['maltrail']['general']['enabled']) && $config['OPNsense']['maltrail']['general']['enabled'] == 1) {
$services[] = array(
'description' => gettext('maltrail sensor'),
'configd' => array(
'restart' => array('maltrailsensor restart'),
'start' => array('maltrailsensor start'),
'stop' => array('maltrailsensor stop'),
),
'name' => 'maltrailsensor',
'pidfile' => '/var/run/maltrailsensor.pid'
);
}

if (isset($config['OPNsense']['maltrail']['server']['enabled']) && $config['OPNsense']['maltrail']['server']['enabled'] == 1) {
$services[] = array(
'description' => gettext('maltrail server'),
'configd' => array(
'restart' => array('maltrailserver restart'),
'start' => array('maltrailserver start'),
'stop' => array('maltrailserver stop'),
),
'name' => 'maltrailserver',
'pidfile' => '/var/run/maltrailserver.pid'
);
}

return $services;
}
23 changes: 23 additions & 0 deletions security/maltrail/src/etc/rc.d/opnsense-maltrailsensor
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: opnsense-maltrailsensor
# REQUIRE: SERVERS
# KEYWORD: shutdown
#

. /etc/rc.subr

name=maltrailsensor

rcvar=maltrailsensor_enable
pidfile=/var/run/${name}.pid
command=/usr/sbin/daemon
command_args="-f -P /var/run/maltrailsensor.pid python2.7 /usr/local/share/maltrail/sensor.py"

load_rc_config opnsense-maltrailsensor

: ${maltrailsensor_enable="NO"}

run_rc_command $1
23 changes: 23 additions & 0 deletions security/maltrail/src/etc/rc.d/opnsense-maltrailserver
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: opnsense-maltrailserver
# REQUIRE: SERVERS
# KEYWORD: shutdown
#

. /etc/rc.subr

name=maltrailserver

rcvar=maltrailserver_enable
pidfile=/var/run/${name}.pid
command=/usr/sbin/daemon
command_args="-f -P /var/run/maltrailserver.pid python2.7 /usr/local/share/maltrail/server.py"

load_rc_config opnsense-maltrailserver

: ${maltrailserver_enable="NO"}

run_rc_command $1
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

/*
* Copyright (C) 2019 Michael Muenz <m.muenz@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/

namespace OPNsense\Maltrail\Api;

use OPNsense\Base\ApiMutableModelControllerBase;

class GeneralController extends ApiMutableModelControllerBase
{
protected static $internalModelClass = '\OPNsense\Maltrail\General';
protected static $internalModelName = 'general';
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

/*
* Copyright (C) 2019 Michael Muenz <m.muenz@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/

namespace OPNsense\Maltrail\Api;

use OPNsense\Base\ApiMutableModelControllerBase;

class SensorController extends ApiMutableModelControllerBase
{
protected static $internalModelClass = '\OPNsense\Maltrail\Sensor';
protected static $internalModelName = 'sensor';
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

/*
* Copyright (C) 2019 Michael Muenz <m.muenz@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/

namespace OPNsense\Maltrail\Api;

use OPNsense\Base\ApiMutableModelControllerBase;

class ServerController extends ApiMutableModelControllerBase
{
protected static $internalModelClass = '\OPNsense\Maltrail\Server';
protected static $internalModelName = 'server';
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

/*
* Copyright (C) 2019 Michael Muenz <m.muenz@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/

namespace OPNsense\Maltrail\Api;

use OPNsense\Base\ApiMutableServiceControllerBase;

class ServerserviceController extends ApiMutableServiceControllerBase
{
protected static $internalServiceClass = '\OPNsense\Maltrail\Server';
protected static $internalServiceTemplate = 'OPNsense/Maltrail';
protected static $internalServiceEnabled = 'enabled';
protected static $internalServiceName = 'maltrailserver';
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

/*
* Copyright (C) 2019 Michael Muenz <m.muenz@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/

namespace OPNsense\Maltrail\Api;

use OPNsense\Base\ApiMutableServiceControllerBase;

class ServiceController extends ApiMutableServiceControllerBase
{
protected static $internalServiceClass = '\OPNsense\Maltrail\Sensor';
protected static $internalServiceTemplate = 'OPNsense/Maltrail';
protected static $internalServiceEnabled = 'enabled';
protected static $internalServiceName = 'maltrailsensor';
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

/**
* Copyright (C) 2019 Michael Muenz <m.muenz@gmail.com>
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/

namespace OPNsense\Maltrail;

class GeneralController extends \OPNsense\Base\IndexController
{
public function indexAction()
{
$this->view->generalForm = $this->getForm("general");
$this->view->pick('OPNsense/Maltrail/general');
}
}