[or-cvs] r20920: {projects} -Update installation information in README -Be secretive abo (in projects/gettor: . lib/gettor)

kaner at seul.org kaner at seul.org
Sun Nov 8 12:18:35 UTC 2009


Author: kaner
Date: 2009-11-08 07:18:35 -0500 (Sun, 08 Nov 2009)
New Revision: 20920

Modified:
   projects/gettor/GetTor.py
   projects/gettor/README
   projects/gettor/lib/gettor/gtlog.py
   projects/gettor/lib/gettor/utils.py
Log:
-Update installation information in README
-Be secretive about our password file
-If logging is set to 'file', create all dirs that are needed


Modified: projects/gettor/GetTor.py
===================================================================
--- projects/gettor/GetTor.py	2009-11-08 10:54:23 UTC (rev 20919)
+++ projects/gettor/GetTor.py	2009-11-08 12:18:35 UTC (rev 20920)
@@ -62,7 +62,6 @@
 def processOptions(options, conf):
     """Do everything that's not part of parsing a mail. Prepare GetTor usage,
     install files, fetch packages, do some black/whitelist voodoo and so on""" 
-    print "Options: ", options
     # Order matters!
     if options.insttrans:
         m = gettor.utils.installTranslations(conf, options.i18ndir)

Modified: projects/gettor/README
===================================================================
--- projects/gettor/README	2009-11-08 10:54:23 UTC (rev 20919)
+++ projects/gettor/README	2009-11-08 12:18:35 UTC (rev 20920)
@@ -5,6 +5,9 @@
 
 The following document explains how to setup GetTor for a server admin.
 
+PREREQUISITES
+-------------
+
 To deploy GetTor, you'll want a machine that invokes .forward files
 for users. You'll also want to have python and rsync installed.
 
@@ -25,33 +28,30 @@
 This setup descripton presumes that you have access to the latest gettor svn 
 trunk somewhere in your local file system.
 
-First, you will need to copy files over to your installation directory:
+    svn co https://freehaven.net/svn/projects/gettor gettor
 
-    gettor at moria:~/src/trunk/$ cp GetTor.py /home/gettor/bin
-    gettor at moria:~/src/trunk/$ cp -r gettor /home/gettor/bin
-    gettor at moria:~/src/trunk/$ cp -r i18n /home/gettor/bin
+After checking out the GetTor source code, you will need to install everything
+as follows:
 
-Here is a list of all files you'll need in place:
+    cd gettor/
+    python setup.py install
 
+This will copy necessary files to ~/opt/gettor.
 
+Next, configure your ~/.gettorrc file (see "Configuration", below).
 
-This is somewhat cumbersome, but until setup.py is fixed, this is ok as a 
-temporary solution.
-
 After that, you will want to ensure that you have a properly configured set
 of mo files for each translation. Generate and install mo files as follows:
 
-    gettor at moria:~/bin$ ./GetTor.py -r
+    gettor at moria:~/opt/gettor$ ./GetTor.py -r
 
 You'll see something like this upon success:
 
     2009-06-21 20:06:01,324 (6136) Installing translation files done.
 
-Next, configure your ~/.gettorrc file (see "Configuration", below).
-
 Once you have everything installed, you'll want to initialize the file store:
 
-    gettor at moria:~/bin$ ./GetTor.py -f -p
+    gettor at moria:~/opt/gettor$ ./GetTor.py -fp
 
 You should see an rsync and finally something like:
 
@@ -63,13 +63,18 @@
 Now you'll install the cronjob. This clears the blacklist and updates
 packages daily:
 
-    gettor at moria:~/bin$ ./GetTor.py -i
-    2009-01-05 17:34:53,911 (16646) Installing cron done.
+    gettor at moria:~/opt/gettor$ ./GetTor.py -i
+    2009-01-05 17:34:53,911 (16646) Installing cron donee
 
+Set up a password for package forwarding commands if you wish to use that 
+feature:
+
+    gettor at moria:~/opt/gettor$ ./GetTor.py -s seCreTpAssworD
+
 Finally, you need to setup email forwarding to the GetTor bot like so:
 
     gettor at moria:~$ cat .forward
-    "|/home/gettor/bin/GetTor.py"
+    "|/home/gettor/opt/gettor/GetTor.py"
 
 Now GetTor.py is installed, prepared and ready to serve files. Send it email!
 
@@ -78,7 +83,7 @@
 Provided there is a working locale environment, GetTor will compile and setup
 locale files for you as follows:
 
