[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r22806: {arm} Workaround for GETCONF's inability to handle command aliases (in arm/trunk: . interface)
Author: atagar
Date: 2010-08-05 16:11:17 +0000 (Thu, 05 Aug 2010)
New Revision: 22806
Modified:
arm/trunk/TODO
arm/trunk/interface/confPanel.py
Log:
Workaround for GETCONF's inability to handle command aliases.
Fix for 'https://trac.torproject.org/projects/tor/ticket/1798', to be removed when tor is able to handle this input. Also improving warning when unable to parse torrc input. Bug caught by voidzero.
Modified: arm/trunk/TODO
===================================================================
--- arm/trunk/TODO 2010-08-04 12:55:23 UTC (rev 22805)
+++ arm/trunk/TODO 2010-08-05 16:11:17 UTC (rev 22806)
@@ -18,10 +18,12 @@
getInfo("events/names") provides the space-separated listing
- check what events TorCtl can provide us, and give notice if any are
missing
+ - log to file? Is this acceptable? It would allow tor's non-runlevel
+ events to be easily saved.
+ - condense tor/arm log listing types if they're the same
+ Ie, make default "TOR/ARM NOTICE - ERR"
[ ] conf panel
- move torrc validation into util
- - condense tor/arm log listing types if they're the same
- Ie, make default "TOR/ARM NOTICE - ERR"
- fetch text via getinfo rather than reading directly?
conn.get_info("config-text")
[-] conn panel (for version 1.3.8)
@@ -88,8 +90,6 @@
tricky. Putting this off until revising this section.
* conf panel:
- * *never* do reverse dns lookups for first hops (could be resolving via
- tor and hence leaking to the exit)
* torrc validation doesn't catch if parameters are missing
* scrolling in the torrc isn't working properly when comments are stripped
Current method of displaying torrc is pretty stupid (lots of repeated
@@ -101,6 +101,8 @@
torrc parsing when only the key is provided.
* conn panel:
+ * *never* do reverse dns lookups for first hops (could be resolving via
+ tor and hence leaking to the exit)
* revise multikey sort of connections
Currently using a pretty ugly hack. Look at:
http://www.velocityreviews.com/forums/
@@ -193,6 +195,12 @@
This might be provided by tor itself so wait and see...
* unit tests
Primarily for util, for instance 'addfstr' woudl be a good candidate.
+ * show qos stats
+ Take a look at 'linux-tor-prio.sh' to see if any of the stats are
+ available and interesting.
+ * handle mutiple tor instances
+ First multiple tor instances on the same system, then via remote
+ connections too.
* Investigations of other possible tools:
* look into additions to the used apis
- curses (python 2.6 extended?): http://docs.python.org/library/curses.html
@@ -212,9 +220,6 @@
- desc / ns information for our relay
- ps / netstat stats like load, uptime, and connection counts, etc
derived from an idea by StrangeCharm
- * show qos stats
- Take a look at 'linux-tor-prio.sh' to see if any of the stats are
- available and interesting.
* localization
Abstract strings from code and provide on translation portal. Thus far
there hasn't been any requests for this.
Modified: arm/trunk/interface/confPanel.py
===================================================================
--- arm/trunk/interface/confPanel.py 2010-08-04 12:55:23 UTC (rev 22805)
+++ arm/trunk/interface/confPanel.py 2010-08-05 16:11:17 UTC (rev 22806)
@@ -25,6 +25,34 @@
LABEL_GB = ["gb", "gbyte", "gbytes", "gigabyte", "gigabytes"]
LABEL_TB = ["tb", "terabyte", "terabytes"]
+# GETCONF aliases (from the _option_abbrevs struct of src/or/config.c)
+# fix for: https://trac.torproject.org/projects/tor/ticket/1798
+# TODO: remove if/when fixed in tor
+CONF_ALIASES = {"l": "Log",
+ "AllowUnverifiedNodes": "AllowInvalidNodes",
+ "AutomapHostSuffixes": "AutomapHostsSuffixes",
+ "AutomapHostOnResolve": "AutomapHostsOnResolve",
+ "BandwidthRateBytes": "BandwidthRate",
+ "BandwidthBurstBytes": "BandwidthBurst",
+ "DirFetchPostPeriod": "StatusFetchPeriod",
+ "MaxConn": "ConnLimit",
+ "ORBindAddress": "ORListenAddress",
+ "DirBindAddress": "DirListenAddress",
+ "SocksBindAddress": "SocksListenAddress",
+ "UseHelperNodes": "UseEntryGuards",
+ "NumHelperNodes": "NumEntryGuards",
+ "UseEntryNodes": "UseEntryGuards",
+ "NumEntryNodes": "NumEntryGuards",
+ "ResolvConf": "ServerDNSResolvConfFile",
+ "SearchDomains": "ServerDNSSearchDomains",
+ "ServerDNSAllowBrokenResolvConf": "ServerDNSAllowBrokenConfig",
+ "PreferTunnelledDirConns": "PreferTunneledDirConns",
+ "BridgeAuthoritativeDirectory": "BridgeAuthoritativeDir",
+ "HashedControlPassword": "__HashedControlSessionPassword",
+ "StrictEntryNodes": "StrictNodes",
+ "StrictExitNodes": "StrictNodes"}
+
+
# time modifiers allowed by config.c
LABEL_MIN = ["minute", "minutes"]
LABEL_HOUR = ["hour", "hours"]
@@ -82,6 +110,9 @@
if argEnd == -1: argEnd = len(lineText)
command, argument = lineText[:ctlEnd], lineText[ctlEnd:argEnd].strip()
+ # replace aliases with the internal representation of the command
+ if command in CONF_ALIASES: command = CONF_ALIASES[command]
+
# expands value if it's a size or time
comp = argument.strip().lower().split(" ")
if len(comp) > 1:
@@ -146,7 +177,7 @@
if not entry in actualValues:
self.corrections[lineNumber + 1] = ", ".join(actualValues)
except (socket.error, TorCtl.ErrorReply, TorCtl.TorCtlClosed):
- if logErrors: log.log(log.WARN, "Unable to validate torrc")
+ if logErrors: log.log(log.WARN, "Unable to validate line %i of the torrc: %s" % (lineNumber + 1, lineText))
# logs issues that arose
if self.irrelevantLines and logErrors: