mirror of
https://github.com/opnsense/plugins.git
synced 2026-05-28 04:34:15 -04:00
security/tor: merge version0.2 from master
This commit is contained in:
parent
4e61f8cec2
commit
ecd25348b6
8 changed files with 121 additions and 9 deletions
|
|
@ -1,5 +1,5 @@
|
|||
PLUGIN_NAME= tor
|
||||
PLUGIN_VERSION= 0.1
|
||||
PLUGIN_VERSION= 0.2
|
||||
PLUGIN_COMMENT= The Onion Router
|
||||
PLUGIN_DEPENDS= tor
|
||||
PLUGIN_MAINTAINER= franz.fabian.94@gmail.com
|
||||
|
|
|
|||
9
security/tor/pkg-descr
Normal file
9
security/tor/pkg-descr
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
Tor is a connection-based low-latency anonymous communication system which
|
||||
addresses many flaws in the original onion routing design.
|
||||
|
||||
Tor is a toolset for a wide range of organizations and people that
|
||||
want to improve their safety and security on the Internet. Using
|
||||
Tor can help you anonymize web browsing and publishing, instant
|
||||
messaging, IRC, SSH, and more. Tor also provides a platform on which
|
||||
software developers can build new applications with built-in
|
||||
anonymity, safety, and privacy features.
|
||||
|
|
@ -148,7 +148,7 @@ class ServiceController extends ApiControllerBase
|
|||
$backend->configdRun('template reload OPNsense/Tor');
|
||||
|
||||
// (re)start daemon
|
||||
if ($general->enabled->__toString() == 1) {
|
||||
if ($general->enabled->__toString() == '1') {
|
||||
$this->startAction();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -48,4 +48,10 @@ class IndexController extends \OPNsense\Base\IndexController
|
|||
$this->view->exitpolicy = $this->getForm("acl_exitpolicy");
|
||||
$this->view->pick('OPNsense/Tor/general');
|
||||
}
|
||||
|
||||
public function infoAction()
|
||||
{
|
||||
$this->view->title = gettext("The Onion Router - Information");
|
||||
$this->view->pick('OPNsense/Tor/info');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
<Services>
|
||||
<tor VisibleName="Tor" cssClass="fa fa-bolt fa-fw">
|
||||
<configuration VisibleName="Configuration" url="/ui/tor/" />
|
||||
<info VisibleName="Information" url="/ui/tor/index/info" />
|
||||
</tor>
|
||||
</Services>
|
||||
</menu>
|
||||
|
|
|
|||
|
|
@ -30,6 +30,20 @@
|
|||
|
||||
<script type="text/javascript">
|
||||
|
||||
function tor_update_status() {
|
||||
ajaxCall(url="/api/tor/service/status", sendData={}, callback=function(data,status) {
|
||||
updateServiceStatusUI(data['status']);
|
||||
});
|
||||
}
|
||||
|
||||
function reload_handler() {
|
||||
$(".reloadAct_progress").addClass("fa-spin");
|
||||
ajaxCall(url="/api/tor/service/reconfigure", sendData={}, callback=function(data,status) {
|
||||
tor_update_status();
|
||||
$(".reloadAct_progress").removeClass("fa-spin");
|
||||
});
|
||||
}
|
||||
|
||||
$( document ).ready(function() {
|
||||
var data_get_map = {
|
||||
'general': '/api/tor/general/get',
|
||||
|
|
@ -39,9 +53,6 @@ $( document ).ready(function() {
|
|||
formatTokenizersUI();
|
||||
$('select.dropdownstyle').selectpicker('refresh');
|
||||
});
|
||||
ajaxCall(url="/api/tor/service/status", sendData={}, callback=function(data,status) {
|
||||
updateServiceStatusUI(data['result']);
|
||||
});
|
||||
|
||||
// link save button to API set action
|
||||
[
|
||||
|
|
@ -51,15 +62,19 @@ $( document ).ready(function() {
|
|||
$(cfg.selector).click(function(){
|
||||
saveFormToEndpoint(url=cfg.endpoint, formid=cfg.formid,callback_ok=function(){
|
||||
$(cfg.selector + " .saveAct_progress").addClass("fa fa-spinner fa-pulse");
|
||||
ajaxCall(url="/api/tor/service/restart", sendData={}, callback=function(data,status) {
|
||||
ajaxCall(url="/api/tor/service/status", sendData={}, callback=function(data,status) {
|
||||
updateServiceStatusUI(data['result']);
|
||||
});
|
||||
ajaxCall(url="/api/tor/service/reconfigure", sendData={}, callback=function(data,status) {
|
||||
tor_update_status();
|
||||
$(cfg.selector + " .saveAct_progress").removeClass("fa fa-spinner fa-pulse");
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
tor_update_status();
|
||||
|
||||
/* allow a user to manually reload the service (for forms which do not do it automatically) */
|
||||
$('.reload_btn').click(reload_handler);
|
||||
|
||||
$("#grid-hidden").UIBootgrid(
|
||||
{ 'search':'/api/tor/hiddenservice/searchservice',
|
||||
'get':'/api/tor/hiddenservice/getservice/',
|
||||
|
|
@ -140,6 +155,7 @@ $( document ).ready(function() {
|
|||
<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> -->
|
||||
<button type="button" class="btn btn-xs reload_btn btn-primary"><span class="fa fa-refresh reloadAct_progress"></span> {{ lang._('Reload Service') }}</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
|
|
@ -163,6 +179,7 @@ $( document ).ready(function() {
|
|||
<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> -->
|
||||
<button type="button" class="btn btn-xs reload_btn btn-primary"><span class="fa fa-refresh reloadAct_progress"></span> {{ lang._('Reload Service') }}</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
|
|
@ -189,6 +206,7 @@ $( document ).ready(function() {
|
|||
<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> -->
|
||||
<button type="button" class="btn btn-xs reload_btn btn-primary"><span class="fa fa-refresh reloadAct_progress"></span> {{ lang._('Reload Service') }}</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
|
|
@ -227,6 +245,7 @@ $( document ).ready(function() {
|
|||
<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> -->
|
||||
<button type="button" class="btn btn-xs reload_btn btn-primary"><span class="fa fa-refresh reloadAct_progress"></span> {{ lang._('Reload Service') }}</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,74 @@
|
|||
{#
|
||||
|
||||
Copyright (C) 2017 Fabian Franz
|
||||
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.
|
||||
|
||||
|
||||
#}
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
function tor_update_status() {
|
||||
ajaxCall(url="/api/tor/service/status", sendData={}, callback=function(data, status) {
|
||||
updateServiceStatusUI(data['status']);
|
||||
});
|
||||
}
|
||||
|
||||
$( document ).ready(function() {
|
||||
|
||||
tor_update_status();
|
||||
ajaxCall(url="/api/tor/service/get_hidden_services", sendData={}, callback=function(data, status) {
|
||||
data = data['response'];
|
||||
var tmp = '';
|
||||
for (var name in data) {
|
||||
if (data.hasOwnProperty(name)) {
|
||||
tmp += '<tr><td>' + name + '</td><td>' + data[name] + '</td></tr>';
|
||||
}
|
||||
}
|
||||
|
||||
$("#hiddenservicetbdy").html(tmp);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
<ul class="nav nav-tabs" data-tabs="tabs" id="maintabs">
|
||||
<li class="active"><a data-toggle="tab" href="#hiddennames">{{ lang._('Hidden Service Names') }}</a></li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content content-box tab-content" style="padding-bottom: 1.5em;">
|
||||
<div id="hiddennames" class="tab-pane fade in active">
|
||||
<table style="margin: 10px;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ lang._('Hidden Service Name') }}</th>
|
||||
<th>{{ lang._('Hostname') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="hiddenservicetbdy"></tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -3,5 +3,8 @@ mkdir -p /var/db/tor
|
|||
mkdir -p /var/log/tor
|
||||
mkdir -p /var/run/tor
|
||||
|
||||
chown _tor:_tor /var/db/tor
|
||||
chmod 700 /var/db/tor
|
||||
|
||||
# required to access the pf device for nat
|
||||
/usr/sbin/pw groupmod proxy -m _tor
|
||||
|
|
|
|||
Loading…
Reference in a new issue