From 1c9b5e20aa62cd8dee53c92c2066c77811ea1fdc Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Sat, 17 Nov 2007 20:56:45 +0000 Subject: [PATCH] Initial mailman vhost config --- src/plugins/apache.sig | 2 ++ src/plugins/mailman.sml | 70 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+) diff --git a/src/plugins/apache.sig b/src/plugins/apache.sig index 2cc2eb5..95b1923 100644 --- a/src/plugins/apache.sig +++ b/src/plugins/apache.sig @@ -34,4 +34,6 @@ signature APACHE = sig val defaults : (string * Ast.typ * (unit -> Ast.exp)) list (* Default environment variables *) + + val ssl : string option Env.arg end diff --git a/src/plugins/mailman.sml b/src/plugins/mailman.sml index 43c56c0..d3212bd 100644 --- a/src/plugins/mailman.sml +++ b/src/plugins/mailman.sml @@ -38,6 +38,76 @@ val () = Env.action_one "mailmanWebHost" close () end) +val () = Env.actionV_one "mailmanVhost" + ("host", Env.string) + (fn (env, host) => + let + val nodes = Env.env (Env.list Env.string) (env, "WebNodes") + + val ssl = Env.env Apache.ssl (env, "SSL") + val user = Env.env Env.string (env, "User") + + val fullHost = host ^ "." ^ Domain.currentDomain () + val vhostId = fullHost ^ (if Option.isSome ssl then ".ssl" else "") + val confFile = fullHost ^ (if Option.isSome ssl then ".vhost_ssl" else ".vhost") + in + app (fn node => + let + val file = Domain.domainFile {node = node, + name = confFile} + fun print s = TextIO.output (file, s) + + val ld = Apache.logDir {user = user, node = node, vhostId = vhostId} + in + print " "443" + | NONE => "80"); + print "\n"; + print " ServerName $LISTDOMAIN\n"; + print " ServerAdmin "; + print user; + print "@hcoop.net\n"; + print " SuexecUserGroup list list\n"; + print "\n"; + print " ErrorLog "; + print ld; + print "/error.log\n"; + print " CustomLog "; + print ld; + print "/access.log combined\n"; + print "\n"; + print " RewriteEngine on\n"; + print "\n"; + print " # Default to showing listinfo page\n"; + print " RewriteRule ^/$ http://"; + print fullHost; + print "/listinfo/\n"; + print "\n"; + print " Alias /images/mailman /usr/share/images/mailman\n"; + print " Alias /pipermail /var/lib/mailman/archives/public\n"; + print "\n"; + print " DocumentRoot /usr/lib/cgi-bin/mailman\n"; + print " \n"; + print " AllowOverride None\n"; + print " Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch\n"; + print " ForceType cgi-script\n"; + print " Order allow,deny\n"; + print " Allow from all\n"; + print " \n"; + print "\n"; + print " \n"; + print " Order allow,deny\n"; + print " Allow from all\n"; + print " \n"; + print "\n"; + + TextIO.closeOut file + end) nodes + end) + val mailmanChanged = ref false val () = Slave.registerPreHandler (fn () => mailmanChanged := false) -- 2.20.1