summaryrefslogtreecommitdiff
path: root/Mailman/Queue/HTTPRunner.py
diff options
context:
space:
mode:
authorbwarsaw2007-01-05 06:47:39 +0000
committerbwarsaw2007-01-05 06:47:39 +0000
commit9af2533eb89e48683c049c5007737f7e94bbcdc1 (patch)
tree54853dcccee453eae60916af4e612b3004cc736f /Mailman/Queue/HTTPRunner.py
parentd7da90ebc8aeee180ba470c002f7e37ef7df1089 (diff)
downloadmailman-9af2533eb89e48683c049c5007737f7e94bbcdc1.tar.gz
mailman-9af2533eb89e48683c049c5007737f7e94bbcdc1.tar.zst
mailman-9af2533eb89e48683c049c5007737f7e94bbcdc1.zip
Clean up file permissions and umask settings. Now we set the umask to 007
during early initialization so that we're guaranteed to get the right value regardless of the shell umask used to invoke the command line script. While we're at it, we can remove almost all individual umask settings previously in the code, and make file permissions consistently -rw-rw---- (IOW, files are no longer other readable). The only subsystem that wasn't changed was the archiver, because it uses its own umask settings to ensure that private archives have the proper permissions. Eventually we'll mess with this, but if it ain't broken... Note that check_perms complains about directory permissions, but I think check_perms can be fixed (or perhaps, even removed?!). If we decide to use LMTPRunner and HTTPRunner exclusively then no outside process will be touching our files potentially with the incorrect permissions, umask, owner, or group. If we control all of our own touch points then I think we can lock out 'other'. Another open question is whether Utils.set_global_password() can have its umask setting removed. It locks permissions down so even the group can't write to the site password file, but the default umask of 007 might be good enough even for this file. Utils.makedirs() now takes an optional mode argument, which defaults to 02775 for backward compatibility. First, the default mode can probably be changed to 02770 (see above). Second, all code that was tweaking the umask in order to do a platform compatible os.mkdir() has now been refactored to use Utils.makedirs(). Another tricky thing was getting SQLite via SQLAlchemy to create its data/mailman.db file with the proper permissions. From the comment in dbcontext.py: # XXX By design of SQLite, database file creation does not honor # umask. See their ticket #1193: # http://www.sqlite.org/cvstrac/tktview?tn=1193,31 More details in that file, but the work around is to essentially 'touch' the database file if 'sqlite' is the scheme of the SQLAlchemy URL. This little pre-touch sets the right umask honoring permission and won't hurt if the file already exists. SQLite will happily keep the existing permissions, and in fact that ticket referenced above recommends doing things this way. In the Mailman.database.initialize(), create a global lock that prevents more than one process from entering this init function at the same time. It's probably not strictly necessary given that I believe all the operations in dbcontext.connect() are multi-processing safe, but it also doesn't seem to hurt and prevents race conditions regardless of the database's own safeguards (or lack thereof). Make sure nightly_gzip.py calls initialize().
Diffstat (limited to 'Mailman/Queue/HTTPRunner.py')
-rw-r--r--Mailman/Queue/HTTPRunner.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/Mailman/Queue/HTTPRunner.py b/Mailman/Queue/HTTPRunner.py
index 32620f458..1858cff58 100644
--- a/Mailman/Queue/HTTPRunner.py
+++ b/Mailman/Queue/HTTPRunner.py
@@ -61,6 +61,7 @@ server = make_server(config.HTTP_HOST, config.HTTP_PORT,
qlog.info('HTTPRunner qrunner started.')
+hlog.info('HTTPRunner listening on %s:%s', config.HTTP_HOST, config.HTTP_PORT)
try:
server.serve_forever()
# Do it this way because of exception hierarchy changes in Python 2.5. XXX