[or-cvs] r24064: {arm} Hotfix for the 1.4.1 release: change: including platform, py (in arm/release: . src src/util)
Damian Johnson
atagar1 at gmail.com
Wed Jan 12 04:56:09 UTC 2011
Author: atagar
Date: 2011-01-12 04:56:09 +0000 (Wed, 12 Jan 2011)
New Revision: 24064
Modified:
arm/release/
arm/release/ChangeLog
arm/release/TODO
arm/release/armrc.sample
arm/release/src/settings.cfg
arm/release/src/starter.py
arm/release/src/util/sysTools.py
arm/release/src/util/uiTools.py
arm/release/src/version.py
Log:
Hotfix for the 1.4.1 release:
change: including platform, python version, and arm/tor configurations in debug dumps
change: adding summaries for server config options
fix: properly parse the ps field when displaying decimal seconds (patch by Fabian)
fix: error when initial recource lookups fail (caught by Trystero)
Property changes on: arm/release
___________________________________________________________________
Modified: svn:mergeinfo
- /arm/trunk:22227-24053
+ /arm/trunk:22227-24063
Modified: arm/release/ChangeLog
===================================================================
--- arm/release/ChangeLog 2011-01-12 04:48:18 UTC (rev 24063)
+++ arm/release/ChangeLog 2011-01-12 04:56:09 UTC (rev 24064)
@@ -1,6 +1,6 @@
CHANGE LOG
-1/7/11 - version 1.4.1
+1/7/11 - version 1.4.1 (r24054)
Platform specific enhancements including BSD compatibility and vastly improved performance on Linux.
* added: querying the proc contents when able for tor resource and connection samplings to *greatly* reduce arm's resource usage (many thanks to psutil)
Modified: arm/release/TODO
===================================================================
--- arm/release/TODO 2011-01-12 04:48:18 UTC (rev 24063)
+++ arm/release/TODO 2011-01-12 04:56:09 UTC (rev 24064)
@@ -34,13 +34,12 @@
local connection, ie:
myInternal --> myExternal --> foreign
idea and initial patch by Fabian Keil
- * expand dump (--debug) information
- - os and python versions
- - arm and tor configs (scrubbing private attributes)
+ - give a warning if family relays don't name us
* classify config options as useful (defaultly shown), standard, and
deprecated (configured to be hidden by default)
* check tor source for deprecated options like 'group' (are they
ignored? idea is thanks to NightMonkey)
+ * elaborate on the password prompt (suggestion by weasel)
* release prep
* pylint --indent-string=" " --disable=C,R interface/foo.py | less
* double check __init__.py and README for added or removed files
@@ -94,6 +93,7 @@
- Bugs
* The default resolver isn't configurable.
+ * When saving the config the Log entry should be filtered out if unnecessary.
* The config write dialog (ie, the one for saving the config) has its a
misaligned border when it's smaller than the top detail section.
* The arm header panel doesn't properly reflect when the ip address
@@ -220,7 +220,8 @@
something storing the descriptions
* handle mutiple tor instances
* screen style (dialog for switching between instances)
- * extra window with whatever stats can be aggregated over all instances
+ * extra window with whatever stats can be aggregated over all instances,
+ or a config option to aggregate stats for bw, resource usage, etc
* option to save the current settings to the config
* provide warning at startup if the armrc doesn't exist, with instructions
for generating it
Modified: arm/release/armrc.sample
===================================================================
--- arm/release/armrc.sample 2011-01-12 04:48:18 UTC (rev 24063)
+++ arm/release/armrc.sample 2011-01-12 04:56:09 UTC (rev 24064)
@@ -227,4 +227,5 @@
log.stats.failedProcResolution DEBUG
log.stats.procResolutionFailover INFO
log.stats.failedPsResolution INFO
+log.savingDebugLog NOTICE
Modified: arm/release/src/settings.cfg
===================================================================
--- arm/release/src/settings.cfg 2011-01-12 04:48:18 UTC (rev 24063)
+++ arm/release/src/settings.cfg 2011-01-12 04:56:09 UTC (rev 24064)
@@ -111,6 +111,40 @@
config.summary.RejectPlaintextPorts Prevents connections on risky ports
config.summary.AllowSingleHopCircuits Makes use of single hop exits if able
+# Server Config Options
+config.summary.Address Overwrites address others will use to reach this relay
+config.summary.AllowSingleHopExits Toggles permitting use of this relay as a single hop proxy
+config.summary.AssumeReachable Skips reachability test at startup
+config.summary.BridgeRelay Act as a bridge
+config.summary.ContactInfo Contact information for this relay
+config.summary.ExitPolicy Traffic destinations that can exit from this relay
+config.summary.ExitPolicyRejectPrivate Prevent exiting connection on the local network
+config.summary.MaxOnionsPending Decryption queue size
+config.summary.MyFamily Other relays this operator administers
+config.summary.Nickname Identifier for this relay
+config.summary.NumCPUs Number of processes spawned for decryption
+config.summary.ORPort Port used to accept relay traffic
+config.summary.ORListenAddress Address for relay connections
+config.summary.PublishServerDescriptor Types of descriptors published
+config.summary.ShutdownWaitLength Delay before quitting after receiving a SIGINT signal
+config.summary.AccountingMax Amount of traffic before hibernating
+config.summary.AccountingStart Duration of an accounting period
+config.summary.RefuseUnknownExits Prevents relays not in the consensus from using us as an exit
+config.summary.ServerDNSResolvConfFile Overriding resolver config for DNS queries we provide
+config.summary.ServerDNSAllowBrokenConfig Toggles if we persist despite configuration parsing errors or not
+config.summary.ServerDNSSearchDomains Toggles if our DNS queries search for addresses in the local domain
+config.summary.ServerDNSDetectHijacking Toggles testing for DNS hijacking
+config.summary.ServerDNSTestAddresses Addresses to test to see if valid DNS queries are being hijacked
+config.summary.ServerDNSAllowNonRFC953Hostnames Toggles if we reject DNS queries with invalid characters
+config.summary.BridgeRecordUsageByCountry Tracks geoip information on bridge usage
+config.summary.ServerDNSRandomizeCase Toggles DNS query case randomization
+config.summary.GeoIPFile Path to file containing geoip information
+config.summary.CellStatistics Toggles storing circuit queue duration to disk
+config.summary.DirReqStatistics Toggles storing network status counts and performance to disk
+config.summary.EntryStatistics Toggles storing client connection counts to disk
+config.summary.ExitPortStatistics Toggles storing traffic and port usage data to disk
+config.summary.ExtraInfoStatistics Publishes statistic data in the extra-info documents
+
# Snippets from common log messages
# These are static bits of log messages, used to determine when entries with
# dynamic content (hostnames, numbers, etc) are the same. If this matches the
Modified: arm/release/src/starter.py
===================================================================
--- arm/release/src/starter.py 2011-01-12 04:48:18 UTC (rev 24063)
+++ arm/release/src/starter.py 2011-01-12 04:56:09 UTC (rev 24064)
@@ -11,6 +11,7 @@
import time
import getopt
import socket
+import platform
import version
import interface.controller
@@ -44,7 +45,8 @@
"log.configDescriptions.persistance.loadSuccess": util.log.INFO,
"log.configDescriptions.persistance.loadFailed": util.log.INFO,
"log.configDescriptions.persistance.saveSuccess": util.log.INFO,
- "log.configDescriptions.persistance.saveFailed": util.log.NOTICE}
+ "log.configDescriptions.persistance.saveFailed": util.log.NOTICE,
+ "log.savingDebugLog": util.log.NOTICE}
OPT = "i:c:dbe:vh"
OPT_EXPANDED = ["interface=", "config=", "debug", "blind", "event=", "version", "help"]
@@ -83,6 +85,9 @@
STANDARD_CFG_LOAD_FAILED_MSG = "Failed to load configuration (using defaults): \"%s\""
STANDARD_CFG_NOT_FOUND_MSG = "No configuration found at '%s', using defaults"
+# torrc entries that are scrubbed when dumping
+PRIVATE_TORRC_ENTRIES = ["HashedControlPassword", "Bridge", "HiddenServiceDir"]
+
def isValidIpAddr(ipStr):
"""
Returns true if input is a valid IPv4 address, false otherwise.
@@ -179,6 +184,47 @@
msg = DESC_INTERNAL_LOAD_FAILED_MSG % util.sysTools.getFileErrorMsg(exc)
util.log.log(CONFIG["log.configDescriptions.internalLoadFailed"], msg)
+def _dumpConfig():
+ """
+ Dumps the current arm and tor configurations at the DEBUG runlevel. This
+ attempts to scrub private information, but naturally the user should double
+ check that I didn't miss anything.
+ """
+
+ config = util.conf.getConfig("arm")
+ conn = util.torTools.getConn()
+
+ # dumps arm's configuration
+ armConfigEntry = ""
+ armConfigKeys = list(config.getKeys())
+ armConfigKeys.sort()
+
+ for configKey in armConfigKeys:
+ # Skips some config entries that are loaded by default. This fetches
+ # the config values directly to avoid misflagging them as being used by
+ # arm.
+
+ if not configKey.startswith("config.summary.") and not configKey.startswith("torrc.") and not configKey.startswith("msg."):
+ armConfigEntry += "%s -> %s\n" % (configKey, config.contents[configKey])
+
+ if armConfigEntry: armConfigEntry = "Arm Configuration:\n%s" % armConfigEntry
+ else: armConfigEntry = "Arm Configuration: None"
+
+ # dumps tor's version and configuration
+ torConfigEntry = "Tor (%s) Configuration:\n" % conn.getInfo("version")
+
+ for line in conn.getInfo("config-text").split("\n"):
+ if " " in line: key, value = line.split(" ", 1)
+ else: key, value = line, ""
+
+ if key in PRIVATE_TORRC_ENTRIES:
+ torConfigEntry += "%s <scrubbed>\n" % key
+ else:
+ torConfigEntry += "%s %s\n" % (key, value)
+
+ util.log.log(util.log.DEBUG, armConfigEntry.strip())
+ util.log.log(util.log.DEBUG, torConfigEntry.strip())
+
if __name__ == '__main__':
startTime = time.time()
param = dict([(key, None) for key in CONFIG.keys()])
@@ -230,8 +276,10 @@
currentTime = time.localtime()
timeLabel = time.strftime("%H:%M:%S %m/%d/%Y (%Z)", currentTime)
initMsg = "Arm %s Debug Dump, %s" % (version.VERSION, timeLabel)
+ pythonVersionLabel = "Python Version: %s" % (".".join([str(arg) for arg in sys.version_info[:3]]))
+ osLabel = "Platform: %s (%s)" % (platform.system(), " ".join(platform.dist()))
- util.log.DUMP_FILE.write("%s\n%s\n" % (initMsg, "-" * len(initMsg)))
+ util.log.DUMP_FILE.write("%s\n%s\n%s\n%s\n" % (initMsg, pythonVersionLabel, osLabel, "-" * 80))
util.log.DUMP_FILE.flush()
except (OSError, IOError), exc:
print "Unable to write to debug log file: %s" % util.sysTools.getFileErrorMsg(exc)
@@ -355,6 +403,11 @@
# fetches descriptions for tor's configuration options
_loadConfigurationDescriptions(pathPrefix)
+ # dump tor and arm configuration when in debug mode
+ if isDebugMode:
+ util.log.log(CONFIG["log.savingDebugLog"], "Saving a debug log to '%s' (please check it for sensitive information before sharing)" % LOG_DUMP_PATH)
+ _dumpConfig()
+
interface.controller.startTorMonitor(time.time() - initTime, expandedEvents, param["startup.blindModeEnabled"])
conn.close()
Modified: arm/release/src/util/sysTools.py
===================================================================
--- arm/release/src/util/sysTools.py 2011-01-12 04:48:18 UTC (rev 24063)
+++ arm/release/src/util/sysTools.py 2011-01-12 04:56:09 UTC (rev 24064)
@@ -479,8 +479,15 @@
newValues["memUsagePercentage"] = float(memUsage) / totalMemory
else:
# the ps call formats results as:
- # %CPU RSS %MEM ELAPSED
- # 0.3 14096 1.3 29:51
+ #
+ # TIME ELAPSED RSS %MEM
+ # 3-08:06:32 21-00:00:12 121844 23.5
+ #
+ # or if Tor has only recently been started:
+ #
+ # TIME ELAPSED RSS %MEM
+ # 0:04.40 37:57 18772 0.9
+
psCall = call("ps -p %s -o cputime,etime,rss,%%mem" % self.processPid)
isSuccessful = False
@@ -504,6 +511,7 @@
if not isSuccessful:
raise IOError("unrecognized output from ps: %s" % psCall)
except IOError, exc:
+ newValues = {}
self._failureCount += 1
if self._useProc:
@@ -531,14 +539,14 @@
if not self._halt: self._cond.wait(sleepTime)
self._cond.release()
- # If this is the first run then the cpuSampling stat is meaningless
- # (there isn't a previous tick to sample from so it's zero at this
- # point). Setting it to the average, which is a fairer estimate.
- if self.lastLookup == -1:
- newValues["cpuSampling"] = newValues["cpuAvg"]
-
# sets the new values
if newValues:
+ # If this is the first run then the cpuSampling stat is meaningless
+ # (there isn't a previous tick to sample from so it's zero at this
+ # point). Setting it to the average, which is a fairer estimate.
+ if self.lastLookup == -1:
+ newValues["cpuSampling"] = newValues["cpuAvg"]
+
self._valLock.acquire()
self.cpuSampling = newValues["cpuSampling"]
self.cpuAvg = newValues["cpuAvg"]
Modified: arm/release/src/util/uiTools.py
===================================================================
--- arm/release/src/util/uiTools.py 2011-01-12 04:48:18 UTC (rev 24063)
+++ arm/release/src/util/uiTools.py 2011-01-12 04:56:09 UTC (rev 24064)
@@ -333,7 +333,7 @@
"""
Provides the number of seconds corresponding to the formatting used for the
cputime and etime fields of ps:
- [[dd-]hh:]mm:ss
+ [[dd-]hh:]mm:ss or hh:mm.ss
If the input entry is malformed then this raises a ValueError.
@@ -349,6 +349,9 @@
days = int(timeEntry[:dateDivider])
timeEntry = timeEntry[dateDivider+1:]
+ # normalise the seconds delimiter
+ timeEntry = timeEntry.replace(".", ":")
+
timeComp = timeEntry.split(":")
if len(timeComp) == 3:
hours, minutes, seconds = timeComp
Modified: arm/release/src/version.py
===================================================================
--- arm/release/src/version.py 2011-01-12 04:48:18 UTC (rev 24063)
+++ arm/release/src/version.py 2011-01-12 04:56:09 UTC (rev 24064)
@@ -2,6 +2,6 @@
Provides arm's version and release date.
"""
-VERSION = '1.4.1'
-LAST_MODIFIED = "January 7, 2011"
+VERSION = '1.4.1.1'
+LAST_MODIFIED = "January 11, 2011"
More information about the tor-commits
mailing list