<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card id="index" title="Text File" newcontext="true">
<p>
Received: with ECARTIS (v1.0.0; list gopher);
 Wed, 10 Apr 2002 16:42:41 -0500 (EST)
Return-Path: &lt;jgoerzen@complete.org&gt;
Delivered-To: gopher@complete.org
Received: from christoph.complete.org (unknown [168.215.193.254])
	by pi.glockenspiel.complete.org (Postfix) with ESMTP id 73A603B80B
	for &lt;gopher@complete.org&gt;; Wed, 10 Apr 2002 16:42:40 -0500 (EST)
Received: from localhost (localhost [127.0.0.1])
	by christoph.complete.org (Postfix) with ESMTP id EFEF95A2F2
	for &lt;gopher@complete.org&gt;; Wed, 10 Apr 2002 16:42:38 -0500 (EST)
Date: Wed, 10 Apr 2002 16:42:37 -0500
Mime-Version: 1.0 (Apple Message framework v481)
Content-type: text/plain; charset=US-ASCII
Subject: [gopher] Pygopherd is in beta test
From: John Goerzen &lt;jgoerzen@complete.org&gt;
To: gopher@complete.org
Content-Transfer-Encoding: 8bit
Message-Id: &lt;E050023C-4CCB-11D6-9E96-0003930BF072@complete.org&gt;
X-Mailer: Apple Mail (2.481)
X-archive-position: 579
X-ecartis-version: Ecartis v1.0.0
Sender: gopher-bounce@complete.org
Errors-to: gopher-bounce@complete.org
X-original-sender: jgoerzen@complete.org
Precedence: bulk
Reply-to: gopher@complete.org
List-help: &lt;mailto:ecartis@complete.org?Subject=help&gt;
List-unsubscribe: &lt;mailto:gopher-request@complete.org?Subject=unsubscribe&gt;
List-software: Ecartis version 1.0.0
List-ID: Gopher &lt;gopher.complete.org&gt;
X-List-ID: Gopher &lt;gopher.complete.org&gt;
List-subscribe: &lt;mailto:gopher-request@complete.org?Subject=subscribe&gt;
List-owner: &lt;mailto:jgoerzen@complete.org&gt;
List-post: &lt;mailto:gopher@complete.org&gt;
List-archive: &lt;http://www.complete.org/mailinglists/archives/&gt;
X-list: gopher
</p>
<p></p>
<p>Hello,
</p>
<p>Today, I have switched quux.org over to Pygopherd.  I found some more
bugs really fast &lt;grin&gt;, and now everything is running smoothly.
</p>
<p>Pygopherd 0.9.0 has been released.  I&#x27;m including a from-memory
changelog and, at the bottom, the default configuration file so you can
see how the configuration system works.  I should mention that some
parts of the configuration file are actually interpreted as Python
expressions when it&#x27;s loaded (most notably, the lists and hashes in
there).
</p>
<p>* CompressedFileHandler to support transparent de-compression of files
before sending them on to the clients.  It works based on the detected
MIME encoding, so it tends to be more accurate than other mechanisms.
</p>
<p>* UMNDirHandler now does extension stripping for menus like UMN gopherd
does.  It is also configurable to determine exactly how this stripping
is done.
</p>
<p>* Lots of bugfixes, many of them with UMN stuff.
</p>
<p>* Pygopherd can now run chroot and can drop root privileges.
</p>
<p>* Moved to a more-correct MIME type value when encodings are present.  I
believe that this is now the most accurate MIME type calculation code in
any Gopher server.
</p>
<p>* Made a Debian package available.
</p>
<p>* Added logging capabilities.  Can log nowhere, to stdout, or to
syslog.  A sample log line is:
</p>
<p>Apr 10 16:29:31 pi pygopherd[20915]: 127.0.0.1
[GopherProtocol/UMNDirHandler]: /Government/USA/Enron
</p>
<p>* Made mimetypes a searchable path.
</p>
<p>* Added setup.py for installing pygopherd system-wide
</p>
<p>* Added ability to specify aliased server name.
</p>
<p>* Added scriptexec handler to execute arbitrary scripts in a Bucktooth
fashion.
</p>
<p>* Added support for gopher search requests to all protocols save HTTP.
</p>
<p>* Maildirs are now supported.
</p>
<p>Config file:
</p>
<p>######################################################################
# OVERALL SETTINGS FOR PYGOPHERD
######################################################################
</p>
<p>[pygopherd]
</p>
<p>##################################################
# Network
##################################################
</p>
<p># The server name to present to the world.  If you do not specify it
# here, Pygopherd will attempt to figure it out automatically.
#
# servername = gopher.example.com
</p>
<p># What port to listen on.  If not running as root, this must be
# greater than 1024.
</p>
<p>port = 70
</p>
<p># Type of server to run.  Valid options are ForkingTCPServer
# and ThreadingTCPServer.  ForkingTCPServer is highly recommended
# for now.
</p>
<p>servertype = ForkingTCPServer
</p>
<p>##################################################
# Security
##################################################
</p>
<p>## Whether or not to use chroot.
# This option is only valid if you are running pygopherd as root!
</p>
<p>usechroot = yes
</p>
<p>## Username and groupname to setreuid/setregid to.  Valid only if
## starting pygopherd as root.  Comment out if you don&#x27;t want this
## functionality.  NOTE: DO NOT RUN AS ROOT UNLESS YOU USE THESE!  BAD
BAD BAD!
</p>
<p>setuid = gopher
setgid = gopher
</p>
<p>##################################################
# Filesystem and MIME
##################################################
</p>
<p># Where the documents are stored.
</p>
<p>root = /var/gopher
</p>
<p># Location of a file to use to figure out MIME types.  You can
# specify multiple files here -- just separate them with a colon.
</p>
<p>mimetypes = /etc/pygopherd/mime.types:/etc/mime.types
</p>
<p># Encodings.  You can use the default with the following syntax.  The
# mimetypex.encodings_map is {&#x27;.Z&#x27;: &#x27;compress&#x27;, &#x27;.gz&#x27;: &#x27;gzip&#x27;}.
#
# For ease of use in the config file, we specify this as a list of
# tuples.  You can convert any hash to a list of tuples by using .items()
</p>
<p># encoding = mimetypes.encodings_map.items()
</p>
<p># You can override the default entirely (ie, to remove those) like this:
</p>
<p># encoding = {&#x27;.bz2&#x27; : &#x27;bzip2&#x27;, &#x27;.gz&#x27; : &#x27;gzip&#x27;}.items()
# Or the same thing:
# encoding = [(&#x27;.bz2&#x27;, &#x27;bzip2&#x27;), (&#x27;.gz&#x27;, &#x27;gzip&#x27;)]
</p>
<p># Or, you can extend the default like so:
</p>
<p>encoding = mimetypes.encodings_map.items() + \
           {&#x27;.bz2&#x27; : &#x27;bzip2&#x27;
           }.items()
