Tor: add info page (#283)

* Tor: add info page

* Add info page to menu

* set permission for /var/db/tor

* Tor: just make sure it has the right owner

* Tor: set permission to 700
This commit is contained in:
Fabian Franz
2017-09-24 10:55:33 +02:00
committed by GitHub
parent 63255ef187
commit e37f7e3d71
4 changed files with 84 additions and 0 deletions
@@ -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>
@@ -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