[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r12848: Add better message templates to Server.py. Right now, you ne (in bridgedb/trunk: . lib/bridgedb)
Author: nickm
Date: 2007-12-17 22:34:00 -0500 (Mon, 17 Dec 2007)
New Revision: 12848
Modified:
bridgedb/trunk/
bridgedb/trunk/TODO
bridgedb/trunk/lib/bridgedb/Server.py
Log:
r17218@catbus: nickm | 2007-12-17 21:23:13 -0500
Add better message templates to Server.py. Right now, you need to edit them manually in that file, but they may eventually move into the configuration
Property changes on: bridgedb/trunk
___________________________________________________________________
svk:merge ticket from /bridgedb/trunk [r17218] on 8246c3cf-6607-4228-993b-4d95d33730f1
Modified: bridgedb/trunk/TODO
===================================================================
--- bridgedb/trunk/TODO 2007-12-17 22:44:18 UTC (rev 12847)
+++ bridgedb/trunk/TODO 2007-12-18 03:34:00 UTC (rev 12848)
@@ -1,10 +1,10 @@
For dec:
-- write a README
+o write a README
- proper logging
- check that incoming IP of email is sane.
- check more email headers for sanity
-- Send back useful messages in response to requests.
+o Send back useful messages in response to requests.
- Make the 'magic word' for the email configurable, case-tolerant,
html-tolerant, and punctuation-tolerant
- make all the rest of the email options configurable.
Modified: bridgedb/trunk/lib/bridgedb/Server.py
===================================================================
--- bridgedb/trunk/lib/bridgedb/Server.py 2007-12-17 22:44:18 UTC (rev 12847)
+++ bridgedb/trunk/lib/bridgedb/Server.py 2007-12-18 03:34:00 UTC (rev 12848)
@@ -17,6 +17,53 @@
import bridgedb.Dist
+HTML_MESSAGE_TEMPLATE = """
+<html><body>
+<p>Here are your bridge relays:
+<pre>%s</pre>
+</p>
+<p>Bridge relays (or "bridges" for short) are Tor relays that aren't listed
+in the main directory. Since there is no complete public list of them,
+even if your ISP is filtering connections to all the known Tor relays,
+they probably won't be able to block all the bridges.</p>
+<p>To use the above lines, go to Vidalia's Network settings page, and click
+"My ISP blocks connections to the Tor network". Then add each bridge
+address one at a time.</p>
+<p>Configuring more than one bridge address will make your Tor connection
+more stable, in case some of the bridges become unreachable.</p>
+<p>Another way to find public bridge addresses is to send mail to
+bridges@xxxxxxxxxxxxxx with the line "get bridges" by itself in the body
+of the mail. However, so we can make it harder for an attacker to learn
+lots of bridge addresses, you must send this request from a gmail or
+yahoo account.</p>
+</body></html>
+""".strip()
+
+EMAIL_MESSAGE_TEMPLATE = """\
+[This is an automated message; please do not reply.]
+
+Here are your bridge relays:
+
+%s
+
+Bridge relays (or "bridges" for short) are Tor relays that aren't listed
+in the main directory. Since there is no complete public list of them,
+even if your ISP is filtering connections to all the known Tor relays,
+they probably won't be able to block all the bridges.
+
+To use the above lines, go to Vidalia's Network settings page, and click
+"My ISP blocks connections to the Tor network". Then add each bridge
+address one at a time.
+
+Configuring more than one bridge address will make your Tor connection
+more stable, in case some of the bridges become unreachable.
+
+Another way to find public bridge addresses is to visit
+https://bridges.torproject.org/. The answers you get from that page
+will change every few days, so check back periodically if you need more
+bridge addresses.
+"""
+
class WebResource(twisted.web.resource.Resource):
isLeaf = True
@@ -35,7 +82,7 @@
else:
answer = "No bridges available."
- return "<html><body><pre>%s</pre></body></html>" % answer
+ return HTML_MESSAGE_TEMPLAY % answer
def addWebServer(cfg, dist, sched):
from twisted.web.server import Site
@@ -81,7 +128,7 @@
print "No from header. WTF."
return None,None
for ln in lines:
- if ln.strip() in ("get bridges", "Subject: get bridges"):
+ if ln.strip().lower() in ("get bridges", "subject: get bridges"):
break
else:
print "No request for bridges."
@@ -109,9 +156,10 @@
w.addheader("In-Reply-To", msgID)
w.addheader("Date", twisted.mail.smtp.rfc822date())
body = w.startbody("text/plain")
- for b in bridges:
- body.write("%s\n" % b.getConfigLine())
+ answer = "".join("%s\n" % b.getConfigLine() for b in bridges)
+ body.write(EMAIL_MESSAGE_TEMPLATE % answer)
+
f.seek(0)
return clientAddr, f