</p>
<p>######################################################################
# Logging
######################################################################
</p>
<p>[logger]
</p>
<p># Log method to use.  One of:
#  syslog -- use Unix syslog facility
#  stdout -- log to standard output
#  none   -- no logging
</p>
<p>logmethod = syslog
</p>
<p># If you enable syslog, you will need to define these as well:
</p>
<p># priority -- one of the following (listed in order of high to low):
# LOG_EMERG, LOG_ALERT, LOG_CRIT, LOG_ERR, LOG_WARNING, LOG_NOTICE,
# LOG_INFO, LOG_DEBUG
</p>
<p>priority = LOG_INFO
</p>
<p># Facility -- one of the following:
# LOG_KERN, LOG_USER, LOG_MAIL, LOG_DAEMON, LOG_AUTH, LOG_LPR, LOG_NEWS,
# LOG_UUCP, LOG_CRON, LOG_LOCAL0 - LOG_LOCAL7
</p>
<p>facility = LOG_LOCAL3
</p>
<p></p>
<p></p>
<p>######################################################################
# GOPHER OBJECTS
######################################################################
</p>
<p># Settings for gopher objects
</p>
<p>[GopherEntry]
</p>
<p># Use this MIME type if no other type is found.
defaultmimetype = text/plain
</p>
<p># Mapping from MIME types to gopher0 single-character types.
# This is a list of lists.  The first entry in each list is a
# regexp to match and the second is the result.
#
# Please have a .* at the end to map all unknown types to a certain
# character.  For best results, that character should be nicely
# corresponding to the defaultmimetype.
</p>
<p>mapping = [[&#x27;text/html&#x27;, &#x27;h&#x27;],
         [&#x27;text/.+&#x27;, &#x27;0&#x27;],
         [&#x27;application/mac-binhex40&#x27;, &#x27;4&#x27;],
         [&#x27;audio/.+&#x27;, &#x27;s&#x27;],
         [&#x27;image/gif&#x27;, &#x27;g&#x27;],
         [&#x27;image/.+&#x27;, &#x27;I&#x27;],
	[&#x27;application/gopher-menu&#x27;, &#x27;1&#x27;],
	[&#x27;application/gopher\+-menu&#x27;, &#x27;1&#x27;],
         [&#x27;multipart/mixed&#x27;, &#x27;M&#x27;],
         [&#x27;application/.+&#x27;, &#x27;9&#x27;],
         [&#x27;.*&#x27;, &#x27;0&#x27;]
         ]
</p>
<p></p>
<p>######################################################################
# HANDLERS
######################################################################
</p>
<p>##################################################
# Handler multiplexer
##################################################
</p>
<p>[handlers.HandlerMultiplexer]
</p>
<p># A list of the handlers to consider.  The handlers
# are tried in the order listed.
#
#
### Suggested settings:
# Note: the UMNDirHandler will handle all directories, even if they
# do not have UMN-specific files, so you do not need to list the
# dirhandler in this case.
#
# Warning: scriptexec and pyg can execute arbitrary code stored in
# your path.  Don&#x27;t enable unless you know what you&#x27;re doing!
#
# For UMN emulation:  (full UMN featureset excluding scriptexec, no
others)
#
# handlers = [url.HTMLURLHandler, UMN.UMNDirHandler,
#             html.HTMLFileTitleHandler,
#             mbox.MBoxMessageHandler, mbox.MBoxFolderHandler,
#             file.CompressedFileHandler, file.FileHandler]
#
# For Bucktooth emulation:  (full Buck featureset excluding scriptexec)
#
#handlers = [gophermap.BuckGophermapHandler, url.HTMLURLHandler,
#             file.FileHandler, dir.DirHandler]
#
# For full Pygopherd featureset excluding scripts, compression, and PYG.
# Supports both UMN and Bucktooth featuresets.  This is the default
# configuration for Pygopherd because it is secure yet versatile.
#
</p>
<p>handlers = [url.HTMLURLHandler, gophermap.BuckGophermapHandler,
             mbox.MaildirFolderHandler, mbox.MaildirMessageHandler,
             UMN.UMNDirHandler, html.HTMLFileTitleHandler,
             mbox.MBoxMessageHandler, mbox.MBoxFolderHandler,
             file.FileHandler]
</p>
<p># For full Pygopherd featureset including scripts and PYG.  Same as
# above but adds scripts, decompression, and PYG execution.
</p>
<p>#handlers = [url.HTMLURLHandler, gophermap.BuckGophermapHandler,
#            mbox.MaildirFolderHandler, mbox.MaildirMessageHandler,
#            UMN.UMNDirHandler, html.HTMLFileTitleHandler,
#            mbox.MBoxMessageHandler, mbox.MBoxFolderHandler,
#            pyg.PYGHandler, scriptexec.ExecHandler,
#            file.CompressedFileHandler, file.FileHandler]
</p>
<p>##################################################
# Decompressing file handler
##################################################
</p>
<p>[handlers.file.CompressedFileHandler]
</p>
<p># Decompressors is a map from an encoding (as specified in the
# pygopherd section above) to a decompression program.
# The decompression program must
# accept the input in its stdin and write the decompressed output
# to stdout.
#
# If you do not want to decompress things automatically for your
# clients, you might wish to NOT use this handler.
#
# Note: this feature is probably NOT compatible with chroot unless
# you take extra precautions.
</p>
<p># We enable no decompressors by default... you&#x27;ll need to do that.
</p>
<p>decompressors = {}
</p>
<p>#decompressors = {&#x27;bzip2&#x27;: &#x27;bzcat&#x27;,
#              &#x27;gzip&#x27; : &#x27;zcat&#x27;,
#              &#x27;compress&#x27; : &#x27;zcat&#x27;}
</p>
<p># Regexp to match against filenames pending decompression.
# The default will let ALL files be decompressed.
</p>
<p>decompresspatt = .*
</p>
<p># You can be more restrictive:
</p>
<p># decompresspatt = \.txt\.(bz2|gz|Z)$
</p>
<p></p>
<p>##################################################
# Directory handler
##################################################
</p>
<p>[handlers.dir.DirHandler]
# A regular expression of files to ignore.  These files
# will not be presented in lists of files to clients,
# but if clients know the exact path to the files, they can
# still be requested.
#
# This pattern is matched against the requested selector.
# Selectors are guaranteed to begin with a slash by this point.
# and never end with a slash unless they consist solely of a slash.
#
# By default, we ignore files starting with a period, gophermap
# files, and files ending with a tilde.
#
# The default emulates UMN&#x27;s default plus buck.
#
# A buck-only server might like:
#
# ignorepatt = ~$|/\.|/gophermap$
</p>
<p>ignorepatt =
/.cap$|/lost\+found$|/lib$|/bin$|/etc$|/dev$|~$|/\.cache|/\.forward$|/\.message$|
/\.hushlogin$|/\.kermrc$|/\.notar$|/\.where$|/veronica.ctl$|/robots.txt$|/nohup.
out$|/gophermap$|~$
</p>
<p># Expiration time, in seconds, for the cache.
# Set to 0 to disable caching entirely.
</p>
<p>cachetime = 180
</p>
<p># Name of the cahe file.  Must be set to something even if the cachetime
# is zero.  In that case, this filename will not be used but for the conf
# file to parse, it must still be set.
</p>
<p>cachefile = .cache.pygopherd.dir
</p>
<p>##################################################
# UMN Directory Handler
##################################################
</p>
<p>[handlers.UMN.UMNDirHandler]
</p>
<p># Extension stripping behavior.  When a file from a directory
# is presented in a menu, and no name is given, what to do?
# For instance, given a file Welcome.txt and pygopherd.tar.gz:
#
# If extstrip is none, present Welcome.txt and pygopherd.tar.gz in the
# menu.
#
# If extstrip is nonencoded, modify only those files that do not
# have encodings.  (If CompressedFileHandler is used, modify only
# those files that to not have *HANDLED* encodings.)
# If gzip is NOT a handled encoding, you&#x27;d get names Welcome and
# pygopherd.tar.gz.  If gzip IS a handled encoding, you&#x27;d get
# Welcome and pygopherd.
#
# If extstrip is full, modify all modifyable names.  Welcome.txt -&gt;
# Welcome and pygopherd.tar.gz -&gt; pygopherd.
</p>
<p># extstrip = none
extstrip = nonencoded
# extstrip = full
</p>
<p></p>
<p>######################################################################
# PROTOCOLS
######################################################################
</p>
<p>##################################################
# Protocol Multiplexer
##################################################
</p>
<p>[protocols.ProtocolMultiplexer]
</p>
<p># A list of the protocols to consider for each request.
# The protocols are tried in the order listed.
</p>
<p>protocols = [http.HTTPProtocol,
              gopherp.GopherPlusProtocol, rfc1436.GopherProtocol]
</p>
<p>##################################################
# Gopher+ Protocol
##################################################
</p>
<p>[protocols.gopherp.GopherPlusProtocol]
# The name and e-mail of the administrator
admin = Unconfigured Pygopherd Admin &lt;pygopherd@nowhere.nowhere&gt;
</p>
<p>##################################################
# HTTP Protocol
##################################################
</p>
<p>[protocols.http.HTTPProtocol]
iconmapping = {&#x27;h&#x27; : &#x27;text.gif&#x27;,
             &#x27;0&#x27; : &#x27;text.gif&#x27;,
             &#x27;4&#x27; : &#x27;binhex.gif&#x27;,
             &#x27;s&#x27; : &#x27;sound1.gif&#x27;,
             &#x27;g&#x27; : &#x27;image3.gif&#x27;,
             &#x27;I&#x27; : &#x27;image3.gif&#x27;,
             &#x27;M&#x27; : &#x27;text.gif&#x27;,
             &#x27;9&#x27; : &#x27;binary.gif&#x27;,
             &#x27;1&#x27; : &#x27;folder.gif&#x27;,
             &#x27;i&#x27; : &#x27;blank.gif&#x27;}
</p>
<p></p>
</card>
</wml>
