From f8ef6c208aee42dd24c8836797a89f786c985a6f Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Tue, 10 Apr 2007 03:03:05 +0000 Subject: [PATCH] Initial mod_waklog support --- configDefault/apache.cfg | 6 ++++-- configDefault/apache.csg | 4 ++-- src/configTypes.sml | 34 ++++++++++++++++++++++++++++++++++ src/main.sml | 2 +- src/plugins/apache.sml | 14 +++++++++++++- src/sources | 2 ++ 6 files changed, 56 insertions(+), 6 deletions(-) create mode 100644 src/configTypes.sml diff --git a/configDefault/apache.cfg b/configDefault/apache.cfg index 33ca610..7181b49 100644 --- a/configDefault/apache.cfg +++ b/configDefault/apache.cfg @@ -1,5 +1,7 @@ structure Apache :> APACHE_CONFIG = struct +open ConfigTypes + val reload = "/usr/bin/sudo /usr/local/sbin/domtool-publish apache" val down = "/usr/bin/sudo /usr/local/sbin/domtool-publish apache-down" val undown = "/usr/bin/sudo /usr/local/sbin/domtool-publish apache-undown" @@ -10,8 +12,8 @@ val undown1 = "/usr/bin/sudo /usr/local/sbin/domtool-publish apache1.3-undown" val confDir = "/var/domtool/vhosts" -val webNodes_all = [("mire", true)] -val webNodes_admin = [("deleuze", false)] +val webNodes_all = [("mire", {version = APACHE_1_3, auth = MOD_WAKLOG})] +val webNodes_admin = [("deleuze", {version = APACHE_2, auth = NO_AUTH})] val webNodes_default = ["mire"] diff --git a/configDefault/apache.csg b/configDefault/apache.csg index 0491805..b0b8d11 100644 --- a/configDefault/apache.csg +++ b/configDefault/apache.csg @@ -10,8 +10,8 @@ signature APACHE_CONFIG = sig val confDir : string - val webNodes_all : (string * bool) list - val webNodes_admin : (string * bool) list + val webNodes_all : (string * ConfigTypes.apache_info) list + val webNodes_admin : (string * ConfigTypes.apache_info) list val webNodes_default : string list val proxyTargets : string list diff --git a/src/configTypes.sml b/src/configTypes.sml new file mode 100644 index 0000000..a92bb76 --- /dev/null +++ b/src/configTypes.sml @@ -0,0 +1,34 @@ +(* HCoop Domtool (http://hcoop.sourceforge.net/) + * Copyright (c) 2007, Adam Chlipala + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + *) + +(* Datatypes to use in configuration (config.sml et al.) *) + +structure ConfigTypes = struct + +datatype apache_version = + APACHE_1_3 + | APACHE_2 + +datatype apache_auth_scheme = + NO_AUTH + | MOD_WAKLOG + +type apache_info = {version : apache_version, + auth : apache_auth_scheme} + +end \ No newline at end of file diff --git a/src/main.sml b/src/main.sml index b6b6d24..f7b8346 100644 --- a/src/main.sml +++ b/src/main.sml @@ -1,5 +1,5 @@ (* HCoop Domtool (http://hcoop.sourceforge.net/) - * Copyright (c) 2006, Adam Chlipala + * Copyright (c) 2006-2007, Adam Chlipala * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License diff --git a/src/plugins/apache.sml b/src/plugins/apache.sml index 4ea0389..511901c 100644 --- a/src/plugins/apache.sml +++ b/src/plugins/apache.sml @@ -228,10 +228,15 @@ fun findVhostUser fname = val webNodes_full = Config.Apache.webNodes_all @ Config.Apache.webNodes_admin fun isVersion1 node = - List.exists (fn x => x = (node, true)) webNodes_full + List.exists (fn (n, {version = ConfigTypes.APACHE_1_3, ...}) => n = node + | _ => false) webNodes_full fun imVersion1 () = isVersion1 (Slave.hostname ()) +fun isWaklog node = + List.exists (fn (n, {auth = ConfigTypes.MOD_WAKLOG, ...}) => n = node + | _ => false) webNodes_full + fun down () = if imVersion1 () then Config.Apache.down1 else Config.Apache.down fun undown () = if imVersion1 () then Config.Apache.undown1 else Config.Apache.undown fun reload () = if imVersion1 () then Config.Apache.reload1 else Config.Apache.reload @@ -442,6 +447,13 @@ val () = Env.containerV_one "vhost" TextIO.output (file, group)) else (); + if isWaklog node then + (TextIO.output (file, "\n\tWaklogProtected on\n\tWaklogPrincipal "); + TextIO.output (file, user); + TextIO.output (file, "/cgi@HCOOP.NET /etc/keytabs/cgi/"); + TextIO.output (file, user)) + else + (); (Domain.homedirOf user ^ "/apache/log/" ^ node ^ "/" ^ vhostId, file) end) diff --git a/src/sources b/src/sources index 70b79da..a544a3b 100644 --- a/src/sources +++ b/src/sources @@ -5,6 +5,8 @@ dataStructures.sml ast.sml +configTypes.sml + ../configDefault/config.sig ../configDefault/configDefault.sml -- 2.20.1