-    gettor at moria:~/bin$ ./GetTor.py -r
+    gettor at moria:~/opt/gettor$ ./GetTor.py -r
     2009-01-08 12:18:09,041 (19287) Installing translation files done.
 
 You can also configure the .mo files to live in another place by telling GetTor
@@ -88,13 +93,13 @@
 
 This will result in GetTor expecting the English .mo file in the directory
 
-    /home/gettor/gettor/i18n/en/LC_MESSAGES/gettor.mo
+    /home/gettor/gettor/i18n/en/gettor.mo
 
 Also, in case your .po files for some reason live in a different directory
 than i18n/ (relative to GetTor.py, as provided by GetTor), you can tell this
 to GetTor as follows:
 
-    gettor at moria:~/bin$ ./GetTor.py -r -d /path/to/my/mofiles/directory
+    gettor at moria:~/opt/gettor$ ./GetTor.py -r -d /path/to/my/mofiles/directory
 
 Note that GetTor will expect the same directory structure as provided under
 i18n/ in the GetTor source package, e.g. 'i18n/en/gettor_en.po',
@@ -125,15 +130,16 @@
 
     gettor at moria:~$ cat .gettorrc
     [global]
-    stateDir    = /home/gettor/gettor/state/
-    blStateDir  = /home/gettor/gettor/bl/
-    wlStateDir  = /home/gettor/gettor/wl/
-    distDir     = /home/gettor/gettor/distdir/
-    packDir     = /home/gettor/gettor/packdir/
-    locale      = en
-    logSubSystem= stdout
-    logFile     = /home/gettor/gettor/logs/logfile
-    localeDir   =  /home/gettor/gettor/i18n/
+    stateDir        = /home/gettor/gettor/state/
+    blStateDir      = /home/gettor/gettor/bl/
+    wlStateDir      = /home/gettor/gettor/wl/
+    distDir         = /home/gettor/gettor/distdir/
+    packDir         = /home/gettor/gettor/packdir/
+    locale          = en
+    logSubSystem    = stdout
+    logFile         = /home/gettor/gettor/logs/logfile
+    localeDir       =  /home/gettor/gettor/i18n/
+    cmdPassFile     = /home/gettor/gettor/pass
 
 You can leave any of these lines out, and it will choose a suitable
 default.
@@ -157,6 +163,7 @@
                            also set to something useful
 localeDir:     This is where the 'en/LC_MESSAGES/gettor.mo' or
                'whateverlang/LC_MESSAGES/gettor.mo' should go
+cmdPassFile:   The file containing the hashed command password
 
 WHAT'S DKIM / WHY DKIM?
 -----------------------

Modified: projects/gettor/lib/gettor/gtlog.py
===================================================================
--- projects/gettor/lib/gettor/gtlog.py	2009-11-08 10:54:23 UTC (rev 20919)
+++ projects/gettor/lib/gettor/gtlog.py	2009-11-08 12:18:35 UTC (rev 20920)
@@ -52,11 +52,13 @@
         # Silently fail if things are misconfigured
         logFile = conf.getLogFile()
         try:
-            if os.access(os.path.dirname(logFile), os.W_OK):
-                handler = logging.FileHandler(logFile)
-            else:
-                logSubSystem = "nothing"
-        except:
+            logDir = os.path.dirname(logFile)
+            if not os.access(logDir, os.W_OK):
+                os.makedirs(logDir)
+            handler = logging.FileHandler(logFile)
+        except Exception, e:
+            err = "Caught an exception while trying to setup logging: %s" %e
+            sys.stderr.write(err)
             logSubSystem = "nothing"
     elif logSubSystem == "syslog":
         handler = logging.handlers.SysLogHandler(address="/dev/log")

Modified: projects/gettor/lib/gettor/utils.py
===================================================================
--- projects/gettor/lib/gettor/utils.py	2009-11-08 10:54:23 UTC (rev 20919)
+++ projects/gettor/lib/gettor/utils.py	2009-11-08 12:18:35 UTC (rev 20920)
@@ -79,9 +79,11 @@
                 log.error("Error accessing translation files.")
                 return False
     if hasDirs is None:
-        log.errpr("Empty locale dir: " % localeSrcdir)
+        log.error("Empty locale dir: " % localeSrcdir)
         return False
 
+    log.info("Installing translation files done.")
+
     return True
 
 def fetchPackages(conf, mirror):
@@ -214,6 +216,8 @@
         fd = open(cmdPassFile, 'w')
         fd.write(passwordHash)
         fd.close
+        # Be secretive
+        os.chmod(cmdPassFile, 0400)
         return True
     except Exception, e:
         log.error("Creating list entry %s failed: %s" % (entry, e))



More information about the tor-commits mailing list