mirror of
https://github.com/opnsense/plugins.git
synced 2026-05-28 04:34:15 -04:00
security/tor: fix control socket issue
This commit is contained in:
parent
c1efeb9634
commit
b4dae10a90
3 changed files with 15 additions and 3 deletions
|
|
@ -1,5 +1,5 @@
|
|||
PLUGIN_NAME= tor
|
||||
PLUGIN_VERSION= 1.2
|
||||
PLUGIN_VERSION= 1.3
|
||||
PLUGIN_COMMENT= The Onion Router
|
||||
PLUGIN_DEPENDS= tor ruby
|
||||
PLUGIN_MAINTAINER= franz.fabian.94@gmail.com
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
</socks_listen_port>
|
||||
<control_port type="IntegerField">
|
||||
<default>9051</default>
|
||||
<MinimumValue>0</MinimumValue>
|
||||
<MinimumValue>1</MinimumValue>
|
||||
<Required>N</Required>
|
||||
<MaximumValue>65535</MaximumValue>
|
||||
<ValidationMessage>A valid Port number must be specified.</ValidationMessage>
|
||||
|
|
|
|||
|
|
@ -36,11 +36,23 @@ $TOR_DEBUG = false
|
|||
|
||||
config = REXML::Document.new(File.new("/conf/config.xml"))
|
||||
$TOR_PASSWORD = config.elements['opnsense/OPNsense/tor/general/control_port_password'].text
|
||||
$TOR_CONTROL_PORT = 9051
|
||||
if port = config.elements['opnsense/OPNsense/tor/general/control_port']&.text&.to_i
|
||||
if port > 0
|
||||
$TOR_CONTROL_PORT = port
|
||||
else
|
||||
puts '{"error":"invalid control port found"}'
|
||||
exit
|
||||
end
|
||||
else
|
||||
puts '{"error":"no control port found"}'
|
||||
exit
|
||||
end
|
||||
|
||||
class TorCTL
|
||||
|
||||
def initialize
|
||||
@tor = TCPSocket.new("127.0.0.1", 9051)
|
||||
@tor = TCPSocket.new("127.0.0.1", $TOR_CONTROL_PORT)
|
||||
send_query("AUTHENTICATE \"#{$TOR_PASSWORD}\"")
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue