-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Sergey Ponomarev <stokito@gmail.com>
- Loading branch information
Showing
4 changed files
with
130 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# See /LICENSE for more information. | ||
# This is free software, licensed under the GNU General Public License v2. | ||
|
||
include $(TOPDIR)/rules.mk | ||
|
||
LUCI_TITLE:=LuCI app to configure Tor | ||
LUCI_DEPENDS:=+luci-base | ||
|
||
include ../../luci.mk | ||
|
||
# call BuildPackage - OpenWrt buildroot signature |
76 changes: 76 additions & 0 deletions
76
applications/luci-app-tor/htdocs/luci-static/resources/view/tor/tor-hs.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
'use strict'; | ||
'require view'; | ||
'require form'; | ||
'require rpc'; | ||
'require uci'; | ||
|
||
var callTorHsList = rpc.declare({ | ||
object: 'tor_rpcd.sh', | ||
method: 'list-hs', | ||
}); | ||
|
||
|
||
return view.extend({ | ||
load: function () { | ||
return Promise.all([ | ||
L.resolveDefault(callTorHsList(), {}), | ||
]); | ||
}, | ||
|
||
render: function(data) { | ||
var hsList = data[0]["hs-list"] | ||
var hsMap = new Map() | ||
hsList.forEach(function (hs) { | ||
hsMap.set(hs.name, hs.hostname); | ||
}); | ||
|
||
var m, s, o; | ||
|
||
m = new form.Map('tor-hs', _('Tor Hidden Services'), | ||
_('Tor Hidden Services are proxy tunnels to your local website, SSH and other services')); | ||
|
||
s = m.section(form.GridSection, 'hidden-service', _('Tor Hidden Services')); | ||
s.anonymous = true; | ||
s.addremove = true; | ||
s.nodescriptions = true; | ||
|
||
o = s.option(form.Flag, 'Enabled', _('Enabled'), ''); | ||
o.default = '1'; | ||
o.rmempty = false; | ||
|
||
o = s.option(form.Value, 'Name', _('Name'), ''); | ||
o.datatype = "uciname"; | ||
o.rmempty = false; | ||
|
||
o = s.option(form.DummyValue, '_Hostname', _('Hostname'), 'Onion domain'); | ||
o.modalonly = false; | ||
o.rawhtml = true; | ||
o.textvalue = function(section_id) { | ||
var name = uci.get('tor-hs', section_id, 'Name'); | ||
if (!name) | ||
return ''; | ||
var hostname = hsMap.get(name); | ||
if (!hostname) | ||
return ''; | ||
return '<a href="http://' + hostname + '" target="_blank" rel="noreferrer">' + _('Link') + '</a>'; | ||
}; | ||
|
||
o = s.option(form.Value, 'Description', _('Description'), ''); | ||
o.modalonly = true; | ||
|
||
o = s.option(form.Value, 'IPv4', _('Destination IP Address'), _('Traffic will be forwarded to the IP address')); | ||
o.datatype = "ip"; | ||
o.default = "127.0.0.1"; | ||
|
||
o = s.option(form.DynamicList, 'PublicLocalPort', _('Public to Local Ports'), | ||
_('Public;Local Port')); | ||
o.placeholder = '2222;22'; | ||
o.datatype = "list(string)"; //TODO port | ||
o.rmempty = false; | ||
|
||
o = s.option(form.Value, 'HookScript', _('Hook Script'), _('Path to script which is executed after starting tor-hs. Script is executed with paramters `--update-onion hostname`. Hostname is replaced with Onion v3 address for given hidden service.')); | ||
o.modalonly = true; | ||
|
||
return m.render(); | ||
}, | ||
}); |
13 changes: 13 additions & 0 deletions
13
applications/luci-app-tor/root/usr/share/luci/menu.d/luci-app-tor.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"admin/services/tor/": { | ||
"title": "Tor Hidden Services", | ||
"order": 60, | ||
"action": { | ||
"type": "view", | ||
"path": "tor/tor-hs" | ||
}, | ||
"depends": { | ||
"acl": [ "luci-app-tor" ] | ||
} | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
applications/luci-app-tor/root/usr/share/rpcd/acl.d/luci-app-tor.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"luci-app-tor": { | ||
"description": "Grant UCI access to LuCI app Tor", | ||
"read": { | ||
"ubus": { | ||
"uci": [ | ||
"get" | ||
], | ||
"tor_rpcd.sh": [ | ||
"list-hs" | ||
] | ||
}, | ||
"uci": [ | ||
"tor", | ||
"tor-hs" | ||
] | ||
}, | ||
"write": { | ||
"ubus": { | ||
"uci": [ | ||
"set", "commit" | ||
] | ||
}, | ||
"uci": [ | ||
"tor", | ||
"tor-hs" | ||
] | ||
} | ||
} | ||
